"""Renderer for thinking/reasoning blocks."""

from __future__ import annotations

from rich.console import RenderableType
from rich.box import ROUNDED
from rich.panel import Panel
from rich.text import Text

from clients.terminal.tui.themes import get_active_theme

from .base import ContentRenderer


class ThinkingRenderer(ContentRenderer):
    """Render a complete thinking block."""

    def accepts(self, msg: dict) -> bool:
        return msg.get("type") == "thinking_block"

    def render(self, msg: dict) -> RenderableType:
        theme = get_active_theme()
        text = msg.get("content", "")
        return Panel(
            Text(text, style=theme.text_dim.hex),
            title="thinking",
            title_align="left",
            border_style=theme.thinking.hex,
            box=ROUNDED,
        )
