"""Skin protocol and registry for dashboard themes."""

from __future__ import annotations

from dataclasses import dataclass


@dataclass(frozen=True)
class Skin:
    """A visual skin for the Observatory dashboard.

    Each skin defines CSS variables, layout rules, and a template file
    that controls the visual presentation without changing data or behavior.
    """

    name: str
    display_name: str
    description: str
    template_file: str
    css_variables: dict[str, str]


_REGISTRY: dict[str, Skin] = {}


def register_skin(skin: Skin) -> None:
    """Register a skin in the global registry."""
    _REGISTRY[skin.name] = skin


def get_skin(name: str) -> Skin | None:
    """Look up a skin by name."""
    return _REGISTRY.get(name)


def list_skins() -> list[Skin]:
    """Return all registered skins."""
    return list(_REGISTRY.values())


def _register_builtins() -> None:
    """Register the three built-in skins."""
    from orxaq.experiences.skins.alpha import ALPHA_SKIN
    from orxaq.experiences.skins.beta import BETA_SKIN
    from orxaq.experiences.skins.gamma import GAMMA_SKIN

    for skin in [GAMMA_SKIN, BETA_SKIN, ALPHA_SKIN]:
        register_skin(skin)


_register_builtins()
