# 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


class ReissuePaymentMethod(UniversalBaseModel):
    """
    Payment method for reissuing a payout transaction. The reissue endpoint uses the payment method details directly. It doesn't fall back to the vendor's managed payment method.
    - `{ method: "vcard" }` - Reissue as a virtual card
    - `{ method: "check" }` - Reissue as a paper check
    - `{ method: "ach", achHolder: "...", achRouting: "...", achAccount: "...", achAccountType: "...", achHolderType: "..." }` - Reissue as ACH with bank details
    """

    method: str = pydantic.Field()
    """
    Payment method type. Must be `"ach"`, `"check"`, or `"vcard"`.
    """

    ach_holder: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="achHolder"),
        pydantic.Field(alias="achHolder", description='Account holder name. Required when `method` is `"ach"`.'),
    ] = None
    ach_routing: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="achRouting"),
        pydantic.Field(
            alias="achRouting", description='Bank routing number (9 digits). Required when `method` is `"ach"`.'
        ),
    ] = None
    ach_account: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="achAccount"),
        pydantic.Field(
            alias="achAccount", description='Bank account number (8-17 digits). Required when `method` is `"ach"`.'
        ),
    ] = None
    ach_account_type: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="achAccountType"),
        pydantic.Field(
            alias="achAccountType",
            description='Bank account type (`"checking"` or `"savings"`). Required when `method` is `"ach"`.',
        ),
    ] = None
    ach_holder_type: typing_extensions.Annotated[
        typing.Optional[AchHolderType], FieldMetadata(alias="achHolderType"), pydantic.Field(alias="achHolderType")
    ] = None

    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
