using Dalamud.Bindings.ImGui;
using HSUI.Config;
using HSUI.Config.Attributes;
using HSUI.Enums;
using System.Numerics;

namespace HSUI.Interface.GeneralElements
{
    [Section("Other Elements")]
    [SubSection("Main Menu", 0)]
    public class MainMenuConfig : AnchorablePluginConfigObject
    {
        [Combo("Layout", new[] { "Horizontal", "Vertical" })]
        [Order(18)]
        public int LayoutDirection = 0; // 0 = horizontal, 1 = vertical

        [DragInt("Icon Size", min = 16, max = 64)]
        [Order(20)]
        public int IconSize = 36;

        [DragInt("Spacing", min = 0, max = 24)]
        [Order(21)]
        public int Spacing = 4;

        [ColorEdit4("Background Color")]
        [Order(30)]
        public PluginConfigColor BackgroundColor = new(new Vector4(0f, 0f, 0f, 0.6f));

        [ColorEdit4("Icon Tint")]
        [Order(31)]
        public PluginConfigColor IconTint = new(new Vector4(1f, 1f, 1f, 1f));

        [ColorEdit4("Hover Tint")]
        [Order(32)]
        public PluginConfigColor HoverTint = new(new Vector4(1f, 1f, 1f, 1f));

        [Checkbox("Show Labels")]
        [Order(35)]
        public bool ShowLabels = false;

        [NestedConfig("Visibility", 70)]
        public VisibilityConfig VisibilityConfig = new();

        public MainMenuConfig()
        {
            // Width fits 7 icons (36px) + 6 gaps (4px) + 8 margin = 284
            Size = new Vector2(284, 48);
        }

        public new static MainMenuConfig DefaultConfig()
        {
            var viewport = ImGui.GetMainViewport().Size;
            return new MainMenuConfig
            {
                Position = new Vector2(0, viewport.Y * 0.5f - 24),
                Size = new Vector2(284, 48),
                Anchor = DrawAnchor.Bottom
            };
        }
    }
}
