"""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 .analyzefirmwarebinary_multipartop import (
        AnalyzeFirmwareBinaryMultipartRequest,
        AnalyzeFirmwareBinaryMultipartRequestTypedDict,
        File,
        FileTypedDict,
    )
    from .analyzefirmwarebinaryop import (
        AnalyzeFirmwareBinaryRequest,
        AnalyzeFirmwareBinaryRequestTypedDict,
    )
    from .artifact import Artifact, ArtifactTypedDict
    from .assessazureenvironmentop import (
        AssessAzureEnvironmentFormat,
        AssessAzureEnvironmentRequest,
        AssessAzureEnvironmentRequestTypedDict,
        AzureWif,
        AzureWifTypedDict,
    )
    from .assessmentsummary import AssessmentSummary, AssessmentSummaryTypedDict
    from .assessterraformstateop import (
        AssessTerraformStateFormat,
        AssessTerraformStateRequest,
        AssessTerraformStateRequestTypedDict,
    )
    from .complianceassessment import (
        ComplianceAssessment,
        ComplianceAssessmentTypedDict,
        Framework,
    )
    from .controlassessment import (
        ControlAssessment,
        ControlAssessmentStatus,
        ControlAssessmentTypedDict,
    )
    from .evidenceresponse import (
        EvidenceResponse,
        EvidenceResponseStatus,
        EvidenceResponseTypedDict,
    )
    from .firmwareresponse import (
        DetectedFormat,
        FirmwareResponse,
        FirmwareResponseTypedDict,
        PfrAssessment,
        PfrAssessmentTypedDict,
        SecurityFeature,
    )
    from .generatefipsassessmentop import (
        GenerateFipsAssessmentFormat,
        GenerateFipsAssessmentRequest,
        GenerateFipsAssessmentRequestTypedDict,
    )
    from .mappinghit import MappingHit, MappingHitTypedDict
    from .security import Security, SecurityTypedDict

__all__ = [
    "AnalyzeFirmwareBinaryMultipartRequest",
    "AnalyzeFirmwareBinaryMultipartRequestTypedDict",
    "AnalyzeFirmwareBinaryRequest",
    "AnalyzeFirmwareBinaryRequestTypedDict",
    "Artifact",
    "ArtifactTypedDict",
    "AssessAzureEnvironmentFormat",
    "AssessAzureEnvironmentRequest",
    "AssessAzureEnvironmentRequestTypedDict",
    "AssessTerraformStateFormat",
    "AssessTerraformStateRequest",
    "AssessTerraformStateRequestTypedDict",
    "AssessmentSummary",
    "AssessmentSummaryTypedDict",
    "AzureWif",
    "AzureWifTypedDict",
    "ComplianceAssessment",
    "ComplianceAssessmentTypedDict",
    "ControlAssessment",
    "ControlAssessmentStatus",
    "ControlAssessmentTypedDict",
    "DetectedFormat",
    "EvidenceResponse",
    "EvidenceResponseStatus",
    "EvidenceResponseTypedDict",
    "File",
    "FileTypedDict",
    "FirmwareResponse",
    "FirmwareResponseTypedDict",
    "Framework",
    "GenerateFipsAssessmentFormat",
    "GenerateFipsAssessmentRequest",
    "GenerateFipsAssessmentRequestTypedDict",
    "MappingHit",
    "MappingHitTypedDict",
    "PfrAssessment",
    "PfrAssessmentTypedDict",
    "Security",
    "SecurityFeature",
    "SecurityTypedDict",
]

_dynamic_imports: dict[str, str] = {
    "AnalyzeFirmwareBinaryMultipartRequest": ".analyzefirmwarebinary_multipartop",
    "AnalyzeFirmwareBinaryMultipartRequestTypedDict": ".analyzefirmwarebinary_multipartop",
    "File": ".analyzefirmwarebinary_multipartop",
    "FileTypedDict": ".analyzefirmwarebinary_multipartop",
    "AnalyzeFirmwareBinaryRequest": ".analyzefirmwarebinaryop",
    "AnalyzeFirmwareBinaryRequestTypedDict": ".analyzefirmwarebinaryop",
    "Artifact": ".artifact",
    "ArtifactTypedDict": ".artifact",
    "AssessAzureEnvironmentFormat": ".assessazureenvironmentop",
    "AssessAzureEnvironmentRequest": ".assessazureenvironmentop",
    "AssessAzureEnvironmentRequestTypedDict": ".assessazureenvironmentop",
    "AzureWif": ".assessazureenvironmentop",
    "AzureWifTypedDict": ".assessazureenvironmentop",
    "AssessmentSummary": ".assessmentsummary",
    "AssessmentSummaryTypedDict": ".assessmentsummary",
    "AssessTerraformStateFormat": ".assessterraformstateop",
    "AssessTerraformStateRequest": ".assessterraformstateop",
    "AssessTerraformStateRequestTypedDict": ".assessterraformstateop",
    "ComplianceAssessment": ".complianceassessment",
    "ComplianceAssessmentTypedDict": ".complianceassessment",
    "Framework": ".complianceassessment",
    "ControlAssessment": ".controlassessment",
    "ControlAssessmentStatus": ".controlassessment",
    "ControlAssessmentTypedDict": ".controlassessment",
    "EvidenceResponse": ".evidenceresponse",
    "EvidenceResponseStatus": ".evidenceresponse",
    "EvidenceResponseTypedDict": ".evidenceresponse",
    "DetectedFormat": ".firmwareresponse",
    "FirmwareResponse": ".firmwareresponse",
    "FirmwareResponseTypedDict": ".firmwareresponse",
    "PfrAssessment": ".firmwareresponse",
    "PfrAssessmentTypedDict": ".firmwareresponse",
    "SecurityFeature": ".firmwareresponse",
    "GenerateFipsAssessmentFormat": ".generatefipsassessmentop",
    "GenerateFipsAssessmentRequest": ".generatefipsassessmentop",
    "GenerateFipsAssessmentRequestTypedDict": ".generatefipsassessmentop",
    "MappingHit": ".mappinghit",
    "MappingHitTypedDict": ".mappinghit",
    "Security": ".security",
    "SecurityTypedDict": ".security",
}


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)
