"""
Theme definitions with color gradients for terminal rendering.

This module is data-only and does not import config or render
to prevent circular dependencies.
"""


class Theme:
    """Represents a color theme with two gradients."""

    def __init__(self, name, main_gradient, message_gradient):
        """Initialize a theme with name and color gradients.

        Args:
            name: Theme identifier string
            main_gradient: List of 12 ANSI 256-color codes for main gradient
            message_gradient: List of 12 ANSI 256-color codes for message gradient
        """
        self.name = name
        self.main_gradient = main_gradient
        self.message_gradient = message_gradient


# ─── GRADIENT DEFINITIONS ─────────────────────────────────────────────────
# Each gradient is 12 ANSI 256-color codes in sequence
# Format: [light...] → [medium...] → [dark...] → [black]

_GREEN_MAIN = [231, 195, 123, 118, 82, 46, 40, 34, 28, 22, 22, 235]
_GREEN_MSG = [231, 225, 219, 213, 207, 201, 165, 161, 125, 89, 89, 235]

_ORANGE_MAIN = [231, 215, 209, 208, 202, 166, 130, 94, 58, 94, 94, 235]
_ORANGE_MSG = [231, 195, 33, 27, 21, 21, 21, 18, 18, 18, 18, 235]

_PURPLE_MAIN = [231, 225, 177, 171, 165, 135, 129, 93, 57, 57, 57, 235]
_PURPLE_MSG = [231, 226, 226, 220, 220, 184, 184, 178, 178, 172, 172, 235]


# ─── THEME REGISTRY ───────────────────────────────────────────────────────

THEME_REGISTRY = {
    "green": Theme("green", _GREEN_MAIN, _GREEN_MSG),
    "orange": Theme("orange", _ORANGE_MAIN, _ORANGE_MSG),
    "purple": Theme("purple", _PURPLE_MAIN, _PURPLE_MSG),
}


def get_theme(theme_id):
    """Retrieve a theme by ID.

    Args:
        theme_id: Theme identifier string

    Returns:
        Theme object matching the ID

    Raises:
        KeyError: If theme_id is not in registry
    """
    return THEME_REGISTRY[theme_id]
