local addonName, ns = ...

-- Compat shim: C_SpellBook.PlayerHasSpell (11.1.0+) replaces deprecated IsPlayerSpell.
ns.IsPlayerSpell = (C_SpellBook and C_SpellBook.PlayerHasSpell)
    or IsPlayerSpell
    or (C_SpellBook and C_SpellBook.IsSpellKnown)
    or function() return false end

if not ns then
    print("|cffff0000BrightQoL Error:|r Namespace failed to load. Init aborted.")
    return
end

local ADDON_PREFIX = "|cffa855f7Bright|r|cff00cfff QoL|r"

function ns:Log(message, color)
    color = color or "ffffff"
    print(ADDON_PREFIX .. " " .. "|cff" .. color .. message .. "|r")
end

function ns:LogSuccess(message) ns:Log(message, "00ff00") end
function ns:LogError(message)   ns:Log(message, "ff0000") end

-- ---------------------------------------------------------------------------
-- ns.Theme
-- ---------------------------------------------------------------------------
local BRIGHT_FALLBACK = "Interface\\AddOns\\BrightQoL\\Assets\\Fonts\\Bright.ttf"
local CYAN_R, CYAN_G, CYAN_B = 0, 207/255, 1.0

ns.Theme = {}

function ns.Theme.GetAccent()
    local gen = BrightQoL and BrightQoL.general
    if gen then
        return gen.accentR or CYAN_R, gen.accentG or CYAN_G, gen.accentB or CYAN_B
    end
    return CYAN_R, CYAN_G, CYAN_B
end

function ns.Theme.GetFont()
    local gen = BrightQoL and BrightQoL.general
    if gen and gen.font then return gen.font end
    return BRIGHT_FALLBACK
end
