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

namespace VOID.Generic.Requirement
{
    [TypeRegistryItem("Max Unit Resource")]
    [Serializable]
    public class RequirementMaxUnitResource : IUnitRequirement
    {
        [SerializeField]
        [Required]
        private UnitResourceType _resourceType;
        
        [SerializeField]
        [MinValue(1)]
        private float _resourceValue;
        
        public bool Check(UnitObject unit)
        {
            return unit.unitData.maxResources.Get(_resourceType) >= _resourceValue;
        }
    }
}