local _, pluginShared = ...
pluginShared.RouteData = pluginShared.RouteData or {}
local R = pluginShared.RouteData

-- What must be true before a raid can be entered, keyed by Encounter Journal instance ID. Hand
-- maintained: no Blizzard export lists this, each row is checked against the game's own tables
-- (AreaPOI pins, PlayerCondition, the TravelGuide gateway requirements) when it is added.
--
-- kind = "control": the raid opens only for the faction holding a PvP zone. controlPOI maps the
--   zone's map pins to the faction they announce: Blizzard draws one "Baradin Hold" pin per
--   controlling faction (AreaPOI 2485 "Alliance Controlled", 2486 "Horde Controlled"), so the pin the
--   client shows says who holds Tol Barad. Wintergrasp has no per-faction pin; its holder is read from
--   the zone's PvP status while standing in it.
-- kind = "travel": travel to the raid's zone opens with a campaign quest, any of the listed quests on
--   this character or account-wide (the same quests that unlock the zone's portal in R.GATEWAYS).
--   campaign names the locale key describing the campaign to finish.
-- kind = "quest": the raid door itself opens with a quest.
-- doorQuests (travel and quest rows): the quest(s) that open the raid door once travel is unlocked,
--   any one done opens it; the client supplies the quest's localized title. Filled from the wiki via
--   tools/webgrab-jobs.py gates -> the WebGrab Firefox extension -> tools/webgrab-import.py; a quest
--   ID that was not read from the page is never guessed.
R.GATES = {
    -- controlIcon: the keep cell each faction's control pin draws on Interface\Minimap\POIIcons
    -- (AreaPOI.db2 Icon column, rows 2485/2486); Wintergrasp has no control pin anywhere, so the
    -- same shipped indexes stand in for it
    [75] = { kind = "control", zoneMapID = 244, controlPOI = { [2485] = "Alliance", [2486] = "Horde" }, controlIcon = { Alliance = 46, Horde = 48 } }, -- Baradin Hold, Tol Barad
    [753] = { kind = "control", zoneMapID = 123, controlIcon = { Alliance = 46, Horde = 48 } }, -- Vault of Archavon, Wintergrasp
    [362] = { kind = "travel", zoneMapID = 504, quests = { 32680, 32681 }, campaign = "gate_campaign_isle_of_thunder" }, -- Throne of Thunder
    [1177] = { kind = "quest", zoneMapID = 942, doorQuests = { 53763, 54126 } }, -- Crucible of Storms; "Twist the Knife" ends the Azsharan Medallion questline, Alliance then Horde
    [1180] = { kind = "quest", zoneMapID = 249, doorQuests = { 58506 } }, -- Ny'alotha, the Waking City; "Network Diagnostics" done means Magni offers A Titanic Problem and Zidormi shows the assault phase
    [1193] = { kind = "travel", zoneMapID = 1543, quests = { 60151 }, campaign = "gate_campaign_chains" }, -- Sanctum of Domination, The Maw
    [1195] = { kind = "travel", zoneMapID = 1970, quests = { 64957 }, campaign = "gate_campaign_eternitys_end" }, -- Sepulcher of the First Ones
    [946] = { kind = "travel", zoneMapID = 885, quests = { 48200 }, campaign = "gate_campaign_argus" }, -- Antorus, the Burning Throne; Securing a Foothold places the Antoran Wastes beacon. the guide reaches Argus through the Vindicaar beacon on Krasus' Landing (Data/Routes.lua TRANSITS)
    -- kind = "worldquest": the group's weekly world boss is a world quest; the listed quests (any
    -- one, this character or account) unlock that expansion's world quests. Without them the boss
    -- is invisible to the character. IDs read from warcraft.wiki.gg on 2026-08-30 (Uniting the
    -- Isles; Uniting Kul Tiras / Uniting Zandalar; Moving On (Thaldraszus); Surface Bound).
    -- Shadowlands (1192) has no wiki-named unlock quest (level + covenant), so it carries no row.
    -- perCharacter: those expansions unlock world quests per character, so another character's
    -- account flag does not open them; Surface Bound (1278) grants warband-wide World Quests and
    -- stays account-checked.
    [822] = { kind = "worldquest", zoneMapID = 619, quests = { 43341 }, perCharacter = true }, -- Broken Isles world bosses
    [1028] = { kind = "worldquest", quests = { 51916, 51918 }, perCharacter = true }, -- Battle for Azeroth world bosses, either faction's quest
    [1205] = { kind = "worldquest", quests = { 66221 }, perCharacter = true }, -- Dragon Isles world bosses
    [1278] = { kind = "worldquest", quests = { 79197 } }, -- Khaz Algar world bosses
    [1179] = { kind = "travel", zoneMapID = 1355, quests = { 54972, 55053 }, campaign = "gate_campaign_nazjatar" }, -- The Eternal Palace; the Nazjatar portal quests, Alliance then Horde
    [1207] = { kind = "travel", zoneMapID = 2200, quests = { 76318, 76326 }, campaign = "gate_campaign_guardians_of_the_dream" }, -- Amirdrassil, the Dream's Hope; either Emerald Dream portal quest
    [1273] = { kind = "travel", zoneMapID = 2255, quests = { 78248 }, campaign = "gate_campaign_war_within" }, -- Nerub-ar Palace, Azj-Kahet
    [1296] = { kind = "travel", zoneMapID = 2346, quests = { 83151, 86535, 83933 }, campaign = "gate_campaign_undermine" }, -- Liberation of Undermine; Dornogal teleporter, Down Undermine, Zandalar rocket drill
    [1302] = { kind = "travel", zoneMapID = 2371, quests = { 84957 }, campaign = "gate_campaign_karesh", doorQuests = { 84910 } }, -- Manaforge Omega, K'aresh; The Tabiqa grants the Reshii Wraps the door needs
    [1305] = { kind = "travel", zoneMapID = 2413, quests = { 86899, 86898 }, campaign = "gate_campaign_midnight" }, -- Sporefall, Harandar
    [1307] = { kind = "travel", zoneMapID = 2405, quests = { 86522, 86549 }, campaign = "gate_campaign_midnight" }, -- The Voidspire, Voidstorm
    [1308] = { kind = "travel", zoneMapID = 2424, quests = { 86522, 86549 }, campaign = "gate_campaign_midnight" }, -- March on Quel'Danas
    [1314] = { kind = "travel", zoneMapID = 2413, quests = { 86899, 86898 }, campaign = "gate_campaign_midnight" }, -- The Dreamrift, Harandar
}

-- A single boss gated inside an otherwise free group, keyed by Encounter Journal encounter ID.
-- quests: any one done (this character or account) opens the boss.
R.BOSS_GATES = {
    -- Ordos still requires a Mists legendary cloak on retail: "He may only be accessed by players
    -- who own one of the legendary cloaks" (warcraft.wiki.gg/wiki/Ordos, read 2026-08-30; ATT
    -- records the same sourceQuest). 33104 = A Pandaren Legend, the cloak questline's end.
    [861] = { quests = { 33104 } }, -- Ordos, Fire-God of the Yaungol, Timeless Isle
}
