using UnityEngine;
using YachtDice.Categories;
using YachtDice.Modifiers.Core;
using YachtDice.Modifiers.Definition;
using YachtDice.Modifiers.Runtime;

namespace YachtDice.Modifiers.Conditions
{
    [CreateAssetMenu(fileName = "CategoryCondition", menuName = "YachtDice/Modifiers/Conditions/Category")]
    public class CategoryCondition : Condition
    {
        [SerializeField] private CategoryDefinition requiredCategory;

        public override bool Evaluate(ModifierContext context, ModifierInstance instance)
        {
            return context.Category == requiredCategory;
        }

#if UNITY_EDITOR
        public static CategoryCondition CreateForTest(CategoryDefinition category)
        {
            var so = CreateInstance<CategoryCondition>();
            so.requiredCategory = category;
            return so;
        }
#endif
    }
}
