--[[--------------------------------------------------------------------------
	Boom - Modern Healing & Support Raid Frames
	Data/SpellDB.lua

	GENERATED FILE - do not hand edit; regenerate from the research data instead.

	Every friendly-target spell Boom knows about, per specialization, for patch
	12.0.7 (Midnight). This is what makes the one-click setup possible: Boom
	reads your spec, filters this table by what you have actually learned, and
	lays the result onto your mouse.

	Every spell ID below was checked against SpellName.db2 exported from live
	build 12.0.7.68974: all 422 entries matched their expected name exactly.
	Cooldown values come from SpellCooldowns.db2 of the same build.

	Robustness contract: a wrong ID here can never break the addon. Presets skip
	any spell whose name the client cannot resolve, click-casting falls back to
	casting by ID, and "/boom spells" reports everything that failed to resolve.

	Fields per entry:
	  id        spell ID
	  cat       category (see Boom.Presets for how each is used)
	  prio      1 = most important for this spec
	  ground    true when it needs a ground reticle - bound through an @mouseover macro
	  bind      false when the spell is not castable on a friendly unit frame
	            (self-cast buffs like Ebon Might, offensive purges, damage)
	  dispel    for dispels: which debuff types it removes
----------------------------------------------------------------------------]]

local ADDON_NAME, Boom = ...

local SpellDB = Boom:NewModule("SpellDB")

local Util = Boom.Util
local ipairs, pairs = ipairs, pairs

--------------------------------------------------------------------------------
-- Per-specialization spell lists
--------------------------------------------------------------------------------

