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

from __future__ import annotations
from moovio_sdk.models.components import (
    bankaccountverificationcreated as components_bankaccountverificationcreated,
    bankaccountwaitfor as components_bankaccountwaitfor,
)
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
from moovio_sdk.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
import pydantic
from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class InitiateBankAccountVerificationRequestTypedDict(TypedDict):
    account_id: str
    bank_account_id: str
    x_wait_for: NotRequired[components_bankaccountwaitfor.BankAccountWaitFor]
    r"""Optional header to wait for certain events, such as the rail response, to occur before returning a response.

    When this header is set to `rail-response`, the endpoint will wait for a sent-credit or failed status from the payment rail.
    """


class InitiateBankAccountVerificationRequest(BaseModel):
    account_id: Annotated[
        str,
        pydantic.Field(alias="accountID"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]

    bank_account_id: Annotated[
        str,
        pydantic.Field(alias="bankAccountID"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]

    x_wait_for: Annotated[
        Optional[components_bankaccountwaitfor.BankAccountWaitFor],
        pydantic.Field(alias="x-wait-for"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""Optional header to wait for certain events, such as the rail response, to occur before returning a response.

    When this header is set to `rail-response`, the endpoint will wait for a sent-credit or failed status from the payment rail.
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["x-wait-for"])
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


class InitiateBankAccountVerificationResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: components_bankaccountverificationcreated.BankAccountVerificationCreatedTypedDict


class InitiateBankAccountVerificationResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: components_bankaccountverificationcreated.BankAccountVerificationCreated
