"""Fallback plain text renderer."""

from __future__ import annotations

from rich.console import RenderableType
from rich.text import Text

from clients.terminal.tui.themes import get_active_theme

from .base import ContentRenderer


class PlainRenderer(ContentRenderer):
    """Render any event as plain text; always accepts as fallback."""

    def accepts(self, msg: dict) -> bool:
        return True

    def render(self, msg: dict) -> RenderableType:
        theme = get_active_theme()
        text = msg.get("content", "") or str(msg)
        return Text(text, style=theme.text.hex)
