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.TargetValidator
{
    [TypeRegistryItem("Unit")]
    public class ProjectileTargetUnit : IProjectileTargetValidator
    {
        [SerializeField] private List<AttitudeType> _attitudes = new();
        
        public bool IsValid(UnitObject caster, Vector3 targetPosition, AbstractObject targetObject)
        {
            if (targetObject is not UnitObject targetUnit) return false;
            if (_attitudes.IsNullOrEmpty()) return true;
            if (_attitudes.Contains(caster.unitAttitude.GetAttitudeWith(targetUnit))) return true;
            return false;
        }
    }
}