"""Code mode renderer - syntax examples and patterns."""

from .base import ModeRenderer
from ..models import Sheet


class CodeRenderer(ModeRenderer):
    """Renderer for code examples with syntax highlighting.

    Displays code examples in wider panels with syntax highlighting,
    optimized for showing language patterns and idioms.
    """

    @property
    def mode(self) -> str:
        return "code"

    def render(
        self,
        sheets: list[Sheet],
        terminal_size: tuple[int, int],
        focus: str | None = None,
    ) -> list:
        """Render code sheets with syntax highlighting.

        TODO: Implement code mode rendering with new Sheet model.
        For now, return a stub message.
        """
        from rich.panel import Panel
        from rich.align import Align

        return [
            Align.center(
                Panel(
                    "[yellow]Code mode not yet implemented[/yellow]\n\n"
                    "Code sheets are loaded but rendering is pending.\n"
                    f"Found {len(sheets)} sheet(s): {', '.join(s.name for s in sheets)}",
                    title="🚧 Under Construction",
                    border_style="yellow",
                    width=60,
                ),
                vertical="middle",
            )
        ]

    def accepts_sheet(self, sheet: Sheet) -> bool:
        """Accept sheets with code mode."""
        return sheet.mode == "code"
