# 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.ach_holder import AchHolder
from ...types.ach_holder_type import AchHolderType
from ...types.ach_sec_code import AchSecCode
from ...types.achaccount import Achaccount
from ...types.achaccounttype import Achaccounttype
from ...types.achrouting import Achrouting
from ...types.device import Device


class TokenizeAch(UniversalBaseModel):
    method: str = pydantic.Field()
    """
    The type of payment method to tokenize. For ACH, this is always `ach`.
    """

    ach_account: typing_extensions.Annotated[Achaccount, FieldMetadata(alias="achAccount")]
    ach_account_type: typing_extensions.Annotated[Achaccounttype, FieldMetadata(alias="achAccountType")]
    ach_code: typing_extensions.Annotated[typing.Optional[AchSecCode], FieldMetadata(alias="achCode")] = None
    ach_holder: typing_extensions.Annotated[AchHolder, FieldMetadata(alias="achHolder")]
    ach_holder_type: typing_extensions.Annotated[
        typing.Optional[AchHolderType], FieldMetadata(alias="achHolderType")
    ] = None
    ach_routing: typing_extensions.Annotated[Achrouting, FieldMetadata(alias="achRouting")]
    device: typing.Optional[Device] = 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
