"""Content renderers for the TUI chat panel."""

from __future__ import annotations

from .base import ContentRenderer
from .registry import RendererRegistry
from . import message, tool, thinking, error, markdown_content, plain, diff, status, planning, subagent, todo, turn_meta, summary, filesystem, recall


def default_registry() -> RendererRegistry:
    """Return a registry with all built-in renderers."""
    reg = RendererRegistry()
    reg.register(message.UserMessageRenderer())
    reg.register(message.AssistantMessageRenderer())
    reg.register(thinking.ThinkingRenderer())
    # spawn_agent and todo cards must be checked before the generic tool renderers.
    reg.register(subagent.SpawnAgentStartedRenderer())
    reg.register(subagent.SpawnAgentResultRenderer())
    reg.register(todo.TodoStartedRenderer())
    reg.register(todo.TodoResultRenderer())
    # filesystem-specific renderers must be checked before the generic tool
    # renderers (first accepting renderer wins).
    reg.register(filesystem.FilesystemToolStartedRenderer())
    reg.register(tool.ToolStartedRenderer())
    reg.register(filesystem.FilesystemToolResultRenderer())
    reg.register(tool.ToolResultRenderer())
    reg.register(error.ErrorRenderer())
    reg.register(status.StatusRenderer())
    reg.register(planning.PlanningStatusRenderer())
    reg.register(planning.PlanReadyRenderer())
    reg.register(turn_meta.TurnMetaRenderer())
    reg.register(summary.ContextSummaryRenderer())
    # recall_update lifecycle cards (scheduled/fired/cancelled/…).
    reg.register(recall.RecallRenderer())
    reg.register(markdown_content.MarkdownRenderer())
    reg.register(diff.DiffRenderer())
    reg.register(plain.PlainRenderer())
    return reg


__all__ = [
    "ContentRenderer",
    "RendererRegistry",
    "default_registry",
]
