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

from fastapi import (
    APIRouter,
    Body,
    Depends,
    Header,
    Path,
)
from generated.example.item_details import ItemDetails
from generated.example.shelf_item_output import ShelfItemOutput
from generated.example.shelf_sku_output import ShelfSkuOutput
from generated.warehouse_api.warehouse_api.api_response import dispatch_api_response
from generated.warehouse_api.warehouse_api.app_services import ApiServices, get_api_services
from generated.warehouse_api.warehouse_api.operation_bindings import OPERATION_HTTP_BINDINGS
from pydantic import Field  # noqa: F401

router = APIRouter()


@router.post(
    "/shelves/{shelfId}/skus",
    responses={
        201: {"description": "Response"},
    },
    response_model_by_alias=True,
)
async def assign_shelf_sku(
    services: Annotated[ApiServices, Depends(get_api_services)],
    request_id: str | None = Header(None, alias="X-Request-Id"),
    shelf_id: str = Path(..., alias="shelfId"),
    sku: str = Body(...),
) -> ShelfSkuOutput:
    return dispatch_api_response(
        await services.warehouse_api.assign_shelf_sku(
            request_id=request_id,
            shelf_id=shelf_id,
            sku=sku,
        ),
        OPERATION_HTTP_BINDINGS["assign_shelf_sku"],
    )


@router.post(
    "/warehouses/{warehouseId}/shelves/{shelfId}/items",
    responses={
        201: {"description": "Response"},
    },
    response_model_by_alias=True,
)
async def create_shelf_item(
    services: Annotated[ApiServices, Depends(get_api_services)],
    idempotency_key: str | None = Header(None, alias="X-Idempotency-Key"),
    warehouse_id: str = Path(..., alias="warehouseId"),
    shelf_id: str = Path(..., alias="shelfId"),
    details: ItemDetails = Body(...),
) -> ShelfItemOutput:
    return dispatch_api_response(
        await services.warehouse_api.create_shelf_item(
            idempotency_key=idempotency_key,
            warehouse_id=warehouse_id,
            shelf_id=shelf_id,
            details=details,
        ),
        OPERATION_HTTP_BINDINGS["create_shelf_item"],
    )
