-------------------------
-- AiB Co-Tank | Spells
-- Nur Raid- und Boss-Struktur – keine hardcodierten Spells
-- Reihenfolge entspricht dem AiB-Addon
-------------------------

local ns = AiB.CoTank.ns

ns.SpellData = {
    raids = {
        {
            name = "The Voidspire",
            bosses = {
                {name = "Imperator Averzian"},
                {name = "Vorasius"},
                {name = "Fallen-King Salhadaar"},
                {name = "Vaelgor & Ezzorak"},
                {name = "Lightblinded Vanguard"},
                {name = "Crown of the Cosmos"},
            },
        },
        {
            name = "The Dreamrift",
            bosses = {
                {name = "Chimaerus, the Undreamt God"},
            },
        },
        {
            name = "March on Quel'Danas",
            bosses = {
                {name = "Belo'ren, Child of Al'ar"},
                {name = "Midnight Falls"},
            },
        },
    },
}

-- Alle Bosse als flache Liste (fuer Dropdowns)
function ns.SpellData.GetAllBosses()
    local list = {}
    for _, raid in ipairs(ns.SpellData.raids) do
        for _, boss in ipairs(raid.bosses) do
            table.insert(list, {id = boss.name, label = boss.name, raid = raid.name})
        end
    end
    table.insert(list, {id = "general", label = "General / Other", raid = ""})
    return list
end

-- Migration: alte hardcodierte Presets entfernen
function ns.SpellData.CleanupPresets(db)
    if not db.spellAlerts then return end
    for sid, sa in pairs(db.spellAlerts) do
        if sa.preset and not sa.custom then
            db.spellAlerts[sid] = nil
        end
    end
end

-- No-op fuer Kompatibilitaet
function ns.SpellData.SeedDefaults(db) end
