# 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_type import AchHolderType
from ...types.ach_sec_code import AchSecCode
from ...types.bin_data import BinData
from ...types.descriptor import Descriptor
from ...types.holdername import Holdername
from ...types.last_modified import LastModified
from ...types.maskedaccount import Maskedaccount
from .get_method_response_response_data_customers_item import GetMethodResponseResponseDataCustomersItem


class GetMethodResponseResponseData(UniversalBaseModel):
    aba: typing.Optional[str] = pydantic.Field(default=None)
    """
    Bank routing number
    """

    ach_holder_type: typing_extensions.Annotated[
        typing.Optional[AchHolderType], FieldMetadata(alias="achHolderType")
    ] = None
    ach_sec_code: typing_extensions.Annotated[typing.Optional[AchSecCode], FieldMetadata(alias="achSecCode")] = None
    bin: typing.Optional[str] = pydantic.Field(default=None)
    """
    The bank identification number (BIN)
    """

    bin_data: typing_extensions.Annotated[typing.Optional[BinData], FieldMetadata(alias="binData")] = None
    customers: typing.Optional[typing.List[GetMethodResponseResponseDataCustomersItem]] = None
    descriptor: typing.Optional[Descriptor] = None
    exp_date: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="expDate")] = pydantic.Field(
        default=None
    )
    """
    Expiration date for card in stored method in format MM/YY
    """

    holder_name: typing_extensions.Annotated[typing.Optional[Holdername], FieldMetadata(alias="holderName")] = (
        pydantic.Field(default=None)
    )
    """
    Account holder name in stored method
    """

    id_pmethod: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="idPmethod")] = pydantic.Field(
        default=None
    )
    """
    The stored payment method's identifier in Payabli
    """

    last_updated: typing_extensions.Annotated[typing.Optional[LastModified], FieldMetadata(alias="lastUpdated")] = (
        pydantic.Field(default=None)
    )
    """
    Timestamp for last update of stored method, in UTC
    """

    masked_account: typing_extensions.Annotated[
        typing.Optional[Maskedaccount], FieldMetadata(alias="maskedAccount")
    ] = None
    method: typing.Optional[str] = pydantic.Field(default=None)
    """
    The saved method's type: `card` or `ach`. 
    """

    method_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="methodType")] = pydantic.Field(
        default=None
    )
    """
    The payment method's token type
    """

    postal_code: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="postalCode")] = pydantic.Field(
        default=None
    )
    """
    The payment method postal code
    """

    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
