"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 6ec048477f9b

from __future__ import annotations
from .account_number_format_response import AccountNumberFormatResponse
from mollie import models
from mollie.types import BaseModel
import pydantic
from pydantic import field_serializer
from typing_extensions import Annotated, TypedDict


class CreditorBankAccountResponseTypedDict(TypedDict):
    r"""The bank account details of the creditor (recipient) for Verification of Payee."""

    account_holder_name: str
    r"""The full name of the creditor account holder to verify against bank records."""
    format_: AccountNumberFormatResponse
    r"""The format of the account number."""
    account_number: str
    r"""The bank account details of the creditor."""


class CreditorBankAccountResponse(BaseModel):
    r"""The bank account details of the creditor (recipient) for Verification of Payee."""

    account_holder_name: Annotated[str, pydantic.Field(alias="accountHolderName")]
    r"""The full name of the creditor account holder to verify against bank records."""

    format_: Annotated[AccountNumberFormatResponse, pydantic.Field(alias="format")]
    r"""The format of the account number."""

    account_number: Annotated[str, pydantic.Field(alias="accountNumber")]
    r"""The bank account details of the creditor."""

    @field_serializer("format_")
    def serialize_format_(self, value):
        if isinstance(value, str):
            try:
                return models.AccountNumberFormatResponse(value)
            except ValueError:
                return value
        return value


try:
    CreditorBankAccountResponse.model_rebuild()
except NameError:
    pass
