local addonName, TC = ...
TC.Options = {}

function TC.Options:Initialize()
    local options = {
        name = "TownCrier HowTo",
        handler = TownCrier,
        type = "group",
        args = {
            desc1 = {
                order = 1,
                type = "description",
                name = "|cFFFFD1001. The Command Center|r\nOpen the main window by typing /tc or clicking the minimap icon. This is your main hub for running events and broadcasting to the guild.\n",
                fontSize = "medium",
            },
            desc2 = {
                order = 2,
                type = "description",
                name = "|cFFFFD1002. Running Trivia|r\nGo to the Trivia tab and click 'Start Trivia Round'. The addon will announce a question. It will automatically listen to your selected channel (Guild, Party, or Say). When someone types the correct answer, they are automatically announced as the winner and added to the Purse.\n",
                fontSize = "medium",
            },
            desc3 = {
                order = 3,
                type = "description",
                name = "|cFFFFD1003. Managing the Purse|r\nThe Purse tab acts as a ledger. It automatically tracks how much gold you owe the trivia winners. You can adjust the Base Reward slider on the Purse tab. (Bonus: Every 5th win in a row grants a 5x multiplier!). Click 'Clear Purse Data' after you have mailed out the gold.\n",
                fontSize = "medium",
            },
            desc4 = {
                order = 4,
                type = "description",
                name = "|cFFFFD1004. Auto-Broadcaster|r\nThe Proclamations tab runs on a background timer. It will rotate through your saved messages and send them out automatically. You can edit the messages directly inside the tab, change how often they send, or pause the timer entirely.\n",
                fontSize = "medium",
            },
            desc5 = {
                order = 5,
                type = "description",
                name = "|cFFFFD1005. The Ledger|r\nThe Ledger tab acts as your live event log. Every broadcast, trivia question, hint, and winner is recorded here with a timestamp so you can review exactly what happened during your event.\n",
                fontSize = "medium",
            },
            desc6 = {
                order = 6,
                type = "description",
                name = "|cFFFFD1006. Auto-Welcome|r\nLocated at the bottom of the Proclamations tab, this feature allows the addon to automatically greet new members the moment they join the guild. You can set a custom welcome message and toggle it on or off as needed.\n",
                fontSize = "medium",
            },
            minimap = {
                order = 7,
                type = "toggle",
                name = "Show Minimap Button",
                desc = "Toggle the minimap icon on or off.",
                get = function() return not TC.db.profile.minimap.hide end,
                set = function(_, val)
                    TC.db.profile.minimap.hide = not val
                    if val then
                        TC.Minimap.icon:Show("TownCrier")
                    else
                        TC.Minimap.icon:Hide("TownCrier")
                    end
                end,
            },
            spacer = {
                order = 8,
                type = "header",
                name = "",
            },
            -- This empty description acts as an invisible "spacer" to push the image to the center!
            paddingLeft = {
                order = 9,
                type = "description",
                name = " ",
                width = 0.45, 
            },
            -- THE CENTERED LOGO
            logoImage = {
                order = 10,
                type = "description",
                name = " ",
                image = "Interface\\AddOns\\TownCrier\\Media\\logo.tga", 
                imageWidth = 350,
                imageHeight = 350,
                width = 2,
            },
        },
    }

    LibStub("AceConfig-3.0"):RegisterOptionsTable("TownCrier", options)
    TC.Options.category = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TownCrier", "TownCrier")
    
    -- FORCE THE WINDOW TO BE TALL ENOUGH SO THE LOGO DOES NOT GET CUT OFF
    LibStub("AceConfigDialog-3.0"):SetDefaultSize("TownCrier", 550, 880)
end