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

from fastapi import (
    APIRouter,
    Depends,
    Path,
    Query,
)
from generated.example.item_api.api_response import dispatch_api_response
from generated.example.item_api.app_services import ApiServices, get_api_services
from generated.example.item_api.operation_bindings import OPERATION_HTTP_BINDINGS
from generated.example.item_kind import ItemKind
from generated.example.item_list_output import ItemListOutput
from generated.example.item_output import ItemOutput
from generated.example.item_priority import ItemPriority
from pydantic import Field  # noqa: F401

router = APIRouter()


@router.get(
    "/items/{itemId}",
    responses={
        200: {"description": "Response"},
    },
    response_model_by_alias=True,
)
async def get_item(
    services: Annotated[ApiServices, Depends(get_api_services)],
    item_id: str = Path(..., alias="itemId"),
) -> ItemOutput:
    return dispatch_api_response(
        await services.items_api.get_item(item_id=item_id),
        OPERATION_HTTP_BINDINGS["get_item"],
    )


@router.get(
    "/items",
    responses={
        200: {"description": "Response"},
    },
    response_model_by_alias=True,
)
async def list_items(
    services: Annotated[ApiServices, Depends(get_api_services)],
    kind: ItemKind | None = Query(None, alias="kind"),
    priority: ItemPriority | None = Query(None, alias="priority"),
) -> ItemListOutput:
    return dispatch_api_response(
        await services.items_api.list_items(kind=kind, priority=priority),
        OPERATION_HTTP_BINDINGS["list_items"],
    )
