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

namespace VOID.Generic.Status.Effect
{
    [TypeRegistryItem("Change Main Attribute - Amount")]
    public class PointChangeMainAttributeEffect : BasicEffect
    {
        public int pointModificator => _pointModificator;
        public MainAttributeType mainAttributeType => _mainAttributeType;
        [SerializeField, Required] private int _pointModificator;
        [SerializeField, Required] private MainAttributeType _mainAttributeType;
        
        public override void OnApply()
        {
            if (forObject is not UnitObject forUnit) return;

            forUnit.unitDataCalculator.Queue(_mainAttributeType);
        }

        public override void OnEnd()
        {
            if (forObject is not UnitObject forUnit) return;

            forUnit.unitDataCalculator.Queue(_mainAttributeType);
        }

        public override void OnTurnSelfEnd() {}
        public override void OnTurnSelfStart() {}
        public override void OnCancel() => OnEnd();

        public override string GetSimpleDescription() => $"{(_pointModificator >= 0f ? "+" : "-")}{Mathf.Abs(_pointModificator)} {_mainAttributeType}";
    }
}