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

from typing import TYPE_CHECKING
from importlib import import_module

if TYPE_CHECKING:
    from .apierror import APIError
    from .error_bad_gateway import ErrorBADGATEWAY, ErrorBADGATEWAYData
    from .error_bad_request import ErrorBADREQUEST, ErrorBADREQUESTData
    from .error_conflict import ErrorCONFLICT, ErrorCONFLICTData
    from .error_forbidden import ErrorFORBIDDEN, ErrorFORBIDDENData
    from .error_internal_server_error import (
        ERRORINTERNALSERVERERROR,
        ERRORINTERNALSERVERERRORData,
    )
    from .error_not_found import ErrorNOTFOUND, ErrorNOTFOUNDData
    from .error_unprocessable_content import (
        ErrorUNPROCESSABLECONTENT,
        ErrorUNPROCESSABLECONTENTData,
    )

__all__ = [
    "APIError",
    "ERRORINTERNALSERVERERROR",
    "ERRORINTERNALSERVERERRORData",
    "ErrorBADGATEWAY",
    "ErrorBADGATEWAYData",
    "ErrorBADREQUEST",
    "ErrorBADREQUESTData",
    "ErrorCONFLICT",
    "ErrorCONFLICTData",
    "ErrorFORBIDDEN",
    "ErrorFORBIDDENData",
    "ErrorNOTFOUND",
    "ErrorNOTFOUNDData",
    "ErrorUNPROCESSABLECONTENT",
    "ErrorUNPROCESSABLECONTENTData",
]

_dynamic_imports: dict[str, str] = {
    "APIError": ".apierror",
    "ErrorBADGATEWAY": ".error_bad_gateway",
    "ErrorBADGATEWAYData": ".error_bad_gateway",
    "ErrorBADREQUEST": ".error_bad_request",
    "ErrorBADREQUESTData": ".error_bad_request",
    "ErrorCONFLICT": ".error_conflict",
    "ErrorCONFLICTData": ".error_conflict",
    "ErrorFORBIDDEN": ".error_forbidden",
    "ErrorFORBIDDENData": ".error_forbidden",
    "ERRORINTERNALSERVERERROR": ".error_internal_server_error",
    "ERRORINTERNALSERVERERRORData": ".error_internal_server_error",
    "ErrorNOTFOUND": ".error_not_found",
    "ErrorNOTFOUNDData": ".error_not_found",
    "ErrorUNPROCESSABLECONTENT": ".error_unprocessable_content",
    "ErrorUNPROCESSABLECONTENTData": ".error_unprocessable_content",
}


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 = import_module(module_name, __package__)
        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 = list(_dynamic_imports.keys())
    return sorted(lazy_attrs)
