from http import HTTPMethod

from edri.api.dataclass.api_event import api
from edri.dataclass.response import Response, response
from edri.events.api.group import Client


@response
class DocumentationResponse(Response):
    """
    Response wrapper for the API documentation endpoint.
    """
    api_resources: dict
    wrapped: bool


@api(url="/edri/docs", resource="edri-docs", method=HTTPMethod.GET, template="documentation.j2")
class EdriDocumentation(Client):
    """
    Serves the complete **API documentation page**.

    This endpoint may provide:
    - A **human-readable HTML representation** of all available API endpoints.
    - Endpoint **access methods** (HTTP, WebSocket).
    - **Parameters** and **cookies** supported by each endpoint.

    ### How It Works
    The content is **autogenerated** and reflects the real-time structure
    of registered API resources. This ensures the documentation always stays up-to-date.
    """
    response: DocumentationResponse
