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

from .clienterror import ClientError
from typing import TYPE_CHECKING
from importlib import import_module
import builtins
import sys

if TYPE_CHECKING:
    from .accountresponse import AccountResponse, AccountResponseTypedDict, AccountType
    from .addsenderop import AddSenderResponse, AddSenderResponseTypedDict
    from .cancelledmessage import CancelledMessage, CancelledMessageTypedDict
    from .cancelmessagesop import (
        CancelMessagesRequest,
        CancelMessagesRequestTypedDict,
        CancelMessagesResponse,
        CancelMessagesResponseTypedDict,
    )
    from .deletesenderop import (
        DeleteSenderRequest,
        DeleteSenderRequestTypedDict,
        DeleteSenderResponse,
        DeleteSenderResponseTypedDict,
    )
    from .errorresponse import ErrorResponse, ErrorResponseTypedDict
    from .errorresponse_error import ErrorResponseError, ErrorResponseErrorData
    from .getincomingmessagesop import (
        GetIncomingMessagesRequest,
        GetIncomingMessagesRequestTypedDict,
        GetIncomingMessagesResponse,
        GetIncomingMessagesResponseTypedDict,
    )
    from .getmessagesop import (
        GetMessagesRequest,
        GetMessagesRequestTypedDict,
        GetMessagesResponse,
        GetMessagesResponseTypedDict,
    )
    from .getmmspriceop import (
        GetMmsPriceRequestBody,
        GetMmsPriceRequestBodyTypedDict,
        GetMmsPriceResponse,
        GetMmsPriceResponseTypedDict,
    )
    from .getsmspriceop import (
        GetSmsPriceRequestBody,
        GetSmsPriceRequestBodyTypedDict,
        GetSmsPriceResponse,
        GetSmsPriceResponseTypedDict,
    )
    from .getsubaccountdetailsop import (
        GetSubaccountDetailsRequest,
        GetSubaccountDetailsRequestTypedDict,
    )
    from .incomingmessage import IncomingMessage, IncomingMessageTypedDict
    from .listincomingmessagesop import (
        ListIncomingMessagesRequest,
        ListIncomingMessagesRequestTypedDict,
        ListIncomingMessagesResponse,
        ListIncomingMessagesResponseTypedDict,
    )
    from .listmessagesop import (
        ListMessagesRequest,
        ListMessagesRequestTypedDict,
        ListMessagesResponse,
        ListMessagesResponseTypedDict,
    )
    from .message import Message, MessageTypedDict
    from .messagetype import MessageType
    from .mmsmessage import (
        Attachments,
        AttachmentsTypedDict,
        MmsMessage,
        MmsMessageTypedDict,
        Recipients,
        RecipientsTypedDict,
    )
    from .no_response_error import NoResponseError
    from .phonenumberwithcid import PhoneNumberWithCid, PhoneNumberWithCidTypedDict
    from .pingresponse import PingResponse, PingResponseTypedDict
    from .price import Price, PriceTypedDict
    from .responsevalidationerror import ResponseValidationError
    from .sdkerror import SDKError
    from .security import Security, SecurityTypedDict
    from .sender import Sender, SenderTypedDict
    from .sender_input import SenderInput, SenderInputTypedDict
    from .sendmmsop import (
        SendMmsRequestBody,
        SendMmsRequestBodyTypedDict,
        SendMmsResponse,
        SendMmsResponseTypedDict,
    )
    from .sendsmsop import (
        SendSmsRequestBody,
        SendSmsRequestBodyTypedDict,
        SendSmsResponse,
        SendSmsResponseTypedDict,
    )
    from .setdefaultsenderop import (
        SetDefaultSenderRequest,
        SetDefaultSenderRequestTypedDict,
        SetDefaultSenderResponse,
        SetDefaultSenderResponseTypedDict,
    )
    from .smsmessage import (
        SmsMessage,
        SmsMessageRecipients,
        SmsMessageRecipientsTypedDict,
        SmsMessageTypedDict,
    )
    from .smstype import SmsType

