-- ============================================================================
-- ERT (Enhanced Rare Tracker) — Seed Rare Metadata
-- ============================================================================
-- This is the SEED roster: it enriches rares we already know with respawn
-- WINDOWS, a spawn MODEL, and a confidence tier. It is NOT the list of what the
-- tracker can follow — the Observer records ANY rare you encounter in the open
-- world, in any expansion, with no entry here (it learns the window empirically
-- from GUID spawn-time + death observations). This table only seeds projection
-- and lets us flag the awkward model classes the research called out.
--
-- Window values are SECONDS as {earliest, modal, latest}. They are deliberately
-- ranges, not points — a single exact respawn is false precision (honest data
-- over wrong data). Observed intervals, once collected, override these.
--
-- model: fixed_window | shared_pool | event_gated | summoned | phased
-- confidence: high | medium | low   (how much to trust the seed window)
-- ============================================================================

local ADDON_NAME, NS = ...
local ETB = NS.ETB
local ERT = ETB.ERT or {}
ETB.ERT = ERT

local M = 60  -- minutes → seconds

-- Lazy-loaded; materialized on first access by the Observer.
ERT._RareDataLoader = function()
    ERT._RareDataLoader = nil
    ERT.RareData = {

        -- ---- MoP · Valley of the Four Winds (fixed-window cohort, ~45–60m) ----
        -- Research consensus: base Pandaria champions cluster ~45–60m with a tail
        -- to ~90m; treat as a window, not RareTimer's exact 30/45/117.5 points.
        [50356] = { name = "Krol the Blade",   exp = "MoP", model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "medium" },
        [50339] = { name = "Sulik'shor",       exp = "MoP", model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "medium" },
        [50351] = { name = "Jonn-Dar",         exp = "MoP", model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "low"    },
        [50766] = { name = "Sele'na",          exp = "MoP", model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "low"    },
        [50364] = { name = "Nal'lak the Ripper",exp = "MoP",model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "low"    },
        [50783] = { name = "Salyin Warscout",  exp = "MoP", model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "low"    },
        [50811] = { name = "Nasra Spothide",   exp = "MoP", model = "fixed_window", window = {45*M, 60*M, 90*M}, confidence = "low"    },

        -- ---- MoP · Vale of Eternal Blossoms (phased until Golden Lotus intro) --
        -- Suppress projection while phased-out: the player may simply be unable to
        -- see the spawn, which is not the same as "not up".
        [50780] = { name = "Sahn Tidehunter",  exp = "MoP", model = "phased", window = {45*M, 60*M, 90*M}, confidence = "low", phaseNote = "Golden Lotus intro" },

        -- ---- MoP · Isle of Thunder (summoned / item-gated, NOT a death timer) --
        -- These need a Shan'ze Ritual Stone / Incantation; show the trigger, never
        -- a countdown.

        -- ---- MoP · Timeless Isle (mixed; Huolon is a patrol farm rare) ---------
        [73167] = { name = "Huolon",           exp = "MoP", model = "fixed_window", window = {25*M, 40*M, 60*M}, confidence = "medium" },
        [72970] = { name = "Golganarr",        exp = "MoP", model = "fixed_window", window = {2*60*M, 4*60*M, 6*60*M}, confidence = "low", note = "explicitly long" },

        -- ---- Wrath · The Storm Peaks (shared pool — the canonical hard case) ---
        -- TLPD and Vyragosa draw from ONE pool: a Vyragosa kill resets the same
        -- window. Model by poolID, not per-npc. ETB already tracks TLPD in EMT.
        [32491] = { name = "Time-Lost Proto-Drake", exp = "Wrath", model = "shared_pool", poolID = "tlpd_vyra", window = {6*60*M, 14*60*M, 22*60*M}, confidence = "low" },
        [32630] = { name = "Vyragosa",         exp = "Wrath", model = "shared_pool", poolID = "tlpd_vyra", window = {6*60*M, 14*60*M, 22*60*M}, confidence = "low" },
    }

    -- Pool membership (shared_pool rares): killing any member resets the pool.
    ERT.RarePools = {
        tlpd_vyra = { 32491, 32630 },
    }
end

-- Default window used when a rare has no seed entry and not enough observed
-- intervals yet — a broad, low-confidence guess so the UI never implies precision.
ERT.DEFAULT_WINDOW = { 30*M, 60*M, 120*M }
