if select(2, ...).IS_LEGACY_CLIENT then return end -- HET-LEGACY-1207: no-op once Legacy1207 is deleted
-------------------------------------------------------------------------------
-- PersonalDefensives.lua
-- Multi-spell tracker group fed by SpellData_Buffs.lua: every spell tagged
-- "Personal Defensive" in the curated table appears in this group's
-- Defensive List (same-named IDs merge into one checkbox). SpellData is
-- the single source of truth — add/remove spells THERE.
-- No PER-SPELL voice clips (hasVoiceClips false), but the group does offer
-- two FIXED voice callouts via voiceOptions — see below.
-------------------------------------------------------------------------------
local addonName, ns = ...

local SPELLS = ns.SpellData.BuildSpellList("Personal Defensive", nil)

local allIDs = {}
local defaultSpells = {}
for _, sp in ipairs(SPELLS) do
    defaultSpells[sp.key] = true
    for _, id in ipairs(sp.ids) do
        allIDs[#allIDs + 1] = id
    end
end

ns.RegisterTracker("persdef", {
    dbPrefix      = "pd_",
    displaySpell  = 22812, -- Barkskin icon for previews/tree
    buffSpellIDs  = allIDs,
    spellList     = SPELLS,
    hasVoiceClips = false,
    -- Voice-clip choices (Sound element, Voice mode). No per-spell name
    -- clips are bundled for this group, so both entries are FIXED clips
    -- (Media\Voice_Personal.ogg / Voice_Defensive.ogg) played on every
    -- tracked ID. First entry is the default (cfg.voiceDefault).
    voiceOptions  = {
        { value = "Personal",  name = "Personal"  },
        { value = "Defensive", name = "Defensive" },
    },
    frameSuffix   = "PersonalDefensives",
    label         = "Personal Defensives",
    defaultPos    = { "CENTER", "CENTER", 0, 0 },

    -- 12.1 preset (see Innervate for the sparse-table rationale). Groups
    -- default to an Icon(s) tracker with NO stacks text. Seeded on first
    -- enable.
    preset = {
        { style = "icon", iconShowStackText = false },
    },

    defaults = {
        enabled        = false,
        barCircleColor = { 0.9, 0.6, 0.2, 1.0 },
        spells         = defaultSpells,
    },
})
