# 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


class RequestTokenStorage(UniversalBaseModel):
    customer_data: typing_extensions.Annotated[
        typing.Optional[PayorDataRequest], FieldMetadata(alias="customerData")
    ] = pydantic.Field(default=None)
    """
    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. 
    """

    entry_point: typing_extensions.Annotated[typing.Optional[Entrypointfield], FieldMetadata(alias="entryPoint")] = (
        pydantic.Field(default=None)
    )
    """
    Entrypoint identifier. Required for POST requests.
    """

    fallback_auth: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="fallbackAuth")] = (
        pydantic.Field(default=None)
    )
    """
    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.
    """

    fallback_auth_amount: typing_extensions.Annotated[
        typing.Optional[int], FieldMetadata(alias="fallbackAuthAmount")
    ] = pydantic.Field(default=None)
    """
    The amount for the `fallbackAuth` transaction. Defaults to one dollar (`100`).
    """

    method_description: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="methodDescription")] = (
        pydantic.Field(default=None)
    )
    """
    Custom description for stored payment method.
    """

    payment_method: typing_extensions.Annotated[
        typing.Optional[RequestTokenStoragePaymentMethod], FieldMetadata(alias="paymentMethod")
    ] = pydantic.Field(default=None)
    """
    Information about the payment method for the transaction.
    """

    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