SpellDB.specs = {
	-- Arcane (MAGE / DAMAGER)
	[62] = {
		class = "MAGE", role = "DAMAGER", name = "Arcane",
		rangeSpell = 1459,
		spells = {
			{ id = 475, cat = "dispel", prio = 1, dispel = { Curse = true } },  -- Remove Curse: Curse only.
			{ id = 1459, cat = "support_buff", prio = 2 },  -- Arcane Intellect: +3% Intellect, 1 hour.
			{ id = 80353, cat = "raid_cooldown", prio = 3, bind = false },  -- Time Warp: +30% haste raid-wide 40s, 5 min CD; shares the Sated/Exhausted lockout.
			{ id = 30449, cat = "purge_offensive", prio = 3, bind = false },  -- Spellsteal: ENEMY-targeted.
			{ id = 130, cat = "utility", prio = 4 },  -- Slow Fall: 40 yd, cast on a group member.
			{ id = 414664, cat = "utility", prio = 5, bind = false },  -- Mass Invisibility: Talent, 5 min CD.
		},
	},

	-- Fire (MAGE / DAMAGER)
	[63] = {
		class = "MAGE", role = "DAMAGER", name = "Fire",
		rangeSpell = 1459,
		spells = {
			{ id = 475, cat = "dispel", prio = 1, dispel = { Curse = true } },  -- Remove Curse: Curse only, 40 yd, 8s CD.
			{ id = 1459, cat = "support_buff", prio = 2 },  -- Arcane Intellect: +3% Intellect, 1 hour, propagates to the whole party/raid.
			{ id = 80353, cat = "raid_cooldown", prio = 3, bind = false },  -- Time Warp: Raid lust, +30% haste 40s.
			{ id = 30449, cat = "purge_offensive", prio = 3, bind = false },  -- Spellsteal: Enemy-targeted magic steal.
			{ id = 130, cat = "utility", prio = 4 },  -- Slow Fall: Cast on a group member, 40 yd.
			{ id = 414664, cat = "utility", prio = 5, bind = false },  -- Mass Invisibility: Group invisibility, 5 min CD; out-of-combat allies only.
		},
	},

	-- Frost (MAGE / DAMAGER)
	[64] = {
		class = "MAGE", role = "DAMAGER", name = "Frost",
		rangeSpell = 1459,
		spells = {
			{ id = 475, cat = "dispel", prio = 1, dispel = { Curse = true } },  -- Remove Curse: Curse only, 40 yd, 8s CD.
			{ id = 1459, cat = "support_buff", prio = 2 },  -- Arcane Intellect: +3% Intellect, 1 hour, party/raid-wide from one cast.
			{ id = 80353, cat = "raid_cooldown", prio = 3, bind = false },  -- Time Warp: Raid lust, +30% haste 40s.
			{ id = 30449, cat = "purge_offensive", prio = 3, bind = false },  -- Spellsteal: Enemy-targeted magic steal.
			{ id = 130, cat = "utility", prio = 4 },  -- Slow Fall: Cast on a group member, 40 yd.
			{ id = 414664, cat = "utility", prio = 5, bind = false },  -- Mass Invisibility: Group invisibility, 5 min CD.
		},
	},

	-- Holy Paladin (PALADIN / HEALER)
	[65] = {
		class = "PALADIN", role = "HEALER", name = "Holy Paladin",
		rangeSpell = 20473,
		spells = {
			{ id = 20473, cat = "heal_fast", prio = 1 },  -- Holy Shock: Smart: heals a friendly target or damages an enemy.
			{ id = 19750, cat = "heal_fast", prio = 2 },  -- Flash of Light
			{ id = 82326, cat = "heal_efficient", prio = 3 },  -- Holy Light: Spec spell for 65.
			{ id = 85673, cat = "heal_big", prio = 4 },  -- Word of Glory: Holy Power spender.
			{ id = 156322, cat = "heal_hot", prio = 5 },  -- Eternal Flame: Herald of the Sun hero tree; TraitDefinition shows OverridesSpellID=85673, i.e.
			{ id = 85222, cat = "heal_aoe", prio = 6, bind = false },  -- Light of Dawn: Self-centred cone, no unit target.
			{ id = 53563, cat = "support_buff", prio = 7 },  -- Beacon of Light
			{ id = 156910, cat = "support_buff", prio = 8 },  -- Beacon of Faith: Second beacon.
			{ id = 200025, cat = "support_buff", prio = 9 },  -- Beacon of Virtue: TraitDefinition OverridesSpellID=53563, i.e.
			{ id = 1022, cat = "external_defensive", prio = 10 },  -- Blessing of Protection: Physical immunity; causes Forbearance.
			{ id = 6940, cat = "external_defensive", prio = 11 },  -- Blessing of Sacrifice
			{ id = 1044, cat = "external_defensive", prio = 12 },  -- Blessing of Freedom: Movement-impairment immunity - useful as a dispel-style binding.
			{ id = 633, cat = "heal_emergency", prio = 13 },  -- Lay on Hands: 10 min; causes Forbearance.
			{ id = 31821, cat = "raid_cooldown", prio = 14, bind = false },  -- Aura Mastery: Made more impactful in Midnight; effect depends on which aura you have active.
			{ id = 375576, cat = "heal_aoe", prio = 15, bind = false },  -- Divine Toll: Now shares a choice node with Holy Prism.
			{ id = 114165, cat = "heal_aoe", prio = 16 },  -- Holy Prism: Castable on friend or foe; the target determines whether it heals a clump or damages one and ...
			{ id = 31884, cat = "raid_cooldown", prio = 17, bind = false },  -- Avenging Wrath
			{ id = 216331, cat = "raid_cooldown", prio = 18, bind = false },  -- Avenging Crusader: UNSURE.
			{ id = 4987, cat = "dispel", prio = 19, dispel = { Magic = true, Poison = true, Disease = true } },  -- Cleanse: Holy-only (overrides Cleanse Toxins, whose non-Holy ID is now 440013 rather than 213644).
			{ id = 391054, cat = "battle_res", prio = 20 },  -- Intercession: Not present in the 12.0.7 paladin trait tree, so it is baseline.
			{ id = 432459, cat = "shield", prio = 21 },  -- Holy Bulwark: Lightsmith hero tree.
			{ id = 432472, cat = "support_buff", prio = 22 },  -- Sacred Weapon: Lightsmith hero tree.
			{ id = 433568, cat = "support_buff", prio = 23, bind = false },  -- Rite of Sanctification: Lightsmith.
			{ id = 433583, cat = "support_buff", prio = 24, bind = false },  -- Rite of Adjuration: Lightsmith.
			{ id = 7328, cat = "utility", prio = 25 },  -- Redemption: Out-of-combat res.
			{ id = 212056, cat = "utility", prio = 26, bind = false },  -- Absolution: Mass res.
			{ id = 642, cat = "utility", prio = 27, bind = false },  -- Divine Shield: Self only.
			{ id = 498, cat = "utility", prio = 28, bind = false },  -- Divine Protection: Self only.
			{ id = 190784, cat = "utility", prio = 29, bind = false },  -- Divine Steed
			{ id = 275773, cat = "damage", prio = 30, bind = false },  -- Judgment: Holy Paladin's Judgment override (SpecializationSpells 65: 275773 overrides 20271).
			{ id = 24275, cat = "damage", prio = 31, bind = false },  -- Hammer of Wrath
		},
	},

	-- Protection Paladin (PALADIN / TANK)
	[66] = {
		class = "PALADIN", role = "TANK", name = "Protection Paladin",
		rangeSpell = 19750,
		spells = {
			{ id = 1022, cat = "external_defensive", prio = 1 },  -- Blessing of Protection: 40 yd.
			{ id = 6940, cat = "external_defensive", prio = 2 },  -- Blessing of Sacrifice: 40 yd.
			{ id = 1044, cat = "utility", prio = 3 },  -- Blessing of Freedom: 40 yd.
			{ id = 633, cat = "heal_emergency", prio = 4 },  -- Lay on Hands: Heals target for 100% of the paladin's max health.
			{ id = 213644, cat = "dispel", prio = 5, dispel = { Poison = true, Disease = true } },  -- Cleanse Toxins: 40 yd.
			{ id = 85673, cat = "heal_big", prio = 6 },  -- Word of Glory: 40 yd, instant, 3 Holy Power.
			{ id = 391054, cat = "battle_res", prio = 7 },  -- Intercession: Combat resurrection, costs 3 Holy Power.
			{ id = 204018, cat = "external_defensive", prio = 8 },  -- Blessing of Spellwarding: 40 yd.
			{ id = 432459, cat = "shield", prio = 9 },  -- Holy Bulwark: Lightsmith hero talent (Rite of Adjuration).
			{ id = 432472, cat = "support_buff", prio = 10 },  -- Sacred Weapon: Lightsmith hero talent (Rite of Sanctification).
			{ id = 465, cat = "support_buff", prio = 11, bind = false },  -- Devotion Aura: Activated (not passive) self-cast stance; 40 yd area aura, -3% damage taken for the group.
			{ id = 19750, cat = "heal_efficient", prio = 12 },  -- Flash of Light: Still available to Prot as a slow hard-cast off-heal.
			{ id = 31850, cat = "utility", prio = 13, bind = false },  -- Ardent Defender: track-only - PRIMARY Prot Paladin personal defensive (-20% damage, cheat-death).
			{ id = 86659, cat = "utility", prio = 14, bind = false },  -- Guardian of Ancient Kings: track-only - -50% damage taken, 8s.
			{ id = 642, cat = "utility", prio = 15, bind = false },  -- Divine Shield: track-only - full immunity, applies Forbearance (blocks BoP/LoH on that target while up).
		},
	},

	-- Retribution (PALADIN / DAMAGER)
	[70] = {
		class = "PALADIN", role = "DAMAGER", name = "Retribution",
		rangeSpell = 19750,
		spells = {
			{ id = 1022, cat = "external_defensive", prio = 1 },  -- Blessing of Protection: Tooltip explicitly lists Holy AND Retribution AND Protection, so Ret has it.
			{ id = 6940, cat = "external_defensive", prio = 1 },  -- Blessing of Sacrifice: Class-tree talent, 40 yd, 2 min CD.
			{ id = 1044, cat = "external_defensive", prio = 1 },  -- Blessing of Freedom: 40 yd.
			{ id = 633, cat = "heal_emergency", prio = 1 },  -- Lay on Hands: 40 yd, 10 min CD.
			{ id = 213644, cat = "dispel", prio = 2, dispel = { Poison = true, Disease = true } },  -- Cleanse Toxins: Ret/Prot dispel: Poison + Disease only, 40 yd, 8s CD.
			{ id = 391054, cat = "battle_res", prio = 2 },  -- Intercession: Paladin COMBAT resurrection, 2s cast, 40 yd, 10 min CD, costs 3 Holy Power.
			{ id = 19750, cat = "heal_fast", prio = 3 },  -- Flash of Light: Baseline friendly-target heal available to Ret.
			{ id = 7328, cat = "utility", prio = 4 },  -- Redemption: Out-of-combat resurrection, 10s cast.
		},
	},

	-- Arms (WARRIOR / DAMAGER)
	[71] = {
		class = "WARRIOR", role = "DAMAGER", name = "Arms",
		rangeSpell = 3411,
		spells = {
			{ id = 3411, cat = "external_defensive", prio = 1 },  -- Intervene: Friendly-targeted: charge to an ally and intercept all melee/ranged attacks against them for ...
			{ id = 97462, cat = "raid_cooldown", prio = 1, bind = false },  -- Rallying Cry: Class-tree talent, 3 min CD.
		},
	},

	-- Fury (WARRIOR / DAMAGER)
	[72] = {
		class = "WARRIOR", role = "DAMAGER", name = "Fury",
		rangeSpell = 3411,
		spells = {
			{ id = 3411, cat = "external_defensive", prio = 1 },  -- Intervene: Charge to an ally and soak melee/ranged attacks aimed at them for 6s within 10 yds.
			{ id = 97462, cat = "raid_cooldown", prio = 1, bind = false },  -- Rallying Cry: +10% temp and max health to party/raid within 40 yds, 10s, 3 min CD.
		},
	},

	-- Protection Warrior (WARRIOR / TANK)
	[73] = {
		class = "WARRIOR", role = "TANK", name = "Protection Warrior",
		rangeSpell = 3411,
		spells = {
			{ id = 3411, cat = "external_defensive", prio = 1 },  -- Intervene: 25 yd.
			{ id = 97462, cat = "raid_cooldown", prio = 2, bind = false },  -- Rallying Cry: Self-cast, 40 yd radius, party/raid-wide +10% temp & max health for 10s.
			{ id = 6673, cat = "support_buff", prio = 3, bind = false },  -- Battle Shout: Raid-wide +5% Attack Power maintenance buff.
			{ id = 1160, cat = "raid_cooldown", prio = 4, bind = false },  -- Demoralizing Shout: Enemy-facing: reduces enemy damage output ~20% within 15 yd.
			{ id = 871, cat = "utility", prio = 5, bind = false },  -- Shield Wall: track-only - primary personal defensive (-40% damage taken).
			{ id = 12975, cat = "utility", prio = 6, bind = false },  -- Last Stand: track-only - +30% max health personal defensive.
			{ id = 23920, cat = "utility", prio = 7, bind = false },  -- Spell Reflection: track-only - self only in PvE (reflect + 25% magic DR).
		},
	},

	-- Balance (DRUID / DAMAGER)
	[102] = {
		class = "DRUID", role = "DAMAGER", name = "Balance",
		rangeSpell = 8936,
		spells = {
			{ id = 2782, cat = "dispel", prio = 1, dispel = { Curse = true, Poison = true } },  -- Remove Corruption: Non-Resto druid dispel.
			{ id = 20484, cat = "battle_res", prio = 1 },  -- Rebirth: Combat resurrection, 2s cast, 40 yd, 10 min CD.
			{ id = 29166, cat = "support_buff", prio = 1 },  -- Innervate: Cast on a friendly HEALER: free spellcasts for 8s.
			{ id = 106898, cat = "raid_cooldown", prio = 2, bind = false },  -- Stampeding Roar: Self-centered 15 yd, +60% movement speed to all friendly players, 8s.
			{ id = 8936, cat = "heal_fast", prio = 3 },  -- Regrowth: Baseline druid heal, 40 yd, 1.5s cast.
			{ id = 2908, cat = "purge_offensive", prio = 3, bind = false, dispel = { Enrage = true } },  -- Soothe: ENEMY-targeted, not friendly.
			{ id = 325727, cat = "heal_hot", prio = 4 },  -- Adaptive Swarm: Balance/Feral talent.
			{ id = 50769, cat = "utility", prio = 5 },  -- Revive: Out-of-combat resurrection (35% health/mana).
		},
	},

	-- Feral (DRUID / DAMAGER)
	[103] = {
		class = "DRUID", role = "DAMAGER", name = "Feral",
		rangeSpell = 8936,
		spells = {
			{ id = 2782, cat = "dispel", prio = 1, dispel = { Curse = true, Poison = true } },  -- Remove Corruption: Curse + Poison only, no Magic.
			{ id = 20484, cat = "battle_res", prio = 1 },  -- Rebirth: Combat res, 2s cast, 40 yd, 10 min CD, 30 Rage / 2% base mana.
			{ id = 29166, cat = "support_buff", prio = 1 },  -- Innervate: Cast on a friendly healer; you get 50% of the effect via Natural Wisdom.
			{ id = 106898, cat = "raid_cooldown", prio = 2, bind = false },  -- Stampeding Roar: +60% speed to all friendly players within 15 yds for 8s.
			{ id = 8936, cat = "heal_fast", prio = 3 },  -- Regrowth: Baseline heal; Feral must leave Cat Form to cast it.
			{ id = 2908, cat = "purge_offensive", prio = 3, bind = false, dispel = { Enrage = true } },  -- Soothe: Enemy-targeted Enrage removal.
			{ id = 325727, cat = "heal_hot", prio = 4 },  -- Adaptive Swarm: Feral/Balance talent, castable on a friendly to heal and boost your periodic effects.
			{ id = 50769, cat = "utility", prio = 5 },  -- Revive: Out-of-combat resurrection.
		},
	},

	-- Guardian Druid (DRUID / TANK)
	[104] = {
		class = "DRUID", role = "TANK", name = "Guardian Druid",
		rangeSpell = 774,
		spells = {
			{ id = 20484, cat = "battle_res", prio = 1 },  -- Rebirth: Combat resurrection.
			{ id = 2782, cat = "dispel", prio = 2, dispel = { Curse = true, Poison = true } },  -- Remove Corruption: Non-Restoration druid dispel.
			{ id = 106898, cat = "raid_cooldown", prio = 3, bind = false },  -- Stampeding Roar: Self-centered, 15 yd radius, +60% run speed 8s, 2 min CD.
			{ id = 29166, cat = "support_buff", prio = 4 },  -- Innervate: 40 yd.
			{ id = 474750, cat = "support_buff", prio = 5 },  -- Symbiotic Relationship: 40 yd, 1 hour duration, cannot target self (Exclude Caster).
			{ id = 2908, cat = "purge_offensive", prio = 6, bind = false, dispel = { Enrage = true } },  -- Soothe: ENEMY-targeted enrage removal.
			{ id = 774, cat = "heal_hot", prio = 7 },  -- Rejuvenation: UNVERIFIED for Guardian in 12.0.7.
			{ id = 61336, cat = "utility", prio = 8, bind = false },  -- Survival Instincts: track-only - PRIMARY Guardian defensive, -50% damage taken.
			{ id = 22812, cat = "utility", prio = 9, bind = false },  -- Barkskin: track-only - -20% damage taken.
			{ id = 102558, cat = "utility", prio = 10, bind = false },  -- Incarnation: Guardian of Ursoc: track-only - +30% max health, +25% damage, CC immunity, 30s.
			{ id = 22842, cat = "utility", prio = 11, bind = false },  -- Frenzied Regeneration: track-only - self-heal over 3s.
		},
	},

	-- Restoration Druid (DRUID / HEALER)
	[105] = {
		class = "DRUID", role = "HEALER", name = "Restoration Druid",
		rangeSpell = 8936,
		spells = {
			{ id = 774, cat = "heal_hot", prio = 1 },  -- Rejuvenation: Best default left-click.
			{ id = 8936, cat = "heal_fast", prio = 2 },  -- Regrowth: Baseline (not a talent node).
			{ id = 33763, cat = "heal_hot", prio = 3 },  -- Lifebloom: Blooms on expiry/refresh.
			{ id = 18562, cat = "heal_emergency", prio = 4 },  -- Swiftmend
			{ id = 48438, cat = "heal_aoe", prio = 5 },  -- Wild Growth: Targeted smart AoE HoT centred on your friendly target - bind it on the frame, not as a groun...
			{ id = 102342, cat = "external_defensive", prio = 6 },  -- Ironbark
			{ id = 88423, cat = "dispel", prio = 7, dispel = { Magic = true, Curse = true, Poison = true } },  -- Nature's Cure: Resto-only (overrides Remove Corruption, whose non-Resto ID is now 440015 rather than 2782).
			{ id = 145205, cat = "heal_aoe", prio = 8, ground = true, bind = false },  -- Efflorescence: Ground reticle.
			{ id = 740, cat = "raid_cooldown", prio = 9, bind = false },  -- Tranquility: MIDNIGHT CHANGE: Flourish (197721) is now a PASSIVE that procs from Tranquility - there is no...
			{ id = 29166, cat = "support_buff", prio = 10 },  -- Innervate: Cast on another healer.
			{ id = 33891, cat = "raid_cooldown", prio = 11, bind = false },  -- Incarnation: Tree of Life
			{ id = 391528, cat = "raid_cooldown", prio = 12, bind = false },  -- Convoke the Spirits
			{ id = 474750, cat = "support_buff", prio = 13 },  -- Symbiotic Relationship: Cast on an ally to form a healing bond; 474754 is the linked aura.
			{ id = 20484, cat = "battle_res", prio = 14 },  -- Rebirth: Baseline (not in the talent tree).
			{ id = 132158, cat = "utility", prio = 15, bind = false },  -- Nature's Swiftness: Self-buff; makes next Regrowth/Rebirth instant.
			{ id = 1126, cat = "support_buff", prio = 16 },  -- Mark of the Wild
			{ id = 106898, cat = "utility", prio = 17, bind = false },  -- Stampeding Roar
			{ id = 22812, cat = "utility", prio = 18, bind = false },  -- Barkskin: Self only.
			{ id = 2908, cat = "purge_offensive", prio = 19, bind = false, dispel = { Enrage = true } },  -- Soothe
			{ id = 102401, cat = "utility", prio = 20 },  -- Wild Charge: In caster/Moonkin form it flies you to a friendly target, so it is a legitimate friendly-fram...
			{ id = 50769, cat = "utility", prio = 21 },  -- Revive: Out-of-combat res.
			{ id = 212040, cat = "utility", prio = 22, bind = false },  -- Revitalize: Mass res.
			{ id = 102793, cat = "utility", prio = 23, ground = true, bind = false },  -- Ursol's Vortex
			{ id = 93402, cat = "damage", prio = 24, bind = false },  -- Sunfire
			{ id = 8921, cat = "damage", prio = 25, bind = false },  -- Moonfire
			{ id = 197628, cat = "damage", prio = 26, bind = false },  -- Starfire: Resto damage got large buffs in 12.0.5 (Wrath/Starfire/Starsurge +40%).
		},
	},

	-- Blood Death Knight (DEATHKNIGHT / TANK)
	[250] = {
		class = "DEATHKNIGHT", role = "TANK", name = "Blood Death Knight",
		spells = {
			{ id = 51052, cat = "raid_cooldown", prio = 1, ground = true, bind = false },  -- Anti-Magic Zone: 30 yd cast range, 8 yd ground-placed area trigger, 6s, 4 min CD.
			{ id = 61999, cat = "battle_res", prio = 2 },  -- Raise Ally: 40 yd, 30 Runic Power, combat res.
			{ id = 3714, cat = "utility", prio = 3, bind = false },  -- Path of Frost: Self-cast, grants water walking to the group.
			{ id = 48707, cat = "utility", prio = 4, bind = false },  -- Anti-Magic Shell: track-only - self magic absorb ~40% max HP.
			{ id = 55233, cat = "utility", prio = 5, bind = false },  -- Vampiric Blood: track-only - PRIMARY Blood DK defensive for healer awareness: +30% max health AND +30% healin...
			{ id = 48792, cat = "utility", prio = 6, bind = false },  -- Icebound Fortitude: track-only - -30% damage taken, stun immunity, 8s.
			{ id = 49028, cat = "utility", prio = 7, bind = false },  -- Dancing Rune Weapon: track-only - +20% parry while active; both an offensive and defensive window.
			{ id = 48743, cat = "utility", prio = 8, bind = false },  -- Death Pact: track-only - self-heal for 50% max HP but applies a 30% healing ABSORB debuff.
			{ id = 49039, cat = "utility", prio = 9, bind = false },  -- Lichborne: track-only - immune to charm/fear/sleep for 10s.
		},
	},

	-- Frost (DEATHKNIGHT / DAMAGER)
	[251] = {
		class = "DEATHKNIGHT", role = "DAMAGER", name = "Frost",
		spells = {
			{ id = 61999, cat = "battle_res", prio = 1 },  -- Raise Ally: Combat resurrection, 40 yd, instant, 30 Runic Power, 10 min CD.
			{ id = 51052, cat = "raid_cooldown", prio = 1, ground = true, bind = false },  -- Anti-Magic Zone: GROUND-TARGETED (30 yd range on the reticle), 4 min CD.
		},
	},

	-- Unholy (DEATHKNIGHT / DAMAGER)
	[252] = {
		class = "DEATHKNIGHT", role = "DAMAGER", name = "Unholy",
		spells = {
			{ id = 61999, cat = "battle_res", prio = 1 },  -- Raise Ally: Combat res, 40 yd, instant, 30 Runic Power, 10 min CD.
			{ id = 51052, cat = "raid_cooldown", prio = 1, ground = true, bind = false },  -- Anti-Magic Zone: Ground-targeted reticle (30 yd), 4 min CD, -15% magic damage taken for allies inside.
		},
	},

	-- Beast Mastery (HUNTER / DAMAGER)
	[253] = {
		class = "HUNTER", role = "DAMAGER", name = "Beast Mastery",
		rangeSpell = 90361,
		spells = {
			{ id = 53480, cat = "external_defensive", prio = 1 },  -- Roar of Sacrifice: FEROCITY pet ability.
			{ id = 34477, cat = "utility", prio = 1 },  -- Misdirection: Redirect threat to the targeted party/raid member.
			{ id = 53271, cat = "utility", prio = 2 },  -- Master's Call: Pet ability.
			{ id = 19801, cat = "purge_offensive", prio = 2, bind = false, dispel = { Enrage = true, Magic = true } },  -- Tranquilizing Shot: ENEMY-targeted: removes 1 Enrage AND 1 Magic from an enemy.
			{ id = 264667, cat = "raid_cooldown", prio = 3, bind = false },  -- Primal Rage: Pet lust: +30% haste raid-wide 40s, 6 min CD, applies Sated.
			{ id = 90361, cat = "heal_big", prio = 4 },  -- Spirit Mend: Exotic SPIRIT BEAST pet only (BM-exclusive pet family).
		},
	},

	-- Marksmanship (HUNTER / DAMAGER)
	[254] = {
		class = "HUNTER", role = "DAMAGER", name = "Marksmanship",
		rangeSpell = 53480,
		spells = {
			{ id = 34477, cat = "utility", prio = 1 },  -- Misdirection: Threat redirect to a party/raid member.
			{ id = 19801, cat = "purge_offensive", prio = 2, bind = false, dispel = { Enrage = true, Magic = true } },  -- Tranquilizing Shot: Enemy-targeted Enrage + Magic removal.
			{ id = 53271, cat = "utility", prio = 3 },  -- Master's Call: CONDITIONAL in Midnight.
			{ id = 53480, cat = "external_defensive", prio = 3 },  -- Roar of Sacrifice: Same caveat as Master's Call - requires a pet (Ferocity) and therefore the Unbreakable Bond t...
			{ id = 466904, cat = "raid_cooldown", prio = 6, bind = false },  -- Harrier's Cry
		},
	},

	-- Survival (HUNTER / DAMAGER)
	[255] = {
		class = "HUNTER", role = "DAMAGER", name = "Survival",
		rangeSpell = 53480,
		spells = {
			{ id = 53480, cat = "external_defensive", prio = 1 },  -- Roar of Sacrifice: Ferocity pet ability: -15% damage taken on an ally, 50% transferred to your pet, 10s.
			{ id = 34477, cat = "utility", prio = 1 },  -- Misdirection: Threat redirect to a party/raid member.
			{ id = 53271, cat = "utility", prio = 2 },  -- Master's Call: Pet ability: clears and immunes roots/snares on an ally for 4s.
			{ id = 19801, cat = "purge_offensive", prio = 2, bind = false, dispel = { Enrage = true, Magic = true } },  -- Tranquilizing Shot: Enemy-targeted Enrage + Magic removal.
			{ id = 264667, cat = "raid_cooldown", prio = 3, bind = false },  -- Primal Rage: Pet lust, +30% haste raid-wide 40s, 6 min CD.
		},
	},

	-- Discipline Priest (PRIEST / HEALER)
	[256] = {
		class = "PRIEST", role = "HEALER", name = "Discipline Priest",
		rangeSpell = 47540,
		spells = {
			{ id = 17, cat = "shield", prio = 1 },  -- Power Word: Shield: Applies Atonement.
			{ id = 47540, cat = "heal_fast", prio = 2 },  -- Penance: Spec spell for 256.
			{ id = 2061, cat = "heal_fast", prio = 3 },  -- Flash Heal: Applies Atonement.
			{ id = 194509, cat = "heal_aoe", prio = 5 },  -- Power Word: Radiance: Targeted smart AoE, applies Atonement at reduced duration.
			{ id = 33206, cat = "external_defensive", prio = 6 },  -- Pain Suppression
			{ id = 62618, cat = "raid_cooldown", prio = 7, ground = true, bind = false },  -- Power Word: Barrier: Ground reticle.
			{ id = 527, cat = "dispel", prio = 8, dispel = { Magic = true, Disease = true } },  -- Purify: Disease only with Improved Purify (390632).
			{ id = 472433, cat = "raid_cooldown", prio = 9 },  -- Evangelism: NEW ID for Midnight (old Evangelism was 246287).
			{ id = 421453, cat = "raid_cooldown", prio = 10, bind = false },  -- Ultimate Penitence: 4 min.
			{ id = 186263, cat = "heal_big", prio = 11 },  -- Shadow Mend: In 12.0.7 the Shadow Mend talent (1252215) is PASSIVE: Shadow Word: Pain damage upgrades your...
			{ id = 194384, cat = "heal_hot", prio = 12, bind = false },  -- Atonement: TRACK-ONLY aura ID applied to allies (referenced as $194384d by the passive talent 81749).
			{ id = 10060, cat = "support_buff", prio = 13 },  -- Power Infusion
			{ id = 73325, cat = "utility", prio = 14 },  -- Leap of Faith
			{ id = 32375, cat = "dispel", prio = 15, ground = true, bind = false, dispel = { Magic = true } },  -- Mass Dispel
			{ id = 528, cat = "purge_offensive", prio = 16, bind = false, dispel = { Magic = true } },  -- Dispel Magic
			{ id = 121536, cat = "utility", prio = 17, ground = true, bind = false },  -- Angelic Feather
			{ id = 19236, cat = "heal_emergency", prio = 18, bind = false },  -- Desperate Prayer: Self only.
			{ id = 21562, cat = "support_buff", prio = 19 },  -- Power Word: Fortitude
			{ id = 1706, cat = "utility", prio = 20 },  -- Levitate
			{ id = 2006, cat = "utility", prio = 21 },  -- Resurrection: Priest has no battle res.
			{ id = 212036, cat = "utility", prio = 22, bind = false },  -- Mass Resurrection
			{ id = 8092, cat = "damage", prio = 23, bind = false },  -- Mind Blast: Atonement damage-to-healing.
			{ id = 32379, cat = "damage", prio = 24, bind = false },  -- Shadow Word: Death
			{ id = 585, cat = "damage", prio = 25, bind = false },  -- Smite
		},
	},

	-- Holy Priest (PRIEST / HEALER)
	[257] = {
		class = "PRIEST", role = "HEALER", name = "Holy Priest",
		rangeSpell = 2061,
		spells = {
			{ id = 2061, cat = "heal_fast", prio = 1 },  -- Flash Heal: Core single-target heal.
			{ id = 33076, cat = "heal_hot", prio = 2 },  -- Prayer of Mending: MIDNIGHT CHANGE: SpecializationSpells for spec 257 shows 33076 with OverridesSpellID=17, i.e.
			{ id = 2050, cat = "heal_big", prio = 3 },  -- Holy Word: Serenity: Big instant single-target heal.
			{ id = 47788, cat = "external_defensive", prio = 4 },  -- Guardian Spirit: 3 min CD.
			{ id = 527, cat = "dispel", prio = 5, dispel = { Magic = true, Disease = true } },  -- Purify: Baseline for Holy/Disc (overrides Purify Disease 440006 which is the new ID for the non-heale...
			{ id = 596, cat = "heal_aoe", prio = 6 },  -- Prayer of Healing: Now reads 'heals your target and N-1 injured allies within A2 yards' - it is a TARGETED smart...
			{ id = 34861, cat = "heal_aoe", prio = 7, ground = true, bind = false },  -- Holy Word: Sanctify: Ground reticle (SpellTargetRestrictions Targets bit 0x40 set).
			{ id = 64843, cat = "raid_cooldown", prio = 8, bind = false },  -- Divine Hymn: 3 min channelled raid heal + stacking healing-taken buff.
			{ id = 120517, cat = "heal_aoe", prio = 9, bind = false },  -- Halo: Archon hero-tree only in 12.0.7 (TraitSubTree 19).
			{ id = 200183, cat = "raid_cooldown", prio = 10, bind = false },  -- Apotheosis: 2 min personal throughput CD (resets/charges Holy Words).
			{ id = 10060, cat = "support_buff", prio = 11 },  -- Power Infusion: Castable on other players (talent Twins of the Sun Priestess 373466 makes it worth binding on...
			{ id = 73325, cat = "utility", prio = 12 },  -- Leap of Faith
			{ id = 32375, cat = "dispel", prio = 13, ground = true, bind = false, dispel = { Magic = true } },  -- Mass Dispel: Ground reticle.
			{ id = 132157, cat = "heal_aoe", prio = 14, bind = false },  -- Holy Nova: Self-centred.
			{ id = 121536, cat = "utility", prio = 15, ground = true, bind = false },  -- Angelic Feather: Ground reticle.
			{ id = 528, cat = "purge_offensive", prio = 16, bind = false, dispel = { Magic = true } },  -- Dispel Magic
			{ id = 19236, cat = "heal_emergency", prio = 17, bind = false },  -- Desperate Prayer: Self only.
			{ id = 21562, cat = "support_buff", prio = 18 },  -- Power Word: Fortitude: Raid-wide when target is in your group.
			{ id = 1706, cat = "utility", prio = 19 },  -- Levitate
			{ id = 2006, cat = "utility", prio = 20 },  -- Resurrection: Out-of-combat res.
			{ id = 212036, cat = "utility", prio = 21, bind = false },  -- Mass Resurrection
			{ id = 139, cat = "heal_hot", prio = 22 },  -- Renew: DO NOT BIND.
			{ id = 88625, cat = "damage", prio = 23, bind = false },  -- Holy Word: Chastise
			{ id = 14914, cat = "damage", prio = 24, bind = false },  -- Holy Fire: Talent; overrides Smite (589 listed as OverridesSpellID in trait data).
			{ id = 585, cat = "damage", prio = 25, bind = false },  -- Smite
		},
	},

	-- Shadow (PRIEST / DAMAGER)
	[258] = {
		class = "PRIEST", role = "DAMAGER", name = "Shadow",
		rangeSpell = 2061,
		spells = {
			{ id = 17, cat = "shield", prio = 1 },  -- Power Word: Shield: Baseline for all priests (tooltip has no Talent tag, requires level 4).
			{ id = 10060, cat = "support_buff", prio = 1 },  -- Power Infusion: 40 yd, 2 min CD, +20% haste 15s.
			{ id = 213634, cat = "dispel", prio = 2, dispel = { Disease = true } },  -- Purify Disease: Class-tree talent.
			{ id = 32375, cat = "dispel", prio = 2, ground = true, bind = false, dispel = { Magic = true } },  -- Mass Dispel: GROUND-TARGETED 15 yd radius: removes all harmful Magic from 5 friendly targets and 1 benefic...
			{ id = 73325, cat = "utility", prio = 2 },  -- Leap of Faith: Class-tree talent, 40 yd, 1.5 min CD.
			{ id = 15286, cat = "heal_aoe", prio = 3, bind = false },  -- Vampiric Embrace: Self-buff, 12s: 40% of your single-target Shadow damage heals a nearby ally.
			{ id = 2061, cat = "heal_fast", prio = 3 },  -- Flash Heal: Baseline (level 3), 40 yd, 1.5s cast.
			{ id = 139, cat = "heal_hot", prio = 4 },  -- Renew: Baseline for all priests (no Talent tag on the tooltip), 40 yd, instant HoT.
			{ id = 121536, cat = "utility", prio = 4, ground = true, bind = false },  -- Angelic Feather: GROUND-TARGETED: places a feather at a location; first ally through it gets +40% speed 5s.
			{ id = 528, cat = "purge_offensive", prio = 4, bind = false },  -- Dispel Magic: ENEMY-targeted in retail: removes 1 beneficial Magic from an enemy, 30 yd.
			{ id = 2006, cat = "utility", prio = 5 },  -- Resurrection: Out-of-combat resurrection.
		},
	},

	-- Assassination (ROGUE / DAMAGER)
	[259] = {
		class = "ROGUE", role = "DAMAGER", name = "Assassination",
		rangeSpell = 57934,
		spells = {
			{ id = 57934, cat = "support_buff", prio = 1 },  -- Tricks of the Trade: 100 yd, 30s CD.
			{ id = 114018, cat = "utility", prio = 2, bind = false },  -- Shroud of Concealment: Self-centered 30 yd AoE stealth for party/raid, 15s.
		},
	},

	-- Outlaw (ROGUE / DAMAGER)
	[260] = {
		class = "ROGUE", role = "DAMAGER", name = "Outlaw",
		rangeSpell = 57934,
		spells = {
			{ id = 57934, cat = "support_buff", prio = 1 },  -- Tricks of the Trade: Threat redirect + (with Thick as Thieves) +15% damage on the target ally for 6s.
			{ id = 114018, cat = "utility", prio = 2, bind = false },  -- Shroud of Concealment: Group stealth within 30 yds for 15s.
		},
	},

	-- Subtlety (ROGUE / DAMAGER)
	[261] = {
		class = "ROGUE", role = "DAMAGER", name = "Subtlety",
		rangeSpell = 57934,
		spells = {
			{ id = 57934, cat = "support_buff", prio = 1 },  -- Tricks of the Trade: Threat redirect + optional +15% ally damage via Thick as Thieves.
			{ id = 114018, cat = "utility", prio = 2, bind = false },  -- Shroud of Concealment: Group stealth within 30 yds for 15s.
		},
	},

	-- Elemental (SHAMAN / DAMAGER)
	[262] = {
		class = "SHAMAN", role = "DAMAGER", name = "Elemental",
		rangeSpell = 8004,
		spells = {
			{ id = 51886, cat = "dispel", prio = 1, dispel = { Curse = true } },  -- Cleanse Spirit: Non-Resto shaman dispel: CURSE ONLY, 40 yd, 8s CD.
			{ id = 974, cat = "shield", prio = 1 },  -- Earth Shield: Available to Elemental ONLY via the Elemental Orbit talent (383010), whose tooltip states 'Yo...
			{ id = 8004, cat = "heal_fast", prio = 2 },  -- Healing Surge: Baseline off-spec direct heal on a friendly target.
			{ id = 370, cat = "purge_offensive", prio = 2, bind = false },  -- Purge: ENEMY-targeted: removes 1 beneficial Magic effect, 30 yd.
			{ id = 2825, cat = "raid_cooldown", prio = 2, bind = false },  -- Bloodlust: HORDE version.
			{ id = 32182, cat = "raid_cooldown", prio = 2, bind = false },  -- Heroism: ALLIANCE version of Bloodlust; tooltip is faction-tagged.
			{ id = 5394, cat = "heal_aoe", prio = 3, bind = false },  -- Healing Stream Totem: Class-tree talent.
			{ id = 2008, cat = "utility", prio = 3 },  -- Ancestral Spirit: Out-of-combat resurrection (35% health/mana).
			{ id = 192077, cat = "utility", prio = 4, ground = true, bind = false },  -- Wind Rush Totem: GROUND-TARGETED ('at the target location').
			{ id = 546, cat = "utility", prio = 6 },  -- Water Walking: 30 yd friendly-targeted, 10 min.
		},
	},

	-- Enhancement (SHAMAN / DAMAGER)
	[263] = {
		class = "SHAMAN", role = "DAMAGER", name = "Enhancement",
		rangeSpell = 8004,
		spells = {
			{ id = 51886, cat = "dispel", prio = 1, dispel = { Curse = true } },  -- Cleanse Spirit: Curse only, 40 yd, 8s CD.
			{ id = 974, cat = "shield", prio = 1 },  -- Earth Shield: Requires the Elemental Orbit talent (383010) to place on an ally as well as yourself.
			{ id = 8004, cat = "heal_fast", prio = 2 },  -- Healing Surge: Baseline friendly-target heal; Enhancement can make it instant with Maelstrom Weapon stacks, ...
			{ id = 370, cat = "purge_offensive", prio = 2, bind = false },  -- Purge: Enemy-targeted magic purge; for Enhancement it also grants a Maelstrom Weapon stack on success.
			{ id = 2825, cat = "raid_cooldown", prio = 2, bind = false },  -- Bloodlust: Horde version, +30% haste raid-wide 40s.
			{ id = 32182, cat = "raid_cooldown", prio = 2, bind = false },  -- Heroism: Alliance version; only one of the two exists per character.
			{ id = 5394, cat = "heal_aoe", prio = 3, bind = false },  -- Healing Stream Totem: Class-tree talent, drops at your feet, smart-heals injured allies within 40 yds.
			{ id = 2008, cat = "utility", prio = 3 },  -- Ancestral Spirit: Out-of-combat resurrection.
			{ id = 192077, cat = "utility", prio = 4, ground = true, bind = false },  -- Wind Rush Totem: Ground-targeted totem, +40% speed to allies passing through.
			{ id = 546, cat = "utility", prio = 6 },  -- Water Walking: 30 yd friendly-targeted.
		},
	},

	-- Restoration Shaman (SHAMAN / HEALER)
	[264] = {
		class = "SHAMAN", role = "HEALER", name = "Restoration Shaman",
		rangeSpell = 73685,
		spells = {
			{ id = 77472, cat = "heal_efficient", prio = 1 },  -- Healing Wave: MIDNIGHT CHANGE: Healing Surge (8004) was REMOVED for Restoration.
			{ id = 61295, cat = "heal_hot", prio = 2 },  -- Riptide: Instant direct heal + HoT, generates Tidal Waves.
			{ id = 1064, cat = "heal_aoe", prio = 3 },  -- Chain Heal: Targeted, jumps from the friendly target.
			{ id = 73920, cat = "heal_aoe", prio = 4, ground = true, bind = false },  -- Healing Rain: Ground reticle.
			{ id = 974, cat = "shield", prio = 5 },  -- Earth Shield: Not an absorb - a charge-based heal-on-damage plus a healing-received bonus.
			{ id = 73685, cat = "heal_fast", prio = 6 },  -- Unleash Life: Redesigned in Midnight: now only empowers your next Riptide, Chain Heal or Healing Wave.
			{ id = 5394, cat = "heal_aoe", prio = 7, bind = false },  -- Healing Stream Totem: Castable ID is 5394; the talent nodes 392915/392916 are passives.
			{ id = 108280, cat = "raid_cooldown", prio = 8, bind = false },  -- Healing Tide Totem: Now on a choice node with Ascendance.
			{ id = 98008, cat = "raid_cooldown", prio = 9, ground = true, bind = false },  -- Spirit Link Totem: Ground reticle.
			{ id = 114052, cat = "raid_cooldown", prio = 10, bind = false },  -- Ascendance: Resto version (114050 Ele / 114051 Enh).
			{ id = 77130, cat = "dispel", prio = 11, dispel = { Magic = true, Curse = true } },  -- Purify Spirit: Overrides Cleanse Spirit, whose non-Resto ID is now 440012 rather than 51886.
			{ id = 383013, cat = "dispel", prio = 12, bind = false, dispel = { Poison = true } },  -- Poison Cleansing Totem: AoE totem dispel, drops at your feet.
			{ id = 8143, cat = "utility", prio = 13, bind = false },  -- Tremor Totem: Removes Fear/Charm/Sleep from party and raid in range.
			{ id = 192077, cat = "utility", prio = 14, ground = true, bind = false },  -- Wind Rush Totem: Ground reticle.
			{ id = 378081, cat = "utility", prio = 15, bind = false },  -- Nature's Swiftness: Shaman version (druid's is 132158).
			{ id = 207778, cat = "heal_aoe", prio = 16, ground = true, bind = false },  -- Downpour: Returned in Midnight as a proc: talent Downpour (462486) is passive and grants a use of Downp...
			{ id = 444995, cat = "heal_aoe", prio = 17, ground = true, bind = false },  -- Surging Totem: Totemic hero tree.
			{ id = 462854, cat = "support_buff", prio = 18 },  -- Skyfury: Cast on an ally; applies raid-wide if the target is in your group.
			{ id = 382021, cat = "support_buff", prio = 19, bind = false },  -- Earthliving Weapon: Self weapon imbue.
			{ id = 2825, cat = "raid_cooldown", prio = 20, bind = false },  -- Bloodlust: Horde.
			{ id = 32182, cat = "raid_cooldown", prio = 21, bind = false },  -- Heroism
			{ id = 370, cat = "purge_offensive", prio = 22, bind = false, dispel = { Magic = true } },  -- Purge
			{ id = 378773, cat = "purge_offensive", prio = 23, bind = false, dispel = { Magic = true } },  -- Greater Purge: Talent; removes multiple beneficial Magic effects.
			{ id = 57994, cat = "utility", prio = 24, bind = false },  -- Wind Shear: Resto Shaman is the ONLY healer spec that kept an interrupt in Midnight.
			{ id = 79206, cat = "utility", prio = 25, bind = false },  -- Spiritwalker's Grace
			{ id = 108287, cat = "utility", prio = 26, ground = true, bind = false },  -- Totemic Projection
			{ id = 546, cat = "utility", prio = 27 },  -- Water Walking
			{ id = 2008, cat = "utility", prio = 28 },  -- Ancestral Spirit: Out-of-combat res.
			{ id = 212048, cat = "utility", prio = 29, bind = false },  -- Ancestral Vision: Mass res.
			{ id = 51505, cat = "damage", prio = 30, bind = false },  -- Lava Burst
			{ id = 188443, cat = "damage", prio = 31, bind = false },  -- Chain Lightning
		},
	},

	-- Affliction (WARLOCK / DAMAGER)
	[265] = {
		class = "WARLOCK", role = "DAMAGER", name = "Affliction",
		rangeSpell = 89808,
		spells = {
			{ id = 20707, cat = "battle_res", prio = 1 },  -- Soulstone: 40 yd, 3s cast, 10 min CD.
			{ id = 89808, cat = "dispel", prio = 2, dispel = { Magic = true } },  -- Singe Magic: IMP pet ability - the warlock's only friendly Magic dispel.
			{ id = 119898, cat = "utility", prio = 3 },  -- Command Demon: Player-facing wrapper that becomes the active pet's signature ability.
			{ id = 19505, cat = "purge_offensive", prio = 4, bind = false },  -- Devour Magic: Felhunter ability, ENEMY purge in current retail ('Purges 1 beneficial magic effect from an e...
			{ id = 29893, cat = "utility", prio = 4, bind = false },  -- Create Soulwell: 2 min duration well; party/raid members grab Healthstones from it.
			{ id = 5697, cat = "utility", prio = 6 },  -- Unending Breath: 30 yd, cast on an ally: underwater breathing + 20% swim speed, 10 min.
			{ id = 6201, cat = "utility", prio = 6, bind = false },  -- Create Healthstone: Self-cast conjure.
		},
	},

	-- Demonology (WARLOCK / DAMAGER)
	[266] = {
		class = "WARLOCK", role = "DAMAGER", name = "Demonology",
		rangeSpell = 89808,
		spells = {
			{ id = 20707, cat = "battle_res", prio = 1 },  -- Soulstone: 40 yd, 3s cast, 10 min CD.
			{ id = 89808, cat = "dispel", prio = 2, dispel = { Magic = true } },  -- Singe Magic: Imp pet ability; friendly Magic dispel.
			{ id = 119898, cat = "utility", prio = 3 },  -- Command Demon: Becomes Axe Toss with Felguard (Demonology's default pet), not Singe Magic.
			{ id = 19505, cat = "purge_offensive", prio = 4, bind = false },  -- Devour Magic: Felhunter, enemy purge only in current retail.
			{ id = 29893, cat = "utility", prio = 4, bind = false },  -- Create Soulwell: Group Healthstone source.
			{ id = 5697, cat = "utility", prio = 6 },  -- Unending Breath: Friendly-targeted underwater breathing, 30 yd.
			{ id = 6201, cat = "utility", prio = 6, bind = false },  -- Create Healthstone: Self-cast conjure.
		},
	},

	-- Destruction (WARLOCK / DAMAGER)
	[267] = {
		class = "WARLOCK", role = "DAMAGER", name = "Destruction",
		rangeSpell = 89808,
		spells = {
			{ id = 20707, cat = "battle_res", prio = 1 },  -- Soulstone: 40 yd, 3s cast, 10 min CD.
			{ id = 89808, cat = "dispel", prio = 2, dispel = { Magic = true } },  -- Singe Magic: Imp pet ability - Destruction commonly runs Imp, so this is the most usable warlock friendly ...
			{ id = 119898, cat = "utility", prio = 3 },  -- Command Demon: With Imp active this IS Singe Magic and can be click-cast on a friendly frame.
			{ id = 19505, cat = "purge_offensive", prio = 4, bind = false },  -- Devour Magic: Felhunter, enemy purge only.
			{ id = 29893, cat = "utility", prio = 4, bind = false },  -- Create Soulwell: Group Healthstone source.
			{ id = 5697, cat = "utility", prio = 6 },  -- Unending Breath: Friendly-targeted, 30 yd.
			{ id = 6201, cat = "utility", prio = 6, bind = false },  -- Create Healthstone: Self-cast conjure.
		},
	},

	-- Brewmaster Monk (MONK / TANK)
	[268] = {
		class = "MONK", role = "TANK", name = "Brewmaster Monk",
		rangeSpell = 116670,
		spells = {
			{ id = 218164, cat = "dispel", prio = 1, dispel = { Poison = true, Disease = true } },  -- Detox: 40 yd, 10 Energy, 8s CD.
			{ id = 116670, cat = "heal_fast", prio = 2 },  -- Vivify: 40 yd.
			{ id = 116841, cat = "utility", prio = 3 },  -- Tiger's Lust: 20 yd (short!).
			{ id = 116844, cat = "utility", prio = 4, ground = true, bind = false },  -- Ring of Peace: 40 yd cast range, 8 yd ground-placed area trigger, 5s, 45s CD.
			{ id = 115178, cat = "utility", prio = 5 },  -- Resuscitate: Out-of-combat resurrection only, 10s cast.
			{ id = 123986, cat = "heal_aoe", prio = 6, bind = false },  -- Chi Burst: Talent.
			{ id = 322101, cat = "utility", prio = 7, bind = false },  -- Expel Harm: Self-heal only, pulls Gift of the Ox orbs.
			{ id = 115203, cat = "utility", prio = 8, bind = false },  -- Fortifying Brew: track-only - PRIMARY Brewmaster defensive (max health + DR, 6 min CD).
			{ id = 322507, cat = "utility", prio = 9, bind = false },  -- Celestial Brew: track-only - self absorb shield, 8s.
			{ id = 122278, cat = "utility", prio = 10, bind = false },  -- Dampen Harm: track-only - self only, confirmed still present in 12.0.7.
			{ id = 115176, cat = "utility", prio = 11, bind = false },  -- Zen Meditation: track-only - channeled, self damage reduction, 5 min CD, breaks on melee.
		},
	},

	-- Windwalker (MONK / DAMAGER)
	[269] = {
		class = "MONK", role = "DAMAGER", name = "Windwalker",
		rangeSpell = 116670,
		spells = {
			{ id = 218164, cat = "dispel", prio = 1, dispel = { Poison = true, Disease = true } },  -- Detox: WW/Brewmaster version - Poison + Disease only, 40 yd, 8s CD, 10 Energy.
			{ id = 116670, cat = "heal_fast", prio = 2 },  -- Vivify: Baseline for all monks, 40 yd, 30 Energy for WW.
			{ id = 116841, cat = "utility", prio = 2 },  -- Tiger's Lust: Class-tree talent, friendly-targeted: +70% movement speed and removes all roots/snares.
			{ id = 116844, cat = "utility", prio = 3, ground = true, bind = false },  -- Ring of Peace: GROUND-TARGETED ('at the target location'), 5s, ejects enemies.
			{ id = 115178, cat = "utility", prio = 4 },  -- Resuscitate: Out-of-combat resurrection.
		},
	},

	-- Mistweaver Monk (MONK / HEALER)
	[270] = {
		class = "MONK", role = "HEALER", name = "Mistweaver Monk",
		rangeSpell = 116670,
		spells = {
			{ id = 116670, cat = "heal_fast", prio = 1 },  -- Vivify: Best default left-click.
			{ id = 115151, cat = "heal_hot", prio = 2 },  -- Renewing Mist: Spec spell for 270.
			{ id = 124682, cat = "heal_hot", prio = 3 },  -- Enveloping Mist
			{ id = 115175, cat = "heal_efficient", prio = 4 },  -- Soothing Mist: Channel.
			{ id = 399491, cat = "heal_big", prio = 5 },  -- Sheilun's Gift: TraitDefinition OverridesSpellID=116670: taking Sheilun's Gift REPLACES Vivify on the bar.
			{ id = 116849, cat = "external_defensive", prio = 6 },  -- Life Cocoon: Absorb + HoT-received bonus.
			{ id = 115310, cat = "raid_cooldown", prio = 7, bind = false },  -- Revival: Also an AoE dispel: clears 1 harmful Magic plus all Poison and Disease from the raid.
			{ id = 388615, cat = "raid_cooldown", prio = 8, bind = false },  -- Restoral: Talent alternative that replaces Revival; clears Poison/Disease only but is castable while st...
			{ id = 115450, cat = "dispel", prio = 9, dispel = { Magic = true, Poison = true, Disease = true } },  -- Detox: Mistweaver version (non-MW is 218164).
			{ id = 322118, cat = "raid_cooldown", prio = 10, bind = false },  -- Invoke Yu'lon, the Jade Serpent
			{ id = 325197, cat = "raid_cooldown", prio = 11, bind = false },  -- Invoke Chi-Ji, the Red Crane
			{ id = 443028, cat = "raid_cooldown", prio = 12, bind = false },  -- Celestial Conduit: Conduit of the Celestials hero tree.
			{ id = 116680, cat = "utility", prio = 13, bind = false },  -- Thunder Focus Tea: Self-buff that empowers the next spell.
			{ id = 197908, cat = "utility", prio = 14, bind = false },  -- Mana Tea: 197908 is the castable; the talent node 115869 is a passive that generates the stacks.
			{ id = 116841, cat = "utility", prio = 15 },  -- Tiger's Lust: Friendly-targeted: speed boost and removes roots/snares.
			{ id = 116844, cat = "utility", prio = 16, ground = true, bind = false },  -- Ring of Peace: Ground reticle.
			{ id = 115313, cat = "utility", prio = 17, ground = true, bind = false },  -- Summon Jade Serpent Statue: Ground reticle.
			{ id = 101643, cat = "utility", prio = 18, bind = false },  -- Transcendence: Transcendence: Linked Spirits (434774) is a passive talent that tethers the spirit to an ally.
			{ id = 119996, cat = "utility", prio = 19, bind = false },  -- Transcendence: Transfer
			{ id = 243435, cat = "utility", prio = 20, bind = false },  -- Fortifying Brew: Castable ID is 115203 (talent node 388917 is passive).
			{ id = 198898, cat = "utility", prio = 21, bind = false },  -- Song of Chi-Ji
			{ id = 109132, cat = "utility", prio = 22, bind = false },  -- Roll: Chi Torpedo (115008) overrides it when talented.
			{ id = 115178, cat = "utility", prio = 23 },  -- Resuscitate: Out-of-combat res.
			{ id = 212051, cat = "utility", prio = 24, bind = false },  -- Reawaken: Mass res.
			{ id = 107428, cat = "damage", prio = 25, bind = false },  -- Rising Sun Kick: Core of the Ancient Teachings damage-to-healing loop.
			{ id = 100780, cat = "damage", prio = 26, bind = false },  -- Tiger Palm
			{ id = 101546, cat = "damage", prio = 27, bind = false },  -- Spinning Crane Kick
		},
	},

	-- Havoc (DEMONHUNTER / DAMAGER)
	[577] = {
		class = "DEMONHUNTER", role = "DAMAGER", name = "Havoc",
		spells = {
			{ id = 196718, cat = "raid_cooldown", prio = 1, bind = false },  -- Darkness: Self-centered 8 yd, 5 min CD (3 min with Pitch Black).
			{ id = 278326, cat = "purge_offensive", prio = 2, bind = false },  -- Consume Magic: ENEMY-targeted: consumes 1 beneficial Magic effect from the target, 30 yd, 10s CD.
		},
	},

	-- Vengeance Demon Hunter (DEMONHUNTER / TANK)
	[581] = {
		class = "DEMONHUNTER", role = "TANK", name = "Vengeance Demon Hunter",
		spells = {
			{ id = 196718, cat = "raid_cooldown", prio = 1, bind = false },  -- Darkness: Baseline, 5 min CD, 8s.
			{ id = 278326, cat = "purge_offensive", prio = 2, bind = false, dispel = { Magic = true } },  -- Consume Magic: ENEMY-targeted, 30 yd, 10s CD.
			{ id = 187827, cat = "utility", prio = 3, bind = false },  -- Metamorphosis: track-only - PRIMARY Vengeance defensive: +40% max health, +200% armor, leech, 15s, 2 min CD.
			{ id = 203720, cat = "utility", prio = 4, bind = false },  -- Demon Spikes: track-only - short rotational armor/parry buff on charges.
			{ id = 204021, cat = "utility", prio = 5, bind = false },  -- Fiery Brand: track-only - ENEMY-targeted debuff that reduces damage the DH takes from that target by 40%.
		},
	},

	-- Devastation (EVOKER / DAMAGER)
	[1467] = {
		class = "EVOKER", role = "DAMAGER", name = "Devastation",
		rangeSpell = 361469,
		spells = {
			{ id = 374251, cat = "dispel", prio = 1, dispel = { Bleed = true, Poison = true, Curse = true, Disease = true } },  -- Cauterizing Flame: Class tree.
			{ id = 360995, cat = "heal_big", prio = 1 },  -- Verdant Embrace: Class tree.
			{ id = 370665, cat = "utility", prio = 1 },  -- Rescue: Class tree.
			{ id = 369459, cat = "support_buff", prio = 2 },  -- Source of Magic: Class tree.
			{ id = 406732, cat = "support_buff", prio = 2 },  -- Spatial Paradox: Class tree, 60 yd.
			{ id = 374227, cat = "raid_cooldown", prio = 3, bind = false },  -- Zephyr: Self-centered, you + 4 nearest allies, -20% AoE damage taken and +30% speed.
			{ id = 374968, cat = "raid_cooldown", prio = 3, bind = false },  -- Time Spiral: Free movement-ability reset for you and allies within 40 yds.
			{ id = 364342, cat = "support_buff", prio = 3 },  -- Blessing of the Bronze: Live in 12.0.7 (12.0.5 extended it to friendly players outside your group).
			{ id = 390386, cat = "raid_cooldown", prio = 4, bind = false },  -- Fury of the Aspects: Evoker lust: +30% haste raid-wide 40s, 5 min CD.
			{ id = 355913, cat = "heal_aoe", prio = 5, ground = true },  -- Emerald Blossom: 25 yd, heals up to 3 injured allies within 10 yds of an ally's location.
			{ id = 361469, cat = "heal_fast", prio = 5 },  -- Living Flame: Baseline.
			{ id = 361227, cat = "utility", prio = 6 },  -- Return: Out-of-combat resurrection.
		},
	},

	-- Preservation Evoker (EVOKER / HEALER)
	[1468] = {
		class = "EVOKER", role = "HEALER", name = "Preservation Evoker",
		rangeSpell = 361469,
		spells = {
			{ id = 361469, cat = "heal_fast", prio = 1 },  -- Living Flame: Baseline.
			{ id = 364343, cat = "heal_hot", prio = 2 },  -- Echo: Not a HoT in the classic sense - it heals immediately and leaves a stored-heal buff on the al...
			{ id = 366155, cat = "heal_hot", prio = 3 },  -- Reversion
			{ id = 355913, cat = "heal_aoe", prio = 4 },  -- Emerald Blossom: IMPORTANT: this is UNIT-targeted, not a ground reticle - it grows a bulb 'at an ally's locati...
			{ id = 360995, cat = "heal_big", prio = 5 },  -- Verdant Embrace: Flies you to the ally.
			{ id = 355936, cat = "heal_aoe", prio = 6, bind = false },  -- Dream Breath: Empowered frontal cone from you.
			{ id = 373861, cat = "shield", prio = 7, bind = false },  -- Temporal Anomaly: MIDNIGHT REWORK: Resonating Sphere was removed and Temporal Anomaly now applies Echo baseline.
			{ id = 1291636, cat = "shield", prio = 8 },  -- Temporal Barrier: NEW in Midnight - replaced Resonating Sphere as the alternative choice.
			{ id = 363534, cat = "raid_cooldown", prio = 9, bind = false },  -- Rewind
			{ id = 357170, cat = "external_defensive", prio = 10 },  -- Time Dilation: The spec's single-target external.
			{ id = 359816, cat = "raid_cooldown", prio = 11, ground = true, bind = false },  -- Dream Flight: Ground reticle - you fly to the targeted location.
			{ id = 374227, cat = "raid_cooldown", prio = 12, bind = false },  -- Zephyr: AoE damage reduction for you and nearest allies.
			{ id = 370537, cat = "utility", prio = 13, bind = false },  -- Stasis: Stores your next 3 helpful spells; reactivate to release.
			{ id = 370665, cat = "utility", prio = 14, ground = true },  -- Rescue: Needs BOTH a friendly unit and a ground destination - has the DEST_LOCATION bit set.
			{ id = 369459, cat = "support_buff", prio = 15 },  -- Source of Magic: Cast on another healer for mana return.
			{ id = 360823, cat = "dispel", prio = 16, dispel = { Magic = true, Poison = true } },  -- Naturalize: Preservation-only; overrides Expunge (365585).
			{ id = 374251, cat = "dispel", prio = 17, dispel = { Bleed = true, Poison = true, Curse = true, Disease = true } },  -- Cauterizing Flame: Also heals when it removes something.
			{ id = 390386, cat = "raid_cooldown", prio = 18, bind = false },  -- Fury of the Aspects: Baseline Evoker bloodlust equivalent (not in the trait tree, so it comes from level-up).
			{ id = 431443, cat = "heal_fast", prio = 19 },  -- Chrono Flames: Chronowarden hero tree.
			{ id = 1256581, cat = "heal_aoe", prio = 20 },  -- Merithra's Blessing: NEW in Midnight.
			{ id = 370553, cat = "utility", prio = 21, bind = false },  -- Tip the Scales
			{ id = 363916, cat = "utility", prio = 22, bind = false },  -- Obsidian Scales: Self only.
			{ id = 358267, cat = "utility", prio = 23, bind = false },  -- Hover
			{ id = 361227, cat = "utility", prio = 24 },  -- Return: Out-of-combat res.
			{ id = 361178, cat = "utility", prio = 25, bind = false },  -- Mass Return: Mass res; spec spell for 1468.
			{ id = 362969, cat = "damage", prio = 26, bind = false },  -- Azure Strike
			{ id = 357208, cat = "damage", prio = 27, bind = false },  -- Fire Breath
		},
	},

	-- Augmentation (EVOKER / DAMAGER)
	[1473] = {
		class = "EVOKER", role = "DAMAGER", name = "Augmentation",
		rangeSpell = 361469,
		spells = {
			{ id = 409311, cat = "support_buff", prio = 1 },  -- Prescience: Aug spec tree.
			{ id = 395152, cat = "support_buff", prio = 2, bind = false },  -- Ebon Might: NOT friendly-targeted in 12.0.7.
			{ id = 360827, cat = "external_defensive", prio = 2 },  -- Blistering Scales: Aug spec tree.
			{ id = 374251, cat = "dispel", prio = 2, dispel = { Bleed = true, Poison = true, Curse = true, Disease = true } },  -- Cauterizing Flame: Class tree.
			{ id = 360995, cat = "heal_big", prio = 3 },  -- Verdant Embrace: Class tree.
			{ id = 370665, cat = "utility", prio = 3 },  -- Rescue: Class tree.
			{ id = 403631, cat = "damage", prio = 3, ground = true, bind = false },  -- Breath of Eons: Aug spec tree, GROUND-TARGETED (fly to targeted location).
			{ id = 369459, cat = "support_buff", prio = 4 },  -- Source of Magic: Class tree.
			{ id = 406732, cat = "support_buff", prio = 4 },  -- Spatial Paradox: Class tree.
			{ id = 374227, cat = "raid_cooldown", prio = 4, bind = false },  -- Zephyr: Class tree.
			{ id = 355913, cat = "heal_aoe", prio = 4, ground = true },  -- Emerald Blossom: 25 yd, 3 Essence.
			{ id = 374968, cat = "raid_cooldown", prio = 5, bind = false },  -- Time Spiral: Class tree.
			{ id = 364342, cat = "support_buff", prio = 5 },  -- Blessing of the Bronze: STILL EXISTS in 12.0.7 - I specifically checked for removal and found none.
			{ id = 390386, cat = "raid_cooldown", prio = 5, bind = false },  -- Fury of the Aspects: Evoker Bloodlust.
			{ id = 408233, cat = "utility", prio = 6 },  -- Bestow Weyrnstone: Class tree, 25 yd, 3s cast.
			{ id = 361469, cat = "heal_fast", prio = 6 },  -- Living Flame: Baseline.
			{ id = 361227, cat = "utility", prio = 7 },  -- Return: Out-of-combat resurrection (not a battle res).
			{ id = 404977, cat = "utility", prio = 8, bind = false },  -- Time Skip: NOT an ally buff in 12.0.7.
		},
	},

	-- Devourer (DEMONHUNTER / DAMAGER)
	[1480] = {
		class = "DEMONHUNTER", role = "DAMAGER", name = "Devourer",
		spells = {
			{ id = 196718, cat = "raid_cooldown", prio = 1, bind = false },  -- Darkness: NEW SPEC in Midnight (specID 1480, confirmed from DBM-Core's LibSpecialization on this machin...
			{ id = 278326, cat = "purge_offensive", prio = 2, bind = false },  -- Consume Magic: Enemy-targeted magic consume; the Devourer guide references it (range increased by the Guile ...
		},
	},

}

--------------------------------------------------------------------------------
-- Heal-over-time effects worth showing on a frame, keyed by spell ID.
--------------------------------------------------------------------------------

SpellDB.hots = {
	[139] = { class = "PRIEST", prio = 78 },  -- Renew
	[774] = { class = "DRUID", prio = 93 },  -- Rejuvenation
	[33076] = { class = "PRIEST", prio = 98 },  -- Prayer of Mending
	[33763] = { class = "DRUID", prio = 97 },  -- Lifebloom
	[61295] = { class = "SHAMAN", prio = 98 },  -- Riptide
	[115151] = { class = "MONK", prio = 98 },  -- Renewing Mist
	[124682] = { class = "MONK", prio = 97 },  -- Enveloping Mist
	[156322] = { class = "PALADIN", prio = 95 },  -- Eternal Flame
	[194384] = { class = "PRIEST", prio = 88 },  -- Atonement
	[325727] = { class = "DRUID", prio = 96 },  -- Adaptive Swarm
	[364343] = { class = "EVOKER", prio = 98 },  -- Echo
	[366155] = { class = "EVOKER", prio = 97 },  -- Reversion
}

--------------------------------------------------------------------------------
-- Absorb applications. The frames show these separately from the absorb bar.
--------------------------------------------------------------------------------

SpellDB.shields = {
	[17] = { class = "PRIEST" },  -- Power Word: Shield
	[974] = { class = "SHAMAN" },  -- Earth Shield
	[373861] = { class = "EVOKER" },  -- Temporal Anomaly
	[432459] = { class = "PALADIN" },  -- Holy Bulwark
	[1291636] = { class = "EVOKER" },  -- Temporal Barrier
}

--------------------------------------------------------------------------------
-- Defensive cooldowns cast on somebody else - shown no matter who cast them.
--------------------------------------------------------------------------------

SpellDB.externals = {
	[1022] = { class = "PALADIN" },  -- Blessing of Protection
	[1044] = { class = "PALADIN" },  -- Blessing of Freedom
	[3411] = { class = "WARRIOR" },  -- Intervene
	[6940] = { class = "PALADIN" },  -- Blessing of Sacrifice
	[33206] = { class = "PRIEST" },  -- Pain Suppression
	[47788] = { class = "PRIEST" },  -- Guardian Spirit
	[53480] = { class = "HUNTER" },  -- Roar of Sacrifice
	[102342] = { class = "DRUID" },  -- Ironbark
	[116849] = { class = "MONK" },  -- Life Cocoon
	[204018] = { class = "PALADIN" },  -- Blessing of Spellwarding
	[357170] = { class = "EVOKER" },  -- Time Dilation
	[360827] = { class = "EVOKER" },  -- Blistering Scales
}

--------------------------------------------------------------------------------
-- Support buffs a player maintains on allies (Prescience, Ebon Might, blessings...).
-- permanent = true marks the cast-once, lasts-an-hour, everybody-has-it kind:
-- tracked, but never occupying a slot in the per-target support indicator.
--------------------------------------------------------------------------------

SpellDB.supportBuffs = {
	[465] = { class = "PALADIN", permanent = true },  -- Devotion Aura
	[1126] = { class = "DRUID", permanent = true },  -- Mark of the Wild
	[1459] = { class = "MAGE", permanent = true },  -- Arcane Intellect
	[6673] = { class = "WARRIOR", permanent = true },  -- Battle Shout
	[10060] = { class = "PRIEST" },  -- Power Infusion
	[21562] = { class = "PRIEST", permanent = true },  -- Power Word: Fortitude
	[29166] = { class = "DRUID" },  -- Innervate
	[53563] = { class = "PALADIN" },  -- Beacon of Light
	[57934] = { class = "ROGUE" },  -- Tricks of the Trade
	[156910] = { class = "PALADIN" },  -- Beacon of Faith
	[200025] = { class = "PALADIN" },  -- Beacon of Virtue
	[364342] = { class = "EVOKER", permanent = true },  -- Blessing of the Bronze
	[369459] = { class = "EVOKER" },  -- Source of Magic
	[382021] = { class = "SHAMAN", permanent = true },  -- Earthliving Weapon
	[395152] = { class = "EVOKER" },  -- Ebon Might
	[406732] = { class = "EVOKER" },  -- Spatial Paradox
	[409311] = { class = "EVOKER" },  -- Prescience
	[432472] = { class = "PALADIN" },  -- Sacred Weapon
	[433568] = { class = "PALADIN", permanent = true },  -- Rite of Sanctification
	[433583] = { class = "PALADIN", permanent = true },  -- Rite of Adjuration
	[462854] = { class = "SHAMAN", permanent = true },  -- Skyfury
	[474750] = { class = "DRUID" },  -- Symbiotic Relationship
}

--------------------------------------------------------------------------------
-- Combat resurrections.
--------------------------------------------------------------------------------

SpellDB.battleRes = {
	[20484] = { class = "DRUID" },  -- Rebirth
	[20707] = { class = "WARLOCK" },  -- Soulstone
	[61999] = { class = "DEATHKNIGHT" },  -- Raise Ally
	[391054] = { class = "PALADIN" },  -- Intercession
}

--------------------------------------------------------------------------------
-- Group-wide cooldowns for the cooldown bar. Durations are base values.
--------------------------------------------------------------------------------

SpellDB.raidCooldowns = {
	[740] = { class = "DRUID", cd = 180 },  -- Tranquility
	[1160] = { class = "WARRIOR", cd = 45 },  -- Demoralizing Shout
	[2825] = { class = "SHAMAN", cd = 300 },  -- Bloodlust
	[31821] = { class = "PALADIN", cd = 180 },  -- Aura Mastery
	[31884] = { class = "PALADIN", cd = 120 },  -- Avenging Wrath
	[32182] = { class = "SHAMAN", cd = 300 },  -- Heroism
	[33891] = { class = "DRUID", cd = 180 },  -- Incarnation: Tree of Life
	[51052] = { class = "DEATHKNIGHT", cd = 240 },  -- Anti-Magic Zone
	[62618] = { class = "PRIEST", cd = 180 },  -- Power Word: Barrier
	[64843] = { class = "PRIEST", cd = 180 },  -- Divine Hymn
	[80353] = { class = "MAGE", cd = 300 },  -- Time Warp
	[97462] = { class = "WARRIOR", cd = 180 },  -- Rallying Cry
	[98008] = { class = "SHAMAN", cd = 180 },  -- Spirit Link Totem
	[106898] = { class = "DRUID", cd = 120 },  -- Stampeding Roar
	[108280] = { class = "SHAMAN", cd = 180 },  -- Healing Tide Totem
	[114052] = { class = "SHAMAN", cd = 180 },  -- Ascendance
	[115310] = { class = "MONK", cd = 180 },  -- Revival
	[196718] = { class = "DEMONHUNTER", cd = 300 },  -- Darkness
	[200183] = { class = "PRIEST", cd = 120 },  -- Apotheosis
	[216331] = { class = "PALADIN", cd = 60 },  -- Avenging Crusader
	[264667] = { class = "HUNTER", cd = 360 },  -- Primal Rage
	[322118] = { class = "MONK", cd = 120 },  -- Invoke Yu'lon, the Jade Serpent
	[325197] = { class = "MONK", cd = 120 },  -- Invoke Chi-Ji, the Red Crane
	[359816] = { class = "EVOKER", cd = 120 },  -- Dream Flight
	[363534] = { class = "EVOKER", cd = 240 },  -- Rewind
	[374227] = { class = "EVOKER", cd = 120 },  -- Zephyr
	[374968] = { class = "EVOKER", cd = 120 },  -- Time Spiral
	[388615] = { class = "MONK", cd = 180 },  -- Restoral
	[390386] = { class = "EVOKER", cd = 300 },  -- Fury of the Aspects
	[391528] = { class = "DRUID", cd = 120 },  -- Convoke the Spirits
	[421453] = { class = "PRIEST", cd = 240 },  -- Ultimate Penitence
	[443028] = { class = "MONK", cd = 90 },  -- Celestial Conduit
	[466904] = { class = "HUNTER", cd = 180 },  -- Harrier's Cry
	[472433] = { class = "PRIEST", cd = 90 },  -- Evangelism
}

--------------------------------------------------------------------------------
-- Offensive dispels. Tracked for completeness; never bound to a friendly frame.
--------------------------------------------------------------------------------

SpellDB.purges = {
	[370] = { class = "SHAMAN" },  -- Purge
	[528] = { class = "PRIEST" },  -- Dispel Magic
	[2908] = { class = "DRUID" },  -- Soothe
	[19505] = { class = "WARLOCK" },  -- Devour Magic
	[19801] = { class = "HUNTER" },  -- Tranquilizing Shot
	[30449] = { class = "MAGE" },  -- Spellsteal
	[278326] = { class = "DEMONHUNTER" },  -- Consume Magic
	[378773] = { class = "SHAMAN" },  -- Greater Purge
}

--------------------------------------------------------------------------------
-- Dispels: spell ID -> the debuff types it removes from a friendly target.
-- Boom.Auras derives what the player can cleanse by testing these against
-- IsPlayerSpell, because the game exposes no direct "what can I dispel" API.
--------------------------------------------------------------------------------

SpellDB.dispelSpells = {
	[475] = { Curse = true },  -- Remove Curse
	[527] = { Magic = true },  -- Purify
	[2782] = { Curse = true, Poison = true },  -- Remove Corruption
	[4987] = { Magic = true, Poison = true, Disease = true },  -- Cleanse
	[32375] = { Magic = true },  -- Mass Dispel
	[51886] = { Curse = true },  -- Cleanse Spirit
	[77130] = { Magic = true, Curse = true },  -- Purify Spirit
	[88423] = { Magic = true, Curse = true, Poison = true },  -- Nature's Cure
	[89808] = { Magic = true },  -- Singe Magic
	[115450] = { Magic = true, Poison = true, Disease = true },  -- Detox
	[213634] = { Disease = true },  -- Purify Disease
	[213644] = { Poison = true, Disease = true },  -- Cleanse Toxins
	[218164] = { Poison = true, Disease = true },  -- Detox
	[360823] = { Magic = true, Poison = true },  -- Naturalize
	[374251] = { Bleed = true, Poison = true, Curse = true, Disease = true },  -- Cauterizing Flame
	[383013] = { Poison = true },  -- Poison Cleansing Totem
}

--------------------------------------------------------------------------------
-- Dispel types a spell only removes once a talent is taken. Kept apart from the
-- table above so an untalented player is never told to cleanse something they
-- cannot: spellID -> { [dispelType] = talentSpellID }.
--------------------------------------------------------------------------------

SpellDB.conditionalDispels = {
	[527] = { Disease = 390632 },  -- Purify
}

--------------------------------------------------------------------------------
-- API
--------------------------------------------------------------------------------

function SpellDB:GetSpecEntry(specID)
	return specID and self.specs[specID] or nil
end

--- Every spell of a category for a spec, whether or not the player knows it.
function SpellDB:GetSpells(specID, category)
	local out = {}
	local spec = self:GetSpecEntry(specID)
	if not spec then return out end

	for _, entry in ipairs(spec.spells) do
		if entry.cat == category then
			out[#out + 1] = entry
		end
	end
	return out
end

--- True when this entry can meaningfully be clicked on a friendly unit frame.
function SpellDB:IsBindable(entry)
	return entry and entry.bind ~= false
end

--- The subset of GetSpells the character has actually learned and can bind.
--- This is the filter that makes the one-click preset correct for a fresh
--- character, a respec, or a hero talent swap without any extra bookkeeping.
function SpellDB:GetKnownSpells(specID, category)
	local out = {}
	local spec = self:GetSpecEntry(specID)
	if not spec then return out end

	for _, entry in ipairs(spec.spells) do
		if entry.cat == category and self:IsBindable(entry) and Util.IsPlayerSpell(entry.id) then
			out[#out + 1] = entry
		end
	end
	return out
end

--- Spell used to probe healing range for a spec. Falls back to nil, which makes
--- Engine/Range use UnitInRange instead.
function SpellDB:GetRangeSpell(specID)
	local spec = self:GetSpecEntry(specID)
	return spec and spec.rangeSpell or nil
end

--- True for the cast-once raid-wide buffs. The per-target support indicator
--- skips these: they sit on everybody permanently and would otherwise fill
--- every slot and hide the ones you actually have to maintain.
function SpellDB:IsPermanentBuff(spellID)
	local entry = self.supportBuffs[spellID]
	return entry ~= nil and entry.permanent == true
end

function SpellDB:IsHot(spellID)         return self.hots[spellID] ~= nil end
function SpellDB:IsShield(spellID)      return self.shields[spellID] ~= nil end
function SpellDB:IsExternal(spellID)    return self.externals[spellID] ~= nil end
function SpellDB:IsSupportBuff(spellID) return self.supportBuffs[spellID] ~= nil end
function SpellDB:IsBattleRes(spellID)   return self.battleRes[spellID] ~= nil end

function SpellDB:GetHotPriority(spellID)
	local entry = self.hots[spellID]
	return entry and entry.prio or nil
end

--- Diagnostics for /boom spells: IDs in this database the client does not know.
--- A miss means the game changed an ID, not that the addon is broken - every
--- consumer already skips unresolvable spells.
function SpellDB:GetMissingSpellIDs()
	local missing, seen = {}, {}

	for _, spec in pairs(self.specs) do
		for _, entry in ipairs(spec.spells) do
			if not seen[entry.id] then
				seen[entry.id] = true
				if not Util.SpellExists(entry.id) then
					missing[#missing + 1] = entry.id
				end
			end
		end
	end

	table.sort(missing)
	return missing
end