__all__ = [
    "AccountResponse",
    "AccountResponseTypedDict",
    "AccountType",
    "AddSenderResponse",
    "AddSenderResponseTypedDict",
    "Attachments",
    "AttachmentsTypedDict",
    "CancelMessagesRequest",
    "CancelMessagesRequestTypedDict",
    "CancelMessagesResponse",
    "CancelMessagesResponseTypedDict",
    "CancelledMessage",
    "CancelledMessageTypedDict",
    "ClientError",
    "DeleteSenderRequest",
    "DeleteSenderRequestTypedDict",
    "DeleteSenderResponse",
    "DeleteSenderResponseTypedDict",
    "ErrorResponse",
    "ErrorResponseError",
    "ErrorResponseErrorData",
    "ErrorResponseTypedDict",
    "GetIncomingMessagesRequest",
    "GetIncomingMessagesRequestTypedDict",
    "GetIncomingMessagesResponse",
    "GetIncomingMessagesResponseTypedDict",
    "GetMessagesRequest",
    "GetMessagesRequestTypedDict",
    "GetMessagesResponse",
    "GetMessagesResponseTypedDict",
    "GetMmsPriceRequestBody",
    "GetMmsPriceRequestBodyTypedDict",
    "GetMmsPriceResponse",
    "GetMmsPriceResponseTypedDict",
    "GetSmsPriceRequestBody",
    "GetSmsPriceRequestBodyTypedDict",
    "GetSmsPriceResponse",
    "GetSmsPriceResponseTypedDict",
    "GetSubaccountDetailsRequest",
    "GetSubaccountDetailsRequestTypedDict",
    "IncomingMessage",
    "IncomingMessageTypedDict",
    "ListIncomingMessagesRequest",
    "ListIncomingMessagesRequestTypedDict",
    "ListIncomingMessagesResponse",
    "ListIncomingMessagesResponseTypedDict",
    "ListMessagesRequest",
    "ListMessagesRequestTypedDict",
    "ListMessagesResponse",
    "ListMessagesResponseTypedDict",
    "Message",
    "MessageType",
    "MessageTypedDict",
    "MmsMessage",
    "MmsMessageTypedDict",
    "NoResponseError",
    "PhoneNumberWithCid",
    "PhoneNumberWithCidTypedDict",
    "PingResponse",
    "PingResponseTypedDict",
    "Price",
    "PriceTypedDict",
    "Recipients",
    "RecipientsTypedDict",
    "ResponseValidationError",
    "SDKError",
    "Security",
    "SecurityTypedDict",
    "SendMmsRequestBody",
    "SendMmsRequestBodyTypedDict",
    "SendMmsResponse",
    "SendMmsResponseTypedDict",
    "SendSmsRequestBody",
    "SendSmsRequestBodyTypedDict",
    "SendSmsResponse",
    "SendSmsResponseTypedDict",
    "Sender",
    "SenderInput",
    "SenderInputTypedDict",
    "SenderTypedDict",
    "SetDefaultSenderRequest",
    "SetDefaultSenderRequestTypedDict",
    "SetDefaultSenderResponse",
    "SetDefaultSenderResponseTypedDict",
    "SmsMessage",
    "SmsMessageRecipients",
    "SmsMessageRecipientsTypedDict",
    "SmsMessageTypedDict",
    "SmsType",
]

