# Generated by smithplates HTTP codegen. Do not edit.

from __future__ import annotations

from dataclasses import dataclass

from pydantic import BaseModel


@dataclass(frozen=True)
class ResponseVariantBinding:
    status_code: int
    media_type: str | None
    header_bindings: tuple[tuple[str, str], ...]
    static_headers: tuple[tuple[str, str], ...]


@dataclass(frozen=True)
class OperationHttpBinding:
    variants_by_type_name: dict[str, ResponseVariantBinding]

    def variant_for(self, response: BaseModel | None) -> ResponseVariantBinding:
        if response is None:
            binding = self.variants_by_type_name.get(
                "__empty__",
            )
            if binding is None:
                msg = "Service returned None but operation has no empty-response binding"
                raise TypeError(msg)
            return binding
        type_name = type(response).__name__
        binding = self.variants_by_type_name.get(type_name)
        if binding is None:
            msg = f"No HTTP binding registered for response type {type_name!r}"
            raise KeyError(msg)
        return binding


OPERATION_HTTP_BINDINGS: dict[str, OperationHttpBinding] = {
    "assign_shelf_sku": OperationHttpBinding(
        variants_by_type_name={
            "ShelfSkuOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "AssignShelfSku": OperationHttpBinding(
        variants_by_type_name={
            "ShelfSkuOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "create_shelf_item": OperationHttpBinding(
        variants_by_type_name={
            "ShelfItemOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "Conflict": ResponseVariantBinding(
                status_code=409,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "ServiceUnavailable": ResponseVariantBinding(
                status_code=503,
                media_type="application/json",
                header_bindings=(),
                static_headers=(("Content-Type", "application/problem+json"),),
            ),
        },
    ),
    "CreateShelfItem": OperationHttpBinding(
        variants_by_type_name={
            "ShelfItemOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "Conflict": ResponseVariantBinding(
                status_code=409,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "ServiceUnavailable": ResponseVariantBinding(
                status_code=503,
                media_type="application/json",
                header_bindings=(),
                static_headers=(("Content-Type", "application/problem+json"),),
            ),
        },
    ),
}
