# 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 .bin_data import BinData
from .descriptor import Descriptor
from .holdername import Holdername
from .last_modified import LastModified
from .maskedaccount import Maskedaccount


class MethodQueryRecords(UniversalBaseModel):
    bin: typing.Optional[str] = pydantic.Field(default=None)
    """
    The bank identification number (BIN). Null when method is ACH.
    """

    bin_data: typing_extensions.Annotated[typing.Optional[BinData], FieldMetadata(alias="binData")] = None
    descriptor: typing.Optional[Descriptor] = None
    exp_date: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="expDate")] = pydantic.Field(
        default=None
    )
    """
    Expiration date associated to the method (only for card) in format MMYY.
    """

    holder_name: typing_extensions.Annotated[typing.Optional[Holdername], FieldMetadata(alias="holderName")] = None
    id_pmethod: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="idPmethod")] = pydantic.Field(
        default=None
    )
    """
    Method internal ID
    """

    last_updated: typing_extensions.Annotated[typing.Optional[LastModified], FieldMetadata(alias="lastUpdated")] = (
        pydantic.Field(default=None)
    )
    """
    Date of last update
    """

    masked_account: typing_extensions.Annotated[
        typing.Optional[Maskedaccount], FieldMetadata(alias="maskedAccount")
    ] = None
    method: typing.Optional[str] = pydantic.Field(default=None)
    """
    Type of payment vehicle: **ach** or **card**
    """

    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
