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

from __future__ import annotations
from enum import Enum
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class Kind(str, Enum):
    r"""The type of receipt being requested."""

    SALE_CUSTOMER_V1 = "sale.customer.v1"


class ReceiptRequestTypedDict(TypedDict):
    r"""A receipt request for a specific transfer, schedule, or schedule occurrence."""

    kind: Kind
    email: NotRequired[str]
    r"""The email address to send the receipt to.
    Either email or emailAccountID must be provided, but not both.
    """
    email_account_id: NotRequired[str]
    r"""The accountID to send the receipt to.
    Either email or emailAccountID must be provided, but not both.
    """
    for_transfer_id: NotRequired[str]
    r"""The ID of the transfer associated with this receipt.
    Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided.
    """
    for_schedule_id: NotRequired[str]
    r"""The ID of the schedule associated with this receipt.
    Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided.
    """
    for_occurrence_id: NotRequired[str]
    r"""The ID of the schedule occurrence associated with this receipt.
    Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided.
    """


class ReceiptRequest(BaseModel):
    r"""A receipt request for a specific transfer, schedule, or schedule occurrence."""

    kind: Kind

    email: Optional[str] = None
    r"""The email address to send the receipt to.
    Either email or emailAccountID must be provided, but not both.
    """

    email_account_id: Annotated[
        Optional[str], pydantic.Field(alias="emailAccountID")
    ] = None
    r"""The accountID to send the receipt to.
    Either email or emailAccountID must be provided, but not both.
    """

    for_transfer_id: Annotated[Optional[str], pydantic.Field(alias="forTransferID")] = (
        None
    )
    r"""The ID of the transfer associated with this receipt.
    Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided.
    """

    for_schedule_id: Annotated[Optional[str], pydantic.Field(alias="forScheduleID")] = (
        None
    )
    r"""The ID of the schedule associated with this receipt.
    Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided.
    """

    for_occurrence_id: Annotated[
        Optional[str], pydantic.Field(alias="forOccurrenceID")
    ] = None
    r"""The ID of the schedule occurrence associated with this receipt.
    Exactly one of forTransferID, forScheduleID, or forOccurrenceID must be provided.
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "email",
                "emailAccountID",
                "forTransferID",
                "forScheduleID",
                "forOccurrenceID",
            ]
        )
        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:
    ReceiptRequest.model_rebuild()
except NameError:
    pass
