"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .links_self import LinksSelf, LinksSelfTypedDict
from pydantic import model_serializer
from train_travel.types import BaseModel, UNSET_SENTINEL
from typing import Dict, List, Literal, Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict


CreateBookingRawXMLSeatPreference = Literal[
    "window",
    "aisle",
    "no_preference",
]
r"""The passenger's preferred seat location."""


class CreateBookingRawXMLResponseBodyTypedDict(TypedDict):
    r"""A booking for a train trip."""

    id: NotRequired[str]
    r"""Unique identifier for the booking"""
    trip_id: NotRequired[str]
    r"""Identifier of the booked trip"""
    passenger_name: NotRequired[str]
    r"""Name of the passenger"""
    has_bicycle: NotRequired[bool]
    r"""Indicates whether the passenger has a bicycle."""
    has_dog: NotRequired[bool]
    r"""Indicates whether the passenger has a dog."""
    seat_preference: NotRequired[CreateBookingRawXMLSeatPreference]
    r"""The passenger's preferred seat location."""
    links: NotRequired[LinksSelfTypedDict]
    r"""The link to the current resource."""


class CreateBookingRawXMLResponseBody(BaseModel):
    r"""A booking for a train trip."""

    id: Optional[str] = None
    r"""Unique identifier for the booking"""

    trip_id: Optional[str] = None
    r"""Identifier of the booked trip"""

    passenger_name: Optional[str] = None
    r"""Name of the passenger"""

    has_bicycle: Optional[bool] = None
    r"""Indicates whether the passenger has a bicycle."""

    has_dog: Optional[bool] = None
    r"""Indicates whether the passenger has a dog."""

    seat_preference: Optional[CreateBookingRawXMLSeatPreference] = "no_preference"
    r"""The passenger's preferred seat location."""

    links: Optional[LinksSelf] = None
    r"""The link to the current resource."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "id",
                "trip_id",
                "passenger_name",
                "has_bicycle",
                "has_dog",
                "seat_preference",
                "links",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


CreateBookingRawSeatPreference = Literal[
    "window",
    "aisle",
    "no_preference",
]
r"""The passenger's preferred seat location."""


class CreateBookingRawResponseBodyTypedDict(TypedDict):
    r"""A booking for a train trip."""

    id: NotRequired[str]
    r"""Unique identifier for the booking"""
    trip_id: NotRequired[str]
    r"""Identifier of the booked trip"""
    passenger_name: NotRequired[str]
    r"""Name of the passenger"""
    has_bicycle: NotRequired[bool]
    r"""Indicates whether the passenger has a bicycle."""
    has_dog: NotRequired[bool]
    r"""Indicates whether the passenger has a dog."""
    seat_preference: NotRequired[CreateBookingRawSeatPreference]
    r"""The passenger's preferred seat location."""
    links: NotRequired[LinksSelfTypedDict]
    r"""The link to the current resource."""


class CreateBookingRawResponseBody(BaseModel):
    r"""A booking for a train trip."""

    id: Optional[str] = None
    r"""Unique identifier for the booking"""

    trip_id: Optional[str] = None
    r"""Identifier of the booked trip"""

    passenger_name: Optional[str] = None
    r"""Name of the passenger"""

    has_bicycle: Optional[bool] = None
    r"""Indicates whether the passenger has a bicycle."""

    has_dog: Optional[bool] = None
    r"""Indicates whether the passenger has a dog."""

    seat_preference: Optional[CreateBookingRawSeatPreference] = "no_preference"
    r"""The passenger's preferred seat location."""

    links: Optional[LinksSelf] = None
    r"""The link to the current resource."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "id",
                "trip_id",
                "passenger_name",
                "has_bicycle",
                "has_dog",
                "seat_preference",
                "links",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


CreateBookingRawResponseResultTypedDict = TypeAliasType(
    "CreateBookingRawResponseResultTypedDict",
    Union[CreateBookingRawResponseBodyTypedDict, bytes],
)


CreateBookingRawResponseResult = TypeAliasType(
    "CreateBookingRawResponseResult", Union[CreateBookingRawResponseBody, bytes]
)


class CreateBookingRawResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: CreateBookingRawResponseResultTypedDict


class CreateBookingRawResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: CreateBookingRawResponseResult
