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

from __future__ import annotations
from ...core.pydantic_utilities import UniversalBaseModel
import typing
from ...invoice_types.types.bank_delivery_method import BankDeliveryMethod
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...invoice_types.types.check_delivery_method import CheckDeliveryMethod


class PaymentRailRequest_BankAccount(UniversalBaseModel):
    type: typing.Literal["bankAccount"] = "bankAccount"
    available_delivery_methods: typing.Optional[typing.List[BankDeliveryMethod]] = pydantic.Field(
        alias="availableDeliveryMethods", default=None
    )
    default_delivery_method: typing.Optional[BankDeliveryMethod] = pydantic.Field(
        alias="defaultDeliveryMethod", default=None
    )
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_Card(UniversalBaseModel):
    type: typing.Literal["card"] = "card"
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_VirtualCard(UniversalBaseModel):
    type: typing.Literal["virtualCard"] = "virtualCard"
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_Check(UniversalBaseModel):
    type: typing.Literal["check"] = "check"
    available_delivery_methods: typing.Optional[typing.List[CheckDeliveryMethod]] = pydantic.Field(
        alias="availableDeliveryMethods", default=None
    )
    default_delivery_method: typing.Optional[CheckDeliveryMethod] = pydantic.Field(
        alias="defaultDeliveryMethod", default=None
    )
    print_description: typing.Optional[bool] = pydantic.Field(alias="printDescription", default=None)
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_Custom(UniversalBaseModel):
    type: typing.Literal["custom"] = "custom"
    schema_id: str = pydantic.Field(alias="schemaId")
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_Bnpl(UniversalBaseModel):
    type: typing.Literal["bnpl"] = "bnpl"
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_OffPlatform(UniversalBaseModel):
    type: typing.Literal["offPlatform"] = "offPlatform"
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_Utility(UniversalBaseModel):
    type: typing.Literal["utility"] = "utility"
    name: typing.Optional[str] = None
    active: bool

    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


class PaymentRailRequest_Na(UniversalBaseModel):
    type: typing.Literal["na"] = "na"
    name: typing.Optional[str] = None
    active: bool

    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


PaymentRailRequest = typing.Union[
    PaymentRailRequest_BankAccount,
    PaymentRailRequest_Card,
    PaymentRailRequest_VirtualCard,
    PaymentRailRequest_Check,
    PaymentRailRequest_Custom,
    PaymentRailRequest_Bnpl,
    PaymentRailRequest_OffPlatform,
    PaymentRailRequest_Utility,
    PaymentRailRequest_Na,
]
