using System;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using VOID.Generic.Objects.Item;

namespace VOID.Generic.DropTable
{
    [Serializable]
    public class DropTableGroup
    {
        [AssetsOnly]
        [RequiredListLength(MinLength = 1)]
        public List<ItemObject> items = new();
        
        [MinValue(0)]
        public float weight = 1;
        
        [HorizontalGroup]
        [OnValueChanged(nameof(OnIsLimitedChanged))]
        public bool isLimited;
        
        [HorizontalGroup]
        [HideLabel]
        [EnableIf(nameof(isLimited))]
        [MinValue(1)]
        public int limit = 1;

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