"""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 .badrequesterrorresponse import (
        BadRequestErrorResponse,
        BadRequestErrorResponseData,
    )
    from .conflicterrorresponse import ConflictErrorResponse, ConflictErrorResponseData
    from .forbiddenerrorresponse import (
        ForbiddenErrorResponse,
        ForbiddenErrorResponseData,
    )
    from .internalservererrorresponse import (
        InternalServerErrorResponse,
        InternalServerErrorResponseData,
    )
    from .no_response_error import NoResponseError
    from .notfounderrorresponse import NotFoundErrorResponse, NotFoundErrorResponseData
    from .preconditionfailederrorresponse import (
        PreconditionFailedErrorResponse,
        PreconditionFailedErrorResponseData,
    )
    from .responsevalidationerror import ResponseValidationError
    from .unauthorizederrorresponse import (
        UnauthorizedErrorResponse,
        UnauthorizedErrorResponseData,
    )
    from .unkeyerror import UnkeyError

__all__ = [
    "APIError",
    "BadRequestErrorResponse",
    "BadRequestErrorResponseData",
    "ConflictErrorResponse",
    "ConflictErrorResponseData",
    "ForbiddenErrorResponse",
    "ForbiddenErrorResponseData",
    "InternalServerErrorResponse",
    "InternalServerErrorResponseData",
    "NoResponseError",
    "NotFoundErrorResponse",
    "NotFoundErrorResponseData",
    "PreconditionFailedErrorResponse",
    "PreconditionFailedErrorResponseData",
    "ResponseValidationError",
    "UnauthorizedErrorResponse",
    "UnauthorizedErrorResponseData",
    "UnkeyError",
]

_dynamic_imports: dict[str, str] = {
    "APIError": ".apierror",
    "BadRequestErrorResponse": ".badrequesterrorresponse",
    "BadRequestErrorResponseData": ".badrequesterrorresponse",
    "ConflictErrorResponse": ".conflicterrorresponse",
    "ConflictErrorResponseData": ".conflicterrorresponse",
    "ForbiddenErrorResponse": ".forbiddenerrorresponse",
    "ForbiddenErrorResponseData": ".forbiddenerrorresponse",
    "InternalServerErrorResponse": ".internalservererrorresponse",
    "InternalServerErrorResponseData": ".internalservererrorresponse",
    "NoResponseError": ".no_response_error",
    "NotFoundErrorResponse": ".notfounderrorresponse",
    "NotFoundErrorResponseData": ".notfounderrorresponse",
    "PreconditionFailedErrorResponse": ".preconditionfailederrorresponse",
    "PreconditionFailedErrorResponseData": ".preconditionfailederrorresponse",
    "ResponseValidationError": ".responsevalidationerror",
    "UnauthorizedErrorResponse": ".unauthorizederrorresponse",
    "UnauthorizedErrorResponseData": ".unauthorizederrorresponse",
    "UnkeyError": ".unkeyerror",
}


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)
