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

from typing import TYPE_CHECKING
from importlib import import_module
import builtins
import sys

if TYPE_CHECKING:
    from .create_bank_account import (
        CreateBankAccountRequest,
        CreateBankAccountRequestTypedDict,
    )
    from .create_bank_account_mapping import (
        CreateBankAccountMappingRequest,
        CreateBankAccountMappingRequestTypedDict,
    )
    from .create_bank_transactions import (
        CreateBankTransactionsRequest,
        CreateBankTransactionsRequestTypedDict,
    )
    from .create_batch_source_account import (
        CreateBatchSourceAccountRequest,
        CreateBatchSourceAccountRequestBody,
        CreateBatchSourceAccountRequestBodyTypedDict,
        CreateBatchSourceAccountRequestTypedDict,
        CreateBatchSourceAccountResponse,
        CreateBatchSourceAccountResponseBody,
        CreateBatchSourceAccountResponseBodyTypedDict,
        CreateBatchSourceAccountResponseTypedDict,
        ResponseBody,
        ResponseBodyTypedDict,
    )
    from .create_connection import (
        CreateConnectionRequest,
        CreateConnectionRequestBody,
        CreateConnectionRequestBodyTypedDict,
        CreateConnectionRequestTypedDict,
    )
    from .create_source_account import (
        CreateSourceAccountRequest,
        CreateSourceAccountRequestBody,
        CreateSourceAccountRequestBodyTypedDict,
        CreateSourceAccountRequestTypedDict,
        CreateSourceAccountResponseBody,
        CreateSourceAccountResponseBodyTypedDict,
    )
    from .delete_bank_feed_credentials import (
        DeleteBankFeedCredentialsRequest,
        DeleteBankFeedCredentialsRequestTypedDict,
    )
    from .delete_company import DeleteCompanyRequest, DeleteCompanyRequestTypedDict
    from .delete_connection import (
        DeleteConnectionRequest,
        DeleteConnectionRequestTypedDict,
    )
    from .delete_source_account import (
        DeleteSourceAccountRequest,
        DeleteSourceAccountRequestTypedDict,
    )
    from .generate_credentials import (
        GenerateCredentialsRequest,
        GenerateCredentialsRequestTypedDict,
    )
    from .get_bank_account_mapping import (
        GetBankAccountMappingRequest,
        GetBankAccountMappingRequestTypedDict,
    )
    from .get_company import GetCompanyRequest, GetCompanyRequestTypedDict
    from .get_company_access_token import (
        GetCompanyAccessTokenRequest,
        GetCompanyAccessTokenRequestTypedDict,
    )
    from .get_company_information import (
        GetCompanyInformationRequest,
        GetCompanyInformationRequestTypedDict,
    )
    from .get_connection import GetConnectionRequest, GetConnectionRequestTypedDict
    from .get_create_bank_transactions_model import (
        GetCreateBankTransactionsModelRequest,
        GetCreateBankTransactionsModelRequestTypedDict,
    )
    from .get_create_bankaccounts_model import (
        GetCreateBankAccountsModelRequest,
        GetCreateBankAccountsModelRequestTypedDict,
    )
    from .get_create_operation import (
        GetCreateOperationRequest,
        GetCreateOperationRequestTypedDict,
    )
    from .get_latest_managed_bank_feed_sync import (
        GetLatestManagedBankFeedSyncRequest,
        GetLatestManagedBankFeedSyncRequestTypedDict,
    )
    from .get_managed_bank_feed_sync import (
        GetManagedBankFeedSyncRequest,
        GetManagedBankFeedSyncRequestTypedDict,
    )
    from .list_bank_accounts import (
        ListBankAccountsRequest,
        ListBankAccountsRequestTypedDict,
    )
    from .list_companies import ListCompaniesRequest, ListCompaniesRequestTypedDict
    from .list_connections import (
        ListConnectionsRequest,
        ListConnectionsRequestTypedDict,
    )
    from .list_create_operations import (
        ListCreateOperationsRequest,
        ListCreateOperationsRequestTypedDict,
    )
    from .list_source_accounts import (
        ListSourceAccountsRequest,
        ListSourceAccountsRequestTypedDict,
        ListSourceAccountsResponseBody,
        ListSourceAccountsResponseBodyTypedDict,
    )
    from .replace_company import ReplaceCompanyRequest, ReplaceCompanyRequestTypedDict
    from .run_managed_bank_feed_ad_hoc_sync import (
        RunManagedBankFeedAdHocSyncRequest,
        RunManagedBankFeedAdHocSyncRequestTypedDict,
    )
    from .unlink_connection import (
        UnlinkConnectionRequest,
        UnlinkConnectionRequestTypedDict,
        UnlinkConnectionUpdateConnection,
        UnlinkConnectionUpdateConnectionTypedDict,
    )
    from .update_company import UpdateCompanyRequest, UpdateCompanyRequestTypedDict
    from .update_source_account import (
        UpdateSourceAccountRequest,
        UpdateSourceAccountRequestTypedDict,
    )

