# Generated by smithplates HTTP codegen. Do not edit.
from typing import Annotated

from fastapi import (
    APIRouter,
    Body,
    Depends,
    Path,
)
from generated.content_api.content_api.api_response import dispatch_api_response
from generated.content_api.content_api.app_services import ApiServices, get_api_services
from generated.content_api.content_api.operation_bindings import OPERATION_HTTP_BINDINGS
from generated.example.content_output import ContentOutput
from generated.example.create_content_input import CreateContentInput
from pydantic import Field  # noqa: F401

router = APIRouter()


@router.post(
    "/content",
    responses={
        201: {"description": "Response"},
    },
    response_model_by_alias=True,
)
async def create_content(
    services: Annotated[ApiServices, Depends(get_api_services)],
    create_content_input: CreateContentInput = Body(...),
) -> ContentOutput:
    return dispatch_api_response(
        await services.content_api.create_content(create_content_input=create_content_input),
        OPERATION_HTTP_BINDINGS["create_content"],
    )


@router.get(
    "/content/{contentId}",
    responses={
        200: {"description": "Response"},
    },
    response_model_by_alias=True,
)
async def get_content(
    services: Annotated[ApiServices, Depends(get_api_services)],
    content_id: str = Path(..., alias="contentId"),
) -> ContentOutput:
    return dispatch_api_response(
        await services.content_api.get_content(content_id=content_id),
        OPERATION_HTTP_BINDINGS["get_content"],
    )
