# 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 .account_number import AccountNumber
from .bank_account_function import BankAccountFunction
from .bank_account_holder_name import BankAccountHolderName
from .bank_account_holder_type import BankAccountHolderType
from .bank_name import BankName
from .bank_nickname import BankNickname
from .routing_account import RoutingAccount
from .type_account import TypeAccount


class Bank(UniversalBaseModel):
    """
    Object that contains bank account details.
    """

    id: typing.Optional[int] = pydantic.Field(default=None)
    """
    The Payabli-assigned internal identifier for the bank account.
    """

    account_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="accountId")] = pydantic.Field(
        default=None
    )
    """
    A user-defined internal identifier for the bank account. This allows you to specify which bank account should be used for payments in cases where multiple accounts are configured.
    """

    nickname: typing.Optional[BankNickname] = None
    bank_name: typing_extensions.Annotated[typing.Optional[BankName], FieldMetadata(alias="bankName")] = None
    routing_account: typing_extensions.Annotated[
        typing.Optional[RoutingAccount], FieldMetadata(alias="routingAccount")
    ] = None
    account_number: typing_extensions.Annotated[
        typing.Optional[AccountNumber], FieldMetadata(alias="accountNumber")
    ] = None
    type_account: typing_extensions.Annotated[typing.Optional[TypeAccount], FieldMetadata(alias="typeAccount")] = None
    bank_account_holder_name: typing_extensions.Annotated[
        typing.Optional[BankAccountHolderName], FieldMetadata(alias="bankAccountHolderName")
    ] = None
    bank_account_holder_type: typing_extensions.Annotated[
        typing.Optional[BankAccountHolderType], FieldMetadata(alias="bankAccountHolderType")
    ] = None
    bank_account_function: typing_extensions.Annotated[
        typing.Optional[BankAccountFunction], FieldMetadata(alias="bankAccountFunction")
    ] = None
    verified: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Bank account verification status. When `true`, the account has been verified to exist and be in good standing based on vendor checks or previous processing histories.
    """

    status: typing.Optional[int] = pydantic.Field(default=None)
    """
    Bank account status
    """

    services: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Array of services associated with this bank account
    """

    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
