using System;
using Sirenix.OdinInspector;
using UnityEngine;
using VOID.Generic.Dict;
using VOID.Generic.Objects.Unit;
using VOID.Generic.Objects.Weapon;

namespace VOID.Generic.Requirement
{
    [TypeRegistryItem("Equipped Weapon Carry Type")]
    [Serializable]
    public class RequirementWeaponCarryType : IUnitRequirement
    {
        [SerializeField]
        [Required]
        private WeaponCarryType _weaponCarryType;

        public bool Check(UnitObject unit)
        {
            return ((WeaponObject)unit.unitEquipment.GetEquipped(EquipmentSlotType.MainHand))?.weaponData.weaponCarryType == _weaponCarryType
                || ((WeaponObject)unit.unitEquipment.GetEquipped(EquipmentSlotType.OffHand))?.weaponData.weaponCarryType == _weaponCarryType;
        }
    }
}