"""SSE streaming routes.

⚠️ AUTO-GENERATED BY PRISM - DO NOT EDIT
"""

from __future__ import annotations

from fastapi import APIRouter, Query, Request

from .sse_handler import create_sse_response

router = APIRouter(prefix="{{ sse_path }}", tags=["streaming"])


@router.get(
    "/events",
    summary="Stream all model events via SSE",
    description="Subscribe to real-time CRUD events for all models.",
)
async def stream_all_events(
    request: Request,
    event_types: list[str] | None = Query(
        default=None,
        description="Filter by event type (created, updated, deleted)",
    ),
) -> None:
    """Stream all model events."""
    return create_sse_response(request, event_types=event_types)
{% for model_name in model_names %}


@router.get(
    "/{{ model_name | lower }}/events",
    summary="Stream {{ model_name }} events via SSE",
    description="Subscribe to real-time CRUD events for {{ model_name }}.",
)
async def stream_{{ model_name | lower }}_events(
    request: Request,
    event_types: list[str] | None = Query(
        default=None,
        description="Filter by event type (created, updated, deleted)",
    ),
) -> None:
    """Stream {{ model_name }} events."""
    return create_sse_response(
        request,
        model="{{ model_name }}",
        event_types=event_types,
    )
{% endfor %}


__all__ = ["router"]
