using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using VOID.Generic.Status.Effect;

namespace VOID.ScriptableObjects.Player
{
    [CreateAssetMenu(menuName = "GAME DATA/Player/LevelUpOption")]
    public class LevelUpOption : ScriptableObject
    {
        // GENERIC
        [Title("Generic")]
        [Required]
        public string displayName;
        
        [Required]
        [PreviewField]
        public Texture2D displayIcon;
        
        [TextArea(10, 10)]
        public string displayDescription;
        
        [SerializeReference]
        [RequiredListLength(MinLength = 1)]
        public List<BasicEffect> effects = new();
        
        // CHANCE
        [Title("Chance")]
        [MinValue(0)]
        public float weight = 1f;

        // LIMIT
        [Title("Limit")]
        [OnValueChanged(nameof(OnIsLimitedChanged))]
        public bool isLimited;
        
        [MinValue(1)]
        [EnableIf(nameof(isLimited))]
        public int limit = 9999;

        private void OnIsLimitedChanged() => limit = isLimited ? limit : 9999;
    }
}