local addonName, SinsToolkit = ...

local frame = CreateFrame("Frame")
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("PLAYER_LOGIN")

function IsRetail()
    return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
end

function IsClassic()
    return WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
end

function IsBCC()
    return WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC
end

function IsMop()
    return WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC
end

local function EnsureQuickLinkDB()
    if SinsToolkit.EnsureDB then SinsToolkit.EnsureDB() end
    SinsToolkitWowheadQuickLinkCfg = SinsToolkitDB.wowheadQuickLink
end

frame:SetScript("OnEvent", function(self, event, arg1)
    if event == "ADDON_LOADED" and arg1 == addonName then
        EnsureQuickLinkDB()
    elseif event == "PLAYER_LOGIN" then
        EnsureQuickLinkDB()
        self:UnregisterEvent("PLAYER_LOGIN")
    end
end)

BINDING_HEADER_SINS_TOOLKIT_WOWHEAD_QUICK_LINK_HEADER = "Sin's Toolkit: QOL"
BINDING_NAME_SINS_TOOLKIT_WOWHEAD_QUICK_LINK_NAME = "Generate Wowhead link"
BINDING_NAME_SINS_TOOLKIT_WOWHEAD_QUICK_LINK_RAIDERIO_NAME = "Generate Raider.IO link"