__all__ = [
    "CreateBankAccountMappingRequest",
    "CreateBankAccountMappingRequestTypedDict",
    "CreateBankAccountRequest",
    "CreateBankAccountRequestTypedDict",
    "CreateBankTransactionsRequest",
    "CreateBankTransactionsRequestTypedDict",
    "CreateBatchSourceAccountRequest",
    "CreateBatchSourceAccountRequestBody",
    "CreateBatchSourceAccountRequestBodyTypedDict",
    "CreateBatchSourceAccountRequestTypedDict",
    "CreateBatchSourceAccountResponse",
    "CreateBatchSourceAccountResponseBody",
    "CreateBatchSourceAccountResponseBodyTypedDict",
    "CreateBatchSourceAccountResponseTypedDict",
    "CreateConnectionRequest",
    "CreateConnectionRequestBody",
    "CreateConnectionRequestBodyTypedDict",
    "CreateConnectionRequestTypedDict",
    "CreateSourceAccountRequest",
    "CreateSourceAccountRequestBody",
    "CreateSourceAccountRequestBodyTypedDict",
    "CreateSourceAccountRequestTypedDict",
    "CreateSourceAccountResponseBody",
    "CreateSourceAccountResponseBodyTypedDict",
    "DeleteBankFeedCredentialsRequest",
    "DeleteBankFeedCredentialsRequestTypedDict",
    "DeleteCompanyRequest",
    "DeleteCompanyRequestTypedDict",
    "DeleteConnectionRequest",
    "DeleteConnectionRequestTypedDict",
    "DeleteSourceAccountRequest",
    "DeleteSourceAccountRequestTypedDict",
    "GenerateCredentialsRequest",
    "GenerateCredentialsRequestTypedDict",
    "GetBankAccountMappingRequest",
    "GetBankAccountMappingRequestTypedDict",
    "GetCompanyAccessTokenRequest",
    "GetCompanyAccessTokenRequestTypedDict",
    "GetCompanyInformationRequest",
    "GetCompanyInformationRequestTypedDict",
    "GetCompanyRequest",
    "GetCompanyRequestTypedDict",
    "GetConnectionRequest",
    "GetConnectionRequestTypedDict",
    "GetCreateBankAccountsModelRequest",
    "GetCreateBankAccountsModelRequestTypedDict",
    "GetCreateBankTransactionsModelRequest",
    "GetCreateBankTransactionsModelRequestTypedDict",
    "GetCreateOperationRequest",
    "GetCreateOperationRequestTypedDict",
    "GetLatestManagedBankFeedSyncRequest",
    "GetLatestManagedBankFeedSyncRequestTypedDict",
    "GetManagedBankFeedSyncRequest",
    "GetManagedBankFeedSyncRequestTypedDict",
    "ListBankAccountsRequest",
    "ListBankAccountsRequestTypedDict",
    "ListCompaniesRequest",
    "ListCompaniesRequestTypedDict",
    "ListConnectionsRequest",
    "ListConnectionsRequestTypedDict",
    "ListCreateOperationsRequest",
    "ListCreateOperationsRequestTypedDict",
    "ListSourceAccountsRequest",
    "ListSourceAccountsRequestTypedDict",
    "ListSourceAccountsResponseBody",
    "ListSourceAccountsResponseBodyTypedDict",
    "ReplaceCompanyRequest",
    "ReplaceCompanyRequestTypedDict",
    "ResponseBody",
    "ResponseBodyTypedDict",
    "RunManagedBankFeedAdHocSyncRequest",
    "RunManagedBankFeedAdHocSyncRequestTypedDict",
    "UnlinkConnectionRequest",
    "UnlinkConnectionRequestTypedDict",
    "UnlinkConnectionUpdateConnection",
    "UnlinkConnectionUpdateConnectionTypedDict",
    "UpdateCompanyRequest",
    "UpdateCompanyRequestTypedDict",
    "UpdateSourceAccountRequest",
    "UpdateSourceAccountRequestTypedDict",
]

