---@class AddonPrivate
local Private = select(2, ...)

---@class MinimapButton
local minimapButton = {
    ---@class MinimapIcon : table, LibDBIcon-1.0
    icon = {},
}
Private.MinimapButton = minimapButton

local const = Private.constants

function minimapButton:Initialize()
    local addon = Private.Addon
    local ldb = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject(const.ADDON_NAME, {
        type = "launcher",
        text = const.ADDON_NAME,
        icon = const.ADDON_LOGO,
        OnClick = function(_, button)
            if button == "LeftButton" then
                Private.UI:ToggleUI()
            elseif button == "RightButton" then
                print("Right-click menu coming soon!")
            end
        end,
        OnTooltipShow = function(tooltip)
            tooltip:AddLine("Meta Achievement Tracker")
            tooltip:AddLine("|cff00ff00Left-Click|r to toggle the tracker.")
            tooltip:AddLine("|cff00ff00Right-Click|r for options.")
        end,
    })

    ---@class MinimapIcon : table, LibDBIcon-1.0
    local icon = LibStub("LibDBIcon-1.0")
    icon:Register(Private.constants.ADDON_NAME, ldb, addon.DB.minimap)
    self.icon = icon
end

function minimapButton:GetIcon()
    return self.icon
end