local addonName, ns = ...

-- Addon namespace
ns.addonName = addonName
ns.version = "1.0.0"

-- Localization table (will be filled by locale files)
ns.L = ns.L or {}

-- Create saved variables table if it doesn't exist
nCastbarDB = nCastbarDB or {}

-- Helper functions
ns.Print = function(msg)
    print("|cff1784d1nCastbar:|r " .. tostring(msg))
end

ns.Debug = function(...)
    if not nCastbarDB.debug then return end
    local msg = strjoin(" ", "|cffff9900[DEBUG]|r", tostringall(...))
    print("|cff1784d1nCastbar:|r " .. msg)
end

ns.Error = function(msg)
    print("|cff1784d1nCastbar:|r " .. ns.L["ERROR_PREFIX"] .. " " .. tostring(msg))
end

-- Helper to check if we're in combat
ns.InCombat = function()
    if InCombatLockdown() then
        ns.Error(ns.L["COMBAT_LOCKDOWN"])
        return true
    end
    return false
end

-- Helper for multiple unit checks
ns.MultiCheck = function(unit, ...)
    for i = 1, select("#", ...) do
        if unit == select(i, ...) then
            return true
        end
    end
    return false
end

-- Color conversion helper
ns.RGBToHex = function(r, g, b)
    return string.format("|cff%02x%02x%02x", r * 255, g * 255, b * 255)
end

ns.Debug("Init.lua loaded")
