# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from ...types.entrypointfield import Entrypointfield
from ...types.payor_data_request import PayorDataRequest
from ...types.source import Source
from ...types.subdomain import Subdomain
from .request_token_storage_payment_method import RequestTokenStoragePaymentMethod
from .vendor_data_request import VendorDataRequest


class RequestTokenStorage(UniversalBaseModel):
    customer_data: typing_extensions.Annotated[
        typing.Optional[PayorDataRequest],
        FieldMetadata(alias="customerData"),
        pydantic.Field(
            alias="customerData",
            description="Object describing the Customer/Payor owner of payment method. Required for POST requests. Which fields are required depends on the paypoint's custom identifier settings. ",
        ),
    ] = None
    entry_point: typing_extensions.Annotated[
        typing.Optional[Entrypointfield],
        FieldMetadata(alias="entryPoint"),
        pydantic.Field(alias="entryPoint", description="Entrypoint identifier. Required for POST requests."),
    ] = None
    fallback_auth: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="fallbackAuth"),
        pydantic.Field(
            alias="fallbackAuth",
            description="When `true`, if tokenization fails, Payabli will attempt an authorization transaction to request a permanent token for the card. If the authorization is successful, the card will be tokenized and the authorization will be voided automatically.",
        ),
    ] = None
    fallback_auth_amount: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="fallbackAuthAmount"),
        pydantic.Field(
            alias="fallbackAuthAmount",
            description="The amount for the `fallbackAuth` transaction. Defaults to one dollar (`100`).",
        ),
    ] = None
    method_description: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="methodDescription"),
        pydantic.Field(alias="methodDescription", description="Custom description for stored payment method."),
    ] = None
    payment_method: typing_extensions.Annotated[
        typing.Optional[RequestTokenStoragePaymentMethod],
        FieldMetadata(alias="paymentMethod"),
        pydantic.Field(alias="paymentMethod", description="Information about the payment method for the transaction."),
    ] = None
    vendor_data: typing_extensions.Annotated[
        typing.Optional[VendorDataRequest], FieldMetadata(alias="vendorData"), pydantic.Field(alias="vendorData")
    ] = None
    source: typing.Optional[Source] = pydantic.Field(default=None)
    """
    Custom identifier to indicate the source for the request
    """

    subdomain: typing.Optional[Subdomain] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
