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

from __future__ import annotations
from codat_bankfeeds.models.shared import (
    sourceaccountbatchcreateresponse as shared_sourceaccountbatchcreateresponse,
    sourceaccountbatcherrorresponse as shared_sourceaccountbatcherrorresponse,
    sourceaccountprototype as shared_sourceaccountprototype,
    sourceaccountv2batchcreateresponse as shared_sourceaccountv2batchcreateresponse,
    sourceaccountv2prototype as shared_sourceaccountv2prototype,
)
from codat_bankfeeds.types import BaseModel
from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata
import pydantic
from typing import List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


CreateBatchSourceAccountRequestBodyTypedDict = TypeAliasType(
    "CreateBatchSourceAccountRequestBodyTypedDict",
    Union[
        List[shared_sourceaccountv2prototype.SourceAccountV2PrototypeTypedDict],
        List[shared_sourceaccountprototype.SourceAccountPrototypeTypedDict],
    ],
)


CreateBatchSourceAccountRequestBody = TypeAliasType(
    "CreateBatchSourceAccountRequestBody",
    Union[
        List[shared_sourceaccountv2prototype.SourceAccountV2Prototype],
        List[shared_sourceaccountprototype.SourceAccountPrototype],
    ],
)


class CreateBatchSourceAccountRequestTypedDict(TypedDict):
    company_id: str
    r"""Unique identifier for a company."""
    connection_id: str
    r"""Unique identifier for a connection."""
    request_body: NotRequired[CreateBatchSourceAccountRequestBodyTypedDict]


class CreateBatchSourceAccountRequest(BaseModel):
    company_id: Annotated[
        str,
        pydantic.Field(alias="companyId"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""Unique identifier for a company."""

    connection_id: Annotated[
        str,
        pydantic.Field(alias="connectionId"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""Unique identifier for a connection."""

    request_body: Annotated[
        Optional[CreateBatchSourceAccountRequestBody],
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ] = None


CreateBatchSourceAccountResponseBodyTypedDict = TypeAliasType(
    "CreateBatchSourceAccountResponseBodyTypedDict",
    Union[
        shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponseTypedDict,
        shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponseTypedDict,
        shared_sourceaccountbatcherrorresponse.SourceAccountBatchErrorResponseTypedDict,
    ],
)


CreateBatchSourceAccountResponseBody = TypeAliasType(
    "CreateBatchSourceAccountResponseBody",
    Union[
        shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponse,
        shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponse,
        shared_sourceaccountbatcherrorresponse.SourceAccountBatchErrorResponse,
    ],
)


ResponseBodyTypedDict = TypeAliasType(
    "ResponseBodyTypedDict",
    Union[
        shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponseTypedDict,
        shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponseTypedDict,
    ],
)


ResponseBody = TypeAliasType(
    "ResponseBody",
    Union[
        shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponse,
        shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponse,
    ],
)


CreateBatchSourceAccountResponseTypedDict = TypeAliasType(
    "CreateBatchSourceAccountResponseTypedDict",
    Union[
        List[ResponseBodyTypedDict], List[CreateBatchSourceAccountResponseBodyTypedDict]
    ],
)


CreateBatchSourceAccountResponse = TypeAliasType(
    "CreateBatchSourceAccountResponse",
    Union[List[ResponseBody], List[CreateBatchSourceAccountResponseBody]],
)
