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

local addon = Private.Addon

function addon:OnEnable(...)
    if not _G.MetaTracker_FarewellToArmsDB then
        _G.MetaTracker_FarewellToArmsDB = {}
    end
    self.DB = _G.MetaTracker_FarewellToArmsDB
    Private.Settings:Initialize(self.DB) -- merges defaults (minimap, hud, ...) without clobbering

    Private.MinimapButton:Initialize()
    Private.Commands:InitCommands()
    Private.UI:CreateUI()
    Private.NearbyHud:Initialize()
    Private.RouteHud:Initialize()
    Private.RareAlerts:Initialize()
    Private.RareAlerts:Refresh()
    Private.Comm:Initialize()

    Private.Events:InitEvents()

    -- One-time "what's new" popup + a single Do-it-now planner preview. Delayed so it
    -- fires after the loading screen; shows once (keyed in SavedVariables), never spams.
    if C_Timer and C_Timer.After then
        C_Timer.After(5, function() if Private.WhatsNew then Private.WhatsNew:Maybe() end end)
    elseif Private.WhatsNew then
        Private.WhatsNew:Maybe()
    end
end

Private.ExpansionUtil:InitLibStub()