# 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] = {
    "get_category": OperationHttpBinding(
        variants_by_type_name={
            "GetCategoryOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "CategoryNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "GetCategory": OperationHttpBinding(
        variants_by_type_name={
            "GetCategoryOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "CategoryNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "health_check": OperationHttpBinding(
        variants_by_type_name={
            "HealthCheckOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(("Cache-Control", "no-store"),),
            ),
        },
    ),
    "HealthCheck": OperationHttpBinding(
        variants_by_type_name={
            "HealthCheckOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(("Cache-Control", "no-store"),),
            ),
        },
    ),
    "get_order": OperationHttpBinding(
        variants_by_type_name={
            "GetOrderOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "OrderNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "GetOrder": OperationHttpBinding(
        variants_by_type_name={
            "GetOrderOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "OrderNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "place_order": OperationHttpBinding(
        variants_by_type_name={
            "PlaceOrderOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "ValidationError": ResponseVariantBinding(
                status_code=400,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "PlaceOrder": OperationHttpBinding(
        variants_by_type_name={
            "PlaceOrderOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "ValidationError": ResponseVariantBinding(
                status_code=400,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "create_pet": OperationHttpBinding(
        variants_by_type_name={
            "CreatePetOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(("etag", "ETag"),),
                static_headers=(),
            ),
            "ValidationError": ResponseVariantBinding(
                status_code=400,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "CreatePet": OperationHttpBinding(
        variants_by_type_name={
            "CreatePetOutput": ResponseVariantBinding(
                status_code=201,
                media_type="application/json",
                header_bindings=(("etag", "ETag"),),
                static_headers=(),
            ),
            "ValidationError": ResponseVariantBinding(
                status_code=400,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "delete_pet": OperationHttpBinding(
        variants_by_type_name={
            "__empty__": ResponseVariantBinding(
                status_code=204,
                media_type=None,
                header_bindings=(),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "DeletePet": OperationHttpBinding(
        variants_by_type_name={
            "__empty__": ResponseVariantBinding(
                status_code=204,
                media_type=None,
                header_bindings=(),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "get_pet": OperationHttpBinding(
        variants_by_type_name={
            "GetPetOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "GetPet": OperationHttpBinding(
        variants_by_type_name={
            "GetPetOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "pet_events": OperationHttpBinding(
        variants_by_type_name={
            "PetEventsOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "PetEvents": OperationHttpBinding(
        variants_by_type_name={
            "PetEventsOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "resolve_pet_location": OperationHttpBinding(
        variants_by_type_name={
            "PetLocationRedirect": ResponseVariantBinding(
                status_code=302,
                media_type=None,
                header_bindings=(("url", "Location"),),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "ResolvePetLocation": OperationHttpBinding(
        variants_by_type_name={
            "PetLocationRedirect": ResponseVariantBinding(
                status_code=302,
                media_type=None,
                header_bindings=(("url", "Location"),),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "update_pet": OperationHttpBinding(
        variants_by_type_name={
            "UpdatePetOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "ValidationError": ResponseVariantBinding(
                status_code=400,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
    "UpdatePet": OperationHttpBinding(
        variants_by_type_name={
            "UpdatePetOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "PetNotFound": ResponseVariantBinding(
                status_code=404,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
            "ValidationError": ResponseVariantBinding(
                status_code=400,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
    ),
}