_dynamic_imports: dict[str, str] = {
    "CreateBankAccountRequest": ".create_bank_account",
    "CreateBankAccountRequestTypedDict": ".create_bank_account",
    "CreateBankAccountMappingRequest": ".create_bank_account_mapping",
    "CreateBankAccountMappingRequestTypedDict": ".create_bank_account_mapping",
    "CreateBankTransactionsRequest": ".create_bank_transactions",
    "CreateBankTransactionsRequestTypedDict": ".create_bank_transactions",
    "CreateBatchSourceAccountRequest": ".create_batch_source_account",
    "CreateBatchSourceAccountRequestBody": ".create_batch_source_account",
    "CreateBatchSourceAccountRequestBodyTypedDict": ".create_batch_source_account",
    "CreateBatchSourceAccountRequestTypedDict": ".create_batch_source_account",
    "CreateBatchSourceAccountResponse": ".create_batch_source_account",
    "CreateBatchSourceAccountResponseBody": ".create_batch_source_account",
    "CreateBatchSourceAccountResponseBodyTypedDict": ".create_batch_source_account",
    "CreateBatchSourceAccountResponseTypedDict": ".create_batch_source_account",
    "ResponseBody": ".create_batch_source_account",
    "ResponseBodyTypedDict": ".create_batch_source_account",
    "CreateConnectionRequest": ".create_connection",
    "CreateConnectionRequestBody": ".create_connection",
    "CreateConnectionRequestBodyTypedDict": ".create_connection",
    "CreateConnectionRequestTypedDict": ".create_connection",
    "CreateSourceAccountRequest": ".create_source_account",
    "CreateSourceAccountRequestBody": ".create_source_account",
    "CreateSourceAccountRequestBodyTypedDict": ".create_source_account",
    "CreateSourceAccountRequestTypedDict": ".create_source_account",
    "CreateSourceAccountResponseBody": ".create_source_account",
    "CreateSourceAccountResponseBodyTypedDict": ".create_source_account",
    "DeleteBankFeedCredentialsRequest": ".delete_bank_feed_credentials",
    "DeleteBankFeedCredentialsRequestTypedDict": ".delete_bank_feed_credentials",
    "DeleteCompanyRequest": ".delete_company",
    "DeleteCompanyRequestTypedDict": ".delete_company",
    "DeleteConnectionRequest": ".delete_connection",
    "DeleteConnectionRequestTypedDict": ".delete_connection",
    "DeleteSourceAccountRequest": ".delete_source_account",
    "DeleteSourceAccountRequestTypedDict": ".delete_source_account",
    "GenerateCredentialsRequest": ".generate_credentials",
    "GenerateCredentialsRequestTypedDict": ".generate_credentials",
    "GetBankAccountMappingRequest": ".get_bank_account_mapping",
    "GetBankAccountMappingRequestTypedDict": ".get_bank_account_mapping",
    "GetCompanyRequest": ".get_company",
    "GetCompanyRequestTypedDict": ".get_company",
    "GetCompanyAccessTokenRequest": ".get_company_access_token",
    "GetCompanyAccessTokenRequestTypedDict": ".get_company_access_token",
    "GetCompanyInformationRequest": ".get_company_information",
    "GetCompanyInformationRequestTypedDict": ".get_company_information",
    "GetConnectionRequest": ".get_connection",
    "GetConnectionRequestTypedDict": ".get_connection",
    "GetCreateBankTransactionsModelRequest": ".get_create_bank_transactions_model",
    "GetCreateBankTransactionsModelRequestTypedDict": ".get_create_bank_transactions_model",
    "GetCreateBankAccountsModelRequest": ".get_create_bankaccounts_model",
    "GetCreateBankAccountsModelRequestTypedDict": ".get_create_bankaccounts_model",
    "GetCreateOperationRequest": ".get_create_operation",
    "GetCreateOperationRequestTypedDict": ".get_create_operation",
    "GetLatestManagedBankFeedSyncRequest": ".get_latest_managed_bank_feed_sync",
    "GetLatestManagedBankFeedSyncRequestTypedDict": ".get_latest_managed_bank_feed_sync",
    "GetManagedBankFeedSyncRequest": ".get_managed_bank_feed_sync",
    "GetManagedBankFeedSyncRequestTypedDict": ".get_managed_bank_feed_sync",
    "ListBankAccountsRequest": ".list_bank_accounts",
    "ListBankAccountsRequestTypedDict": ".list_bank_accounts",
    "ListCompaniesRequest": ".list_companies",
    "ListCompaniesRequestTypedDict": ".list_companies",
    "ListConnectionsRequest": ".list_connections",
    "ListConnectionsRequestTypedDict": ".list_connections",
    "ListCreateOperationsRequest": ".list_create_operations",
    "ListCreateOperationsRequestTypedDict": ".list_create_operations",
    "ListSourceAccountsRequest": ".list_source_accounts",
    "ListSourceAccountsRequestTypedDict": ".list_source_accounts",
    "ListSourceAccountsResponseBody": ".list_source_accounts",
    "ListSourceAccountsResponseBodyTypedDict": ".list_source_accounts",
    "ReplaceCompanyRequest": ".replace_company",
    "ReplaceCompanyRequestTypedDict": ".replace_company",
    "RunManagedBankFeedAdHocSyncRequest": ".run_managed_bank_feed_ad_hoc_sync",
    "RunManagedBankFeedAdHocSyncRequestTypedDict": ".run_managed_bank_feed_ad_hoc_sync",
    "UnlinkConnectionRequest": ".unlink_connection",
    "UnlinkConnectionRequestTypedDict": ".unlink_connection",
    "UnlinkConnectionUpdateConnection": ".unlink_connection",
    "UnlinkConnectionUpdateConnectionTypedDict": ".unlink_connection",
    "UpdateCompanyRequest": ".update_company",
    "UpdateCompanyRequestTypedDict": ".update_company",
    "UpdateSourceAccountRequest": ".update_source_account",
    "UpdateSourceAccountRequestTypedDict": ".update_source_account",
}


def dynamic_import(modname, retries=3):
    for attempt in range(retries):
        try:
            return import_module(modname, __package__)
        except KeyError:
            # Clear any half-initialized module and retry
            sys.modules.pop(modname, None)
            if attempt == retries - 1:
                break
    raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")


def __getattr__(attr_name: str) -> object:
    module_name = _dynamic_imports.get(attr_name)
    if module_name is None:
        raise AttributeError(
            f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
        )

    try:
        module = dynamic_import(module_name)
        result = getattr(module, attr_name)
        return result
    except ImportError as e:
        raise ImportError(
            f"Failed to import {attr_name} from {module_name}: {e}"
        ) from e
    except AttributeError as e:
        raise AttributeError(
            f"Failed to get {attr_name} from {module_name}: {e}"
        ) from e


def __dir__():
    lazy_attrs = builtins.list(_dynamic_imports.keys())
    return builtins.sorted(lazy_attrs)
