from __future__ import annotations

from importlib import import_module

__all__ = [
    "CodeExcerpt",
    "CodeExplainRetrieverV2",
    "CodeGraphRepository",
    "EvidenceItem",
    "ExplainIntent",
    "ExplainIntentBuilder",
    "ExplainPack",
    "LayeredRetrievalGateway",
    "PromptBudgeter",
    "TracePath",
]


def __getattr__(name: str):
    module_map = {
        "CodeExcerpt": "app.modules.rag.explain.models",
        "EvidenceItem": "app.modules.rag.explain.models",
        "ExplainIntent": "app.modules.rag.explain.models",
        "ExplainPack": "app.modules.rag.explain.models",
        "TracePath": "app.modules.rag.explain.models",
        "ExplainIntentBuilder": "app.modules.rag.explain.intent_builder",
        "PromptBudgeter": "app.modules.rag.explain.budgeter",
        "LayeredRetrievalGateway": "app.modules.rag.explain.layered_gateway",
        "CodeGraphRepository": "app.modules.rag.explain.graph_repository",
        "CodeExplainRetrieverV2": "app.modules.rag.explain.retriever_v2",
    }
    module_name = module_map.get(name)
    if module_name is None:
        raise AttributeError(name)
    module = import_module(module_name)
    return getattr(module, name)
