-- Shared namespace + session-only state used before the main addon file runs.
local MythicMateNS = _G.MythicMate or {}
_G.MythicMate = MythicMateNS
MythicMateNS.State = MythicMateNS.State or {}
MythicMateNS.State._luaErrorLogs = MythicMateNS.State._luaErrorLogs or {}
MythicMateNS.State._logsEnabled = MythicMateNS.State._logsEnabled or false

-- One-time SavedVariables migration from the addon's old name (WhatLockout → MythicMate).
-- This file loads first, so this ADDON_LOADED handler runs before any other handler touches
-- MythicMateDB — the old data is adopted wholesale and nobody loses their settings. The old
-- WhatLockoutDB name stays listed in the .toc so it keeps loading for anyone upgrading.
local mig = CreateFrame("Frame")
mig:RegisterEvent("ADDON_LOADED")
mig:SetScript("OnEvent", function(self, _, addonName)
    if addonName ~= "MythicMate" then return end
    self:UnregisterEvent("ADDON_LOADED")
    if _G.MythicMateDB == nil and type(_G.WhatLockoutDB) == "table" then
        _G.MythicMateDB = _G.WhatLockoutDB
    end
end)