_dynamic_imports: dict[str, str] = {
    "AccountResponse": ".accountresponse",
    "AccountResponseTypedDict": ".accountresponse",
    "AccountType": ".accountresponse",
    "AddSenderResponse": ".addsenderop",
    "AddSenderResponseTypedDict": ".addsenderop",
    "CancelledMessage": ".cancelledmessage",
    "CancelledMessageTypedDict": ".cancelledmessage",
    "CancelMessagesRequest": ".cancelmessagesop",
    "CancelMessagesRequestTypedDict": ".cancelmessagesop",
    "CancelMessagesResponse": ".cancelmessagesop",
    "CancelMessagesResponseTypedDict": ".cancelmessagesop",
    "DeleteSenderRequest": ".deletesenderop",
    "DeleteSenderRequestTypedDict": ".deletesenderop",
    "DeleteSenderResponse": ".deletesenderop",
    "DeleteSenderResponseTypedDict": ".deletesenderop",
    "ErrorResponse": ".errorresponse",
    "ErrorResponseTypedDict": ".errorresponse",
    "ErrorResponseError": ".errorresponse_error",
    "ErrorResponseErrorData": ".errorresponse_error",
    "GetIncomingMessagesRequest": ".getincomingmessagesop",
    "GetIncomingMessagesRequestTypedDict": ".getincomingmessagesop",
    "GetIncomingMessagesResponse": ".getincomingmessagesop",
    "GetIncomingMessagesResponseTypedDict": ".getincomingmessagesop",
    "GetMessagesRequest": ".getmessagesop",
    "GetMessagesRequestTypedDict": ".getmessagesop",
    "GetMessagesResponse": ".getmessagesop",
    "GetMessagesResponseTypedDict": ".getmessagesop",
    "GetMmsPriceRequestBody": ".getmmspriceop",
    "GetMmsPriceRequestBodyTypedDict": ".getmmspriceop",
    "GetMmsPriceResponse": ".getmmspriceop",
    "GetMmsPriceResponseTypedDict": ".getmmspriceop",
    "GetSmsPriceRequestBody": ".getsmspriceop",
    "GetSmsPriceRequestBodyTypedDict": ".getsmspriceop",
    "GetSmsPriceResponse": ".getsmspriceop",
    "GetSmsPriceResponseTypedDict": ".getsmspriceop",
    "GetSubaccountDetailsRequest": ".getsubaccountdetailsop",
    "GetSubaccountDetailsRequestTypedDict": ".getsubaccountdetailsop",
    "IncomingMessage": ".incomingmessage",
    "IncomingMessageTypedDict": ".incomingmessage",
    "ListIncomingMessagesRequest": ".listincomingmessagesop",
    "ListIncomingMessagesRequestTypedDict": ".listincomingmessagesop",
    "ListIncomingMessagesResponse": ".listincomingmessagesop",
    "ListIncomingMessagesResponseTypedDict": ".listincomingmessagesop",
    "ListMessagesRequest": ".listmessagesop",
    "ListMessagesRequestTypedDict": ".listmessagesop",
    "ListMessagesResponse": ".listmessagesop",
    "ListMessagesResponseTypedDict": ".listmessagesop",
    "Message": ".message",
    "MessageTypedDict": ".message",
    "MessageType": ".messagetype",
    "Attachments": ".mmsmessage",
    "AttachmentsTypedDict": ".mmsmessage",
    "MmsMessage": ".mmsmessage",
    "MmsMessageTypedDict": ".mmsmessage",
    "Recipients": ".mmsmessage",
    "RecipientsTypedDict": ".mmsmessage",
    "NoResponseError": ".no_response_error",
    "PhoneNumberWithCid": ".phonenumberwithcid",
    "PhoneNumberWithCidTypedDict": ".phonenumberwithcid",
    "PingResponse": ".pingresponse",
    "PingResponseTypedDict": ".pingresponse",
    "Price": ".price",
    "PriceTypedDict": ".price",
    "ResponseValidationError": ".responsevalidationerror",
    "SDKError": ".sdkerror",
    "Security": ".security",
    "SecurityTypedDict": ".security",
    "Sender": ".sender",
    "SenderTypedDict": ".sender",
    "SenderInput": ".sender_input",
    "SenderInputTypedDict": ".sender_input",
    "SendMmsRequestBody": ".sendmmsop",
    "SendMmsRequestBodyTypedDict": ".sendmmsop",
    "SendMmsResponse": ".sendmmsop",
    "SendMmsResponseTypedDict": ".sendmmsop",
    "SendSmsRequestBody": ".sendsmsop",
    "SendSmsRequestBodyTypedDict": ".sendsmsop",
    "SendSmsResponse": ".sendsmsop",
    "SendSmsResponseTypedDict": ".sendsmsop",
    "SetDefaultSenderRequest": ".setdefaultsenderop",
    "SetDefaultSenderRequestTypedDict": ".setdefaultsenderop",
    "SetDefaultSenderResponse": ".setdefaultsenderop",
    "SetDefaultSenderResponseTypedDict": ".setdefaultsenderop",
    "SmsMessage": ".smsmessage",
    "SmsMessageRecipients": ".smsmessage",
    "SmsMessageRecipientsTypedDict": ".smsmessage",
    "SmsMessageTypedDict": ".smsmessage",
    "SmsType": ".smstype",
}


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)
