using System;
using Intrepid.Core.Themes;
using Intrepid.Localization;
using Intrepid.Utilities;
using Sirenix.OdinInspector;
using UnityEngine;

namespace Intrepid.Gameplay.Themes
{
    [Serializable]
    [CreateAssetMenu(fileName = "Theme", menuName = "GON/Theme/Theme Collection")]
    public class Theme : SOIdentification
    {
        [GroupConfigurations, SerializeField] private LocalizationTag localizationName;
        [GroupConfigurations, SerializeField] private LocalizationTag localizationDescription;
        
        [GroupConfigurations, SerializeField, Range(0, 1)] private float actionBeltAlpha = .5f;
        
        [GroupConfigurations("Palettes"), SerializeField, HideLabel, InlineProperty, PropertySpace] private Palettes palettes;

        [GroupDebug, Button(ButtonSizes.Medium, ButtonStyle.FoldoutButton)]
        private void ApplyPalette(string main)
        {
            Palettes.Bundle.TryApplyPalette(main);
        }
        
        public LocalizationTag LocalizationName => localizationName;
        public LocalizationTag LocalizationDescription => localizationDescription;
        public Color[] Summary => Palettes.Bundle.Summary;
        public Palettes Palettes => palettes;
        public UIActionBeltTheme ActionBeltTheme => new(Palettes, actionBeltAlpha);
        public DiegeticThemes DiegeticThemes => new(Palettes);
        public PDAThemes PDAThemes => new(Palettes);
    }
}