-- Models/Basic/Basic_Buzzer.lua

Buzzer_Models = Buzzer_Models or {}

Buzzer_Models[1] = {
    name = "Chattertech",
    description = "A basic radio model with 10 channels.",
    author = "Chattertech",
    version = "X-1",
    maxChannels = 10,
    encryption = false,
    sendOverGuild = false,
    breakChance = 10,
    eventChance = 10,
    width = 512,
    height = 512,
    background = "Interface\\AddOns\\Buzzer\\Models\\Basic\\Basic_Buzzer.blp",

    buttons = {
        Common.CreateMuteButton{
            modelKey = 1,
            x = 188,
            y = -329,
            size = 44,
            tooltip = "Mute/Unmute",
            soundOn = "Interface\\AddOns\\Buzzer\\Media\\bw_on_1.ogg",
            soundOff = "Interface\\AddOns\\Buzzer\\Media\\off.ogg",
            textures = {
                muted = "Interface\\AddOns\\Buzzer\\Media\\Off.blp",
                unmuted = "Interface\\AddOns\\Buzzer\\Media\\On.blp",
                highlight = "Interface\\AddOns\\Buzzer\\Media\\Hover.blp"
            }
        },
        Common.CreateOptionsButton{
            txt = "?", 
            txtCol = {1, 0.82, 0},
            tooltip = "Options",
            x = 297, 
            y = -178,
            onClick = function()
                if not BuzzerOptionsCategory then
                    Buzzer_InitializeOptions()
                end
            
                if BuzzerOptionsCategory then
                    if not SettingsPanel:IsShown() then
                        ShowUIPanel(SettingsPanel)
                    end
            
                    -- Use two-frame delay to make sure settings UI is ready
                    C_Timer.After(0, function()
                        if Settings and Settings.OpenToCategory and BuzzerOptionsCategoryName then
                            C_Timer.After(0, function()
                                Settings.OpenToCategory(BuzzerOptionsCategoryName)
                            end)
                        end
                    end)
                else
                    print("Buzzer: Options panel could not be loaded.")
                end
            end
            
            
        },
        Common.CreateOptionsButton{
            txt = "X", 
            txtCol = {1, 0.82, 0},
            tooltip = "Close",
            x = 317,
            y = -178,
            onClick = function()
                BuzzerMainFrame:Hide()
            end
        },

    

        -- Top Row 1-5
        Common.CreateChannelButton(1, {x = 187, y = -378}),
        Common.CreateChannelButton(2, {x = 217, y = -378}),
        Common.CreateChannelButton(3, {x = 246, y = -378}),
        Common.CreateChannelButton(4, {x = 275, y = -378}),
        Common.CreateChannelButton(5, {x = 303, y = -378}),

        -- Bottom Row 6-10
        Common.CreateChannelButton(6, {x = 188, y = -404}),
        Common.CreateChannelButton(7, {x = 217, y = -404}),
        Common.CreateChannelButton(8, {x = 246, y = -404}),
        Common.CreateChannelButton(9, {x = 275, y = -404}),
        Common.CreateChannelButton(10, {x = 302, y = -404}),
    },
    -- Renamed to 'dragAreas' and now contains multiple draggable zones
    dragAreas = {
        -- Top bar
        { x = 150, y = -200, width = 220, height = 120 },
        -- Right side panel (avoiding the close button)
        { x = 240, y = -280, width = 100, height = 100 }
    }
}