# 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"), pydantic.Field(alias="binData")
    ] = None
    descriptor: typing.Optional[Descriptor] = None
    exp_date: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="expDate"),
        pydantic.Field(
            alias="expDate", description="Expiration date associated to the method (only for card) in format MMYY."
        ),
    ] = None
    holder_name: typing_extensions.Annotated[
        typing.Optional[Holdername], FieldMetadata(alias="holderName"), pydantic.Field(alias="holderName")
    ] = None
    id_pmethod: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="idPmethod"),
        pydantic.Field(alias="idPmethod", description="Method internal ID"),
    ] = None
    last_updated: typing_extensions.Annotated[
        typing.Optional[LastModified],
        FieldMetadata(alias="lastUpdated"),
        pydantic.Field(alias="lastUpdated", description="Date of last update"),
    ] = None
    masked_account: typing_extensions.Annotated[
        typing.Optional[Maskedaccount], FieldMetadata(alias="maskedAccount"), pydantic.Field(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
