using System.Collections.Generic;
using Sirenix.OdinInspector;
using Sirenix.Utilities;
using UnityEngine;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Abstract;
using VOID.Generic.Objects.Unit;

namespace VOID.Generic.Projectile.HitValidator
{
    [TypeRegistryItem("Unit")]
    public class ProjectileHitUnit : IProjectileHitValidator
    {
        [SerializeField] private List<AttitudeType> _attitudes = new();
        
        public bool IsValid(UnitObject caster, AbstractObject target)
        {
            if (target is not UnitObject targetUnit) return false;
            if (_attitudes.IsNullOrEmpty()) return true;
            if (_attitudes.Contains(caster.unitAttitude.GetAttitudeWith(targetUnit))) return true;
            return false;
        }
    }
}