# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

from ...core.pydantic_utilities import pydantic_v1
from .bank_account_check_options import BankAccountCheckOptions
from .custom_payment_method_schema_id import CustomPaymentMethodSchemaId
from .plaid_link_request import PlaidLinkRequest


class PaymentMethodUpdateRequest_Custom(pydantic_v1.BaseModel):
    type: typing.Literal["custom"] = "custom"
    foreign_id: typing.Optional[str] = pydantic_v1.Field(alias="foreignId")
    account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName")
    account_number: typing.Optional[str] = pydantic_v1.Field(alias="accountNumber")
    schema_id: typing.Optional[CustomPaymentMethodSchemaId] = pydantic_v1.Field(alias="schemaId")
    data: typing.Optional[typing.Dict[str, str]]
    default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource")
    default_destination: typing.Optional[bool] = pydantic_v1.Field(alias="defaultDestination")

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        populate_by_name = True


class PaymentMethodUpdateRequest_BankAccount(pydantic_v1.BaseModel):
    type: typing.Literal["bankAccount"] = "bankAccount"
    account_name: typing.Optional[str] = pydantic_v1.Field(alias="accountName")
    plaid: typing.Optional[PlaidLinkRequest]
    check_options: typing.Optional[BankAccountCheckOptions] = pydantic_v1.Field(alias="checkOptions")
    default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource")
    default_destination: typing.Optional[bool] = pydantic_v1.Field(alias="defaultDestination")

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        populate_by_name = True


class PaymentMethodUpdateRequest_Card(pydantic_v1.BaseModel):
    type: typing.Literal["card"] = "card"
    default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource")
    default_destination: typing.Optional[bool] = pydantic_v1.Field(alias="defaultDestination")

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        populate_by_name = True


class PaymentMethodUpdateRequest_Check(pydantic_v1.BaseModel):
    type: typing.Literal["check"] = "check"
    default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource")
    default_destination: typing.Optional[bool] = pydantic_v1.Field(alias="defaultDestination")

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        populate_by_name = True


class PaymentMethodUpdateRequest_OffPlatform(pydantic_v1.BaseModel):
    type: typing.Literal["offPlatform"] = "offPlatform"
    default_source: typing.Optional[bool] = pydantic_v1.Field(alias="defaultSource")
    default_destination: typing.Optional[bool] = pydantic_v1.Field(alias="defaultDestination")

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        populate_by_name = True


"""
from mercoa import PaymentMethodUpdateRequest_BankAccount

PaymentMethodUpdateRequest_BankAccount(
    default_source=True,
    default_destination=True,
)
"""
PaymentMethodUpdateRequest = typing.Union[
    PaymentMethodUpdateRequest_Custom,
    PaymentMethodUpdateRequest_BankAccount,
    PaymentMethodUpdateRequest_Card,
    PaymentMethodUpdateRequest_Check,
    PaymentMethodUpdateRequest_OffPlatform,
]
