-- logic/init.lua
--[[--------------------------------------------------------------------
  PaladinHolyPower - logic/init.lua
  Canonical global; no compatibility alias, no migration.
----------------------------------------------------------------------]]

local ADDON_NAME = ...

-- Canonical addon table (only this global!)
local PHP = _G.PaladinHolyPower or {}
_G.PaladinHolyPower = PHP

-- Lightweight fields
PHP.name       = "PaladinHolyPower"
PHP.ADDON_NAME = PHP.ADDON_NAME or ADDON_NAME
PHP.MEDIA      = PHP.MEDIA or ("Interface\\AddOns\\" .. (ADDON_NAME or "PaladinHolyPower") .. "\\media\\")
PHP.fonts      = PHP.fonts or {}

-- Runtime counters
PHP.waste         = PHP.waste or 0
PHP.lastWasteTime = PHP.lastWasteTime or 0

-- Only load gameplay features for Paladins who actually use Holy Power
local class = select(2, UnitClass("player"))
if class ~= "PALADIN" then return end

local HOLY_POWER_ID = (Enum and Enum.PowerType and Enum.PowerType.HolyPower) or 9
if UnitPowerMax("player", HOLY_POWER_ID) == 0 then return end

return PHP