--[[
Author: Jarth
Filename: CBs_Constants.lua
]] --

-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
CollectionBars = {
    WM = GetWindowManager(),
    Addon = {
        Name = "CollectionBars",
        DisplayName = "Collection Bars",
        Abbreviation = "CBs",
        Version = 1.0,
        MinorVersion = 0.2,
        Command = "/cb",
        Author = "Jarth",
        Website = ""
    },
    Buttons = {},
    Default = {
        BarDepth = 5,
        BarWidth = 0,
        ButtonXY = ZO_GAMEPAD_ACTION_BUTTON_SIZE,
        UseAccountSettings = true,
        ShowBarOnHud = true,
        ShowBarOnHudUI = true,
        ShowBarInMenu = true,
        ShowBarInInventory = false,
        ShowBarInInteract = false,
        ShowBarInBank = false,
        ShowBarInFence = false,
        ShowBarInStore = false,
        SnapSize = 5,
        ShowBinding = true,
        Bindings = {[1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 0, [8] = 0, [9] = 0, [10] = 0},
        IsAudioEnabled = true,
        IsActiveActivationEnabled = true,
        Combine = {
            BarDepth = 0,
            BarWidth = 0,
            X = CENTER,
            Y = CENTER,
            AnchorXY = TOPLEFT,
            Display = "CombineBar",
            Label = {
                OffsetX = 0,
                OffsetY = 0,
                Position = BOTTOMLEFT,
                PositionTarget = TOPLEFT
            }
        }
    },
    Global = {
        HideAllId = "CBs_HideAll",
        SettingsSlash = "/cb_settings",
        EnableSettings = false,
        IsMoveEnabled = false,
        ReverseBindings = {},
        SettingsFrame = nil,
        SettingsList = nil,
        Combine = {
            Name = "Combine",
            EventTS = nil,
            MoveFrame = nil,
            Frame = nil,
            HideAll = nil,
            Fragment = nil,
            IsEmpty = false
        },
        ChoiceLocations = {
            "top",
            "topright",
            "right",
            "bottomright",
            "bottom",
            "bottomleft",
            "left",
            "topleft",
            "center"
        },
        ChoiceCornerLocations = {
            "topleft",
            "topright",
            "bottomright",
            "bottomleft"
        },
        ChoiceSideLocations = {
            "top",
            "right",
            "bottom",
            "left"
        },
        AvailableFonts = {
            "ZoFontGameSmall",
            "ZoFontGameLarge",
            "ZoFontGameLargeBold",
            "ZoFontGameLargeBoldShadow",
            "ZoFontHeader",
            "ZoFontHeader2",
            "ZoFontHeader3",
            "ZoFontHeader4"
        },
        ScenePairs = {
            ShowBarOnHud = HUD_SCENE,
            ShowBarOnHudUI = HUD_UI_SCENE,
            ShowBarInMenu = SCENE_MANAGER:GetScene("gameMenuInGame"),
            ShowBarInInventory = SCENE_MANAGER:GetScene("inventory"),
            ShowBarInInteract = SCENE_MANAGER:GetScene("interact"),
            ShowBarInBank = SCENE_MANAGER:GetScene("bank"),
            ShowBarInFence = SCENE_MANAGER:GetScene("fence_keyboard"),
            ShowBarInStore = SCENE_MANAGER:GetScene("store")
        },
        HighestUnlocked = 0
    },
    Type = {},
    TypeOrdered = {}
}

-------------------------------------------------------------------------------------------------
-- FUNCTIONS --
-------------------------------------------------------------------------------------------------

function CollectionBars.GenerateCollectionTypes()
    local setupElements = {
        [1] = {Name = "Assistants", Display = "Assistants", TypeId = COLLECTIBLE_CATEGORY_TYPE_ASSISTANT},
        [2] = {Name = "Mementos", Display = "Mementos", TypeId = COLLECTIBLE_CATEGORY_TYPE_MEMENTO},
        [3] = {Name = "Mounts", Display = "Mounts", TypeId = COLLECTIBLE_CATEGORY_TYPE_MOUNT},
        [4] = {Name = "Vanity_Pets", Display = "Non-Combat Pets", TypeId = COLLECTIBLE_CATEGORY_TYPE_VANITY_PET},
        [5] = {Name = "Ability_Skins", Display = "Special", TypeId = COLLECTIBLE_CATEGORY_TYPE_ABILITY_SKIN},
        [6] = {Name = "Hats", Display = "Hats", TypeId = COLLECTIBLE_CATEGORY_TYPE_HAT},
        [7] = {Name = "Head_Markings", Display = "Head Markings", TypeId = COLLECTIBLE_CATEGORY_TYPE_HEAD_MARKING},
        [8] = {Name = "Facial_Accessories", Display = "Major Adornments", TypeId = COLLECTIBLE_CATEGORY_TYPE_FACIAL_ACCESSORY},
        [9] = {Name = "Costumes", Display = "Costumes", TypeId = COLLECTIBLE_CATEGORY_TYPE_COSTUME},
        [10] = {Name = "Body_Markings", Display = "Body Markings", TypeId = COLLECTIBLE_CATEGORY_TYPE_BODY_MARKING},
        [11] = {Name = "Skins", Display = "Skins", TypeId = COLLECTIBLE_CATEGORY_TYPE_SKIN},
        [12] = {Name = "Personalities", Display = "Personalities", TypeId = COLLECTIBLE_CATEGORY_TYPE_PERSONALITY},
        [13] = {Name = "Polymorph", Display = "Polymorphs", TypeId = COLLECTIBLE_CATEGORY_TYPE_POLYMORPH},
        [14] = {Name = "Emotes", Display = "Emotes", TypeId = COLLECTIBLE_CATEGORY_TYPE_EMOTE},
        [15] = {Name = "Hairs", Display = "Hairs", TypeId = COLLECTIBLE_CATEGORY_TYPE_HAIR},
        [16] = {Name = "Facial_Hair_Horns", Display = "Facial_Hair_Horns", TypeId = COLLECTIBLE_CATEGORY_TYPE_FACIAL_HAIR_HORNS},
        [17] = {Name = "Piercing_Jewelry", Display = "Piercing_Jewelry", TypeId = COLLECTIBLE_CATEGORY_TYPE_PIERCING_JEWELRY}
    }

    CollectionBars.Type = {}
    local collectionIndex = 1
    for _, setupElement in ipairs(setupElements) do
        local isUsable = IsCollectibleCategoryUsable(setupElement.TypeId)
        if isUsable then
            CollectionBars.Type[setupElement.Name] = {
                Collection = {},
                OrderedCollection = {},
                TypeId = setupElement.TypeId,
                Unlocked = 0,
                Name = setupElement.Name,
                Total = 0,
                IsUsable = 0,
                FrameLabel = nil,
                FrameLabelButton = nil,
                FrameToggleSettings = nil,
                MoveFrame = nil,
                Frame = nil,
                Count = nil,
                BarDepth = 0,
                BarWidth = nil,
                Cooldown = {
                    Event = "Cooldown" .. setupElement.Name,
                    CollectibleId = nil,
                    StartTime = nil,
                    Tick = 100
                },
                Fragment = nil
            }
            CollectionBars.TypeOrdered[collectionIndex] = CollectionBars.Type[setupElement.Name]
            collectionIndex = collectionIndex + 1

            CollectionBars.Default[setupElement.Name] = {
                Selected = {},
                Enabled = false,
                HideAll = true,
                HideAllEnabled = true,
                MenuShowDisabled = false,
                Tooltip = {
                    Show = true,
                    Position = TOP
                },
                Horizontal = true,
                BarDepth = 0,
                BarWidth = 0,
                X = CENTER,
                Y = CENTER,
                AnchorXY = TOPLEFT,
                Display = setupElement.Display,
                LabelShow = true,
                Label = {
                    OffsetX = 0,
                    OffsetY = 0,
                    Height = 19,
                    Width = 75,
                    Font = "ZoFontGameSmall",
                    Position = BOTTOMLEFT,
                    PositionTarget = TOPLEFT
                },
                Combine = true
            }
        end
    end
end