# Generated by smithplates HTTP codegen. Do not edit.

from __future__ import annotations

from dataclasses import dataclass


@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 ClientOperationHttpBinding:
    variants_by_type_name: dict[str, ResponseVariantBinding]
    variants_by_status: dict[int, str]

    def variant_for_status(self, status_code: int) -> ResponseVariantBinding:
        type_name = self.variants_by_status.get(status_code)
        if type_name is None:
            msg = f"No HTTP binding registered for response status {status_code}"
            raise KeyError(msg)
        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

    def type_name_for_status(self, status_code: int) -> str:
        type_name = self.variants_by_status.get(status_code)
        if type_name is None:
            msg = f"No HTTP binding registered for response status {status_code}"
            raise KeyError(msg)
        return type_name


OPERATION_HTTP_BINDINGS: dict[str, ClientOperationHttpBinding] = {
    "chat_stream": ClientOperationHttpBinding(
        variants_by_type_name={
            "ServerMessage": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
        variants_by_status={
            200: "ServerMessage",
        },
    ),
    "ChatStream": ClientOperationHttpBinding(
        variants_by_type_name={
            "ServerMessage": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
        variants_by_status={
            200: "ServerMessage",
        },
    ),
    "list_rooms": ClientOperationHttpBinding(
        variants_by_type_name={
            "RoomListOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
        variants_by_status={
            200: "RoomListOutput",
        },
    ),
    "ListRooms": ClientOperationHttpBinding(
        variants_by_type_name={
            "RoomListOutput": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
        variants_by_status={
            200: "RoomListOutput",
        },
    ),
    "send_room_message": ClientOperationHttpBinding(
        variants_by_type_name={
            "ServerMessage": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
        variants_by_status={
            200: "ServerMessage",
        },
    ),
    "SendRoomMessage": ClientOperationHttpBinding(
        variants_by_type_name={
            "ServerMessage": ResponseVariantBinding(
                status_code=200,
                media_type="application/json",
                header_bindings=(),
                static_headers=(),
            ),
        },
        variants_by_status={
            200: "ServerMessage",
        },
    ),
}
