if select(2, ...).IS_LEGACY_CLIENT then return end -- HET-LEGACY-1207: no-op once Legacy1207 is deleted
-------------------------------------------------------------------------------
-- TimeSpiral.lua
-- Multi-spell tracker group fed by SpellData_Buffs.lua: every spell tagged
-- "Time Spiral" in the curated table appears in this group's buff list.
-- perClass: the per-class Time Spiral IDs all share the name
-- "Time Spiral", so each gets its OWN row labeled
-- "Time Spiral (Class)" with the class name in class color (owner
-- request — was one merged checkbox pre-v5; Core migrates a stored
-- uncheck of the merged key to every per-class key). SpellData is the
-- single source of truth — add/remove spells THERE.
-- No bundled voice clips (hasVoiceClips false).
-------------------------------------------------------------------------------
local addonName, ns = ...

local SPELLS = ns.SpellData.BuildSpellList("Time Spiral", nil, { perClass = true })

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("timespiral", {
    dbPrefix      = "ts_",
    displaySpell  = 375234, -- Time Spiral icon for previews/tree
    buffSpellIDs  = allIDs,
    spellList     = SPELLS,
    -- Only one Time Spiral buff is ever on the player at a time, so the
    -- display is singular — Tracker Type labels stay Icon/Bar.
    singleActive  = true,
    hasVoiceClips = false,
    -- Group-level voice callout: when a Sound element's type is "Voice",
    -- the user picks ONE of these clips (Media\Voice_<value>.ogg) and it
    -- plays on every tracked Time Spiral ID. (Unlike External Defensives'
    -- per-spell name clips, this group offers a choice of callout.)
    voiceOptions  = {
        { value = "TimeSpiral",   name = "Time Spiral" },
        { value = "FreeMovement", name = "Free Movement" },
    },
    frameSuffix   = "TimeSpiral",
    label         = "Time Spiral",
    defaultPos    = { "CENTER", "CENTER", 0, 0 },

    -- 12.1 preset (see Innervate for the sparse-table rationale).
    -- Circle #D9984C @ 85%; sound defaults to the "Free Movement" clip.
    preset = {
        { style = "circle", circleRadius = 60, ringTexture = "Ring_20px",
          color = { 0.850980, 0.596078, 0.298039, 0.85 } },
        { style = "sound", soundType = "voice", soundChannel = "Master",
          voiceChoice = "FreeMovement" },
    },

    defaults = {
        enabled        = true,
        barCircleColor = { 0.6, 0.4, 0.85, 1.0 },
        spells         = defaultSpells,
    },
})
