"""Centralized model pool for EB1 ensembles.

Single source of truth for model identifiers and default parameters.
To upgrade a model, change the constant here -- all plans update automatically.
"""

from __future__ import annotations

from collections.abc import Mapping, Sequence
from typing import TypeAlias

JSONPrimitive: TypeAlias = str | int | float | bool | None
JSON: TypeAlias = JSONPrimitive | Mapping[str, "JSON"] | Sequence["JSON"]

# -- Model IDs (SSOT) ---------------------------------------------------------

CLAUDE_OPUS = "claude-opus-4-6"
CLAUDE_OPUS_PREV = "claude-opus-4-5-20251101"
CLAUDE_OPUS_4_1 = "claude-opus-4-1-20250805"
CLAUDE_SONNET = "claude-sonnet-4-5-20250929"
CLAUDE_HAIKU = "claude-haiku-4-5-20251001"

GPT_5_2 = "gpt-5.2"
GPT_5_2_PRO = "gpt-5.2-pro"
GPT_5_2_CODEX = "gpt-5.2-codex"
GPT_5_1_CODEX_MAX = "gpt-5.1-codex-max"

GEMINI_PRO = "gemini-3.1-pro-preview"
GEMINI_FLASH = "gemini-3-flash-preview"

# -- Fast mode (Anthropic Opus only) ------------------------------------------

FAST_MODE_BETA = "fast-mode-2026-02-01"

# -- Reasoning param presets ---------------------------------------------------

CLAUDE_REASONING_HIGH: Mapping[str, JSON] = {"reasoning": {"effort": "high"}}
CLAUDE_REASONING_XHIGH: Mapping[str, JSON] = {"reasoning": {"effort": "xhigh"}}

GPT_REASONING_HIGH: Mapping[str, JSON] = {"reasoning": {"effort": "high"}}
GPT_REASONING_XHIGH: Mapping[str, JSON] = {"reasoning": {"effort": "xhigh"}}

# -- Fast mode params (Anthropic Opus only) ------------------------------------

CLAUDE_FAST_HIGH: Mapping[str, JSON] = {
    "reasoning": {"effort": "high"},
    "speed": "fast",
    "betas": [FAST_MODE_BETA],
}
CLAUDE_FAST_XHIGH: Mapping[str, JSON] = {
    "reasoning": {"effort": "xhigh"},
    "speed": "fast",
    "betas": [FAST_MODE_BETA],
}

# -- GNN label-to-model-ID mapping -------------------------------------------
# Labels must match LLM_Descriptions.json (the GNN training set).
# Model IDs must exist in pricing.yaml.
# Canonical model IDs pass through via .get(label, label) — no entry needed.

GNN_LABEL_TO_MODEL_ID: dict[str, str] = {
    # v3 GNN training set (LLM_Descriptions_v3.json labels)
    "Gemini 2.5 Flash Lite": "gemini-2.5-flash-lite",
    "Claude Haiku 4.5": CLAUDE_HAIKU,
    "GPT-5 Nano": "gpt-5-nano",
    "GPT-5.2": GPT_5_2,
    "GPT-5.2 Codex": GPT_5_2_CODEX,
    "Claude Opus 4.6": CLAUDE_OPUS,
    "Gemini 3 Flash Preview": GEMINI_FLASH,
    "Gemini 3.1 Pro Preview": GEMINI_PRO,
    # Legacy aliases for v15/v14/12-27 checkpoint backward compatibility.
    "GPT-5.1": "gpt-5.1",
    "GPT-5.1 Codex": "gpt-5.1-codex",
    "Claude Opus 4.5": CLAUDE_OPUS,
    "Gemini 3 Pro Preview": GEMINI_PRO,
}
