"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 6b9d462139d1

from __future__ import annotations
from .amount import Amount, AmountTypedDict
from .route_destination_type import RouteDestinationType
from mollie.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class RouteCreateRequestDestinationTypedDict(TypedDict):
    r"""The destination of the route."""

    type: RouteDestinationType
    r"""The type of destination. Currently only the destination type `organization` is supported."""
    organization_id: str


class RouteCreateRequestDestination(BaseModel):
    r"""The destination of the route."""

    type: RouteDestinationType
    r"""The type of destination. Currently only the destination type `organization` is supported."""

    organization_id: Annotated[str, pydantic.Field(alias="organizationId")]


class RouteCreateRequestTypedDict(TypedDict):
    r"""Payload to create a new delayed route for a payment."""

    amount: AmountTypedDict
    r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
    destination: RouteCreateRequestDestinationTypedDict
    r"""The destination of the route."""
    description: NotRequired[str]
    r"""Description shown in reports."""


class RouteCreateRequest(BaseModel):
    r"""Payload to create a new delayed route for a payment."""

    amount: Amount
    r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""

    destination: RouteCreateRequestDestination
    r"""The destination of the route."""

    description: Optional[str] = None
    r"""Description shown in reports."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["description"])
        serialized = handler(self)
        m = {}

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

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

        return m


try:
    RouteCreateRequestDestination.model_rebuild()
except NameError:
    pass
