"""Film Noir theme configuration.

The default (and only) theme for v1. Features:
- Dark background with muted golds/ambers for accents
- High contrast text (cream on dark)
- Themed command aliases (detective vocabulary)
- Film noir vocabulary for game terms
"""

from pathlib import Path

from unfamiliar.tui.themes.base import NarrativeConfig, ThemeConfig

# Path to the TCSS stylesheet (same directory as this file)
_THEME_DIR = Path(__file__).parent

# Command aliases: canonical -> themed
# From requirements §7 command table
_COMMAND_ALIASES: dict[str, str] = {
    "next": "investigate",
    "complete": "file report",
    "status": "case board",
    "briefing": "case file",
    "mission": "lead",
    "notebook": "case notes",
    "unlock": "break in",
    "help": "call in a marker",
    "quit": "bury the day",
    "end campaign": "close the case",
    "reopen": "cold case",
}

# Vocabulary: canonical term -> themed term
# From requirements §7 theme architecture
_VOCABULARY: dict[str, str] = {
    "mission": "lead",
    "missions": "leads",
    "chain": "case thread",
    "chains": "case threads",
    "campaign": "case",
    "campaigns": "cases",
    "category": "precinct",
    "categories": "precincts",
    "complete": "close",
    "completed": "closed",
    "available": "open",
    "locked": "sealed",
    "in_progress": "active",
    "prerequisite": "lead-up",
    "prerequisites": "lead-ups",
    "file_ref": "evidence",
    "file_refs": "evidence",
    "cancel": "never mind",
    "application": "investigation",
    "stay": "stay on the case",
}

# Colors: semantic name -> hex code
_COLORS: dict[str, str] = {
    "accent": "#c9a227",
    "accent_dim": "#8b7019",
    "accent_bright": "#e6b82a",
    "text": "#e8e4d9",
    "text_muted": "#8a8678",
    "text_dim": "#5a574d",
    "error": "#8b3a3a",
    "divider": "#3d3d45",
    "success": "#4a7c4e",
    "warning": "#8b6914",
    "info": "#3a5a8b",
}

# Decorations: visual elements for UI styling
_DECORATIONS: dict[str, str] = {
    "divider": "━━━✦━━━",
    "divider_heavy": "━" * 20,
    "bullet": "•",
    "section_separator": "─" * 20,
}

# Icons: status indicators for missions
_ICONS: dict[str, str] = {
    "available": "○",
    "completed": "●",
    "locked": "🔒",
    "in_progress": "◈",
    "warning": "⚡",
    "error": "✗",
}

# Narrative configuration for LLM prompt injection
_NARRATIVE = NarrativeConfig(
    tone=(
        "Film Noir detective investigation. Moody, atmospheric, hardboiled. "
        "The developer is a detective investigating an unfamiliar codebase."
    ),
    title_examples=[
        "The Password Vault",
        "Shadows in the Login Flow",
        "Following the Data Trail",
        "The Dead Drop in the Config",
        "Stakeout on the Event Loop",
    ],
    intro_style=(
        "Set a moody, investigative tone. The detective discovers a new lead, "
        "finds a clue, or gets a tip from an informant."
    ),
    outro_style=(
        "Provide closure like a case being solved. The detective pieces together "
        "what they've learned, connecting it to the bigger picture."
    ),
)

FILM_NOIR_THEME = ThemeConfig(
    name="film_noir",
    display_name="Film Noir",
    css_path=_THEME_DIR / "noir.tcss",
    aliases=_COMMAND_ALIASES,
    vocabulary=_VOCABULARY,
    narrative=_NARRATIVE,
    colors=_COLORS,
    decorations=_DECORATIONS,
    icons=_ICONS,
)

__all__ = ["FILM_NOIR_THEME"]
