"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .bankaccountcreate import BankAccountCreate, BankAccountCreateTypedDict
from ascend_sdk import utils
from ascend_sdk.types import BaseModel
from ascend_sdk.utils import validate_open_enum
from enum import Enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class VerificationMethod(str, Enum, metaclass=utils.OpenEnumMeta):
    r"""The verification method of the bank relationship."""

    VERIFICATION_METHOD_UNSPECIFIED = "VERIFICATION_METHOD_UNSPECIFIED"
    MICRO_DEPOSIT = "MICRO_DEPOSIT"
    YODLEE = "YODLEE"
    QUOVO = "QUOVO"
    GIACT = "GIACT"
    SYNAPSE = "SYNAPSE"
    SOPHTRON = "SOPHTRON"
    USE_EXISTING = "USE_EXISTING"
    INTERNAL_BANK = "INTERNAL_BANK"
    MX = "MX"
    FISERV = "FISERV"
    PLAID_TOKEN = "PLAID_TOKEN"


class BankRelationshipCreateTypedDict(TypedDict):
    r"""A relationship between a bank account and an Apex account."""

    nickname: str
    r"""The nickname of the bank relationship."""
    verification_method: VerificationMethod
    r"""The verification method of the bank relationship."""
    bank_account: NotRequired[BankAccountCreateTypedDict]
    r"""A representation of a bank account."""
    plaid_processor_token: NotRequired[str]
    r"""A processor token from Plaid (vendor). Required if using `PLAID_TOKEN` verification method."""


class BankRelationshipCreate(BaseModel):
    r"""A relationship between a bank account and an Apex account."""

    nickname: str
    r"""The nickname of the bank relationship."""

    verification_method: Annotated[
        VerificationMethod, PlainValidator(validate_open_enum(False))
    ]
    r"""The verification method of the bank relationship."""

    bank_account: Optional[BankAccountCreate] = None
    r"""A representation of a bank account."""

    plaid_processor_token: Optional[str] = None
    r"""A processor token from Plaid (vendor). Required if using `PLAID_TOKEN` verification method."""
