from __future__ import annotations

from typing import Any, TYPE_CHECKING

if TYPE_CHECKING:  # pragma: no cover
    from .chapter import ChapterRAG, ChapterRag
    from .full_doc_in_ctx import FullDocInCtxRag
    from .pgvector import PgVectorRag, build_pgvector_rag
    from .simple import LlamaIndexRag, SimplePdfRag, create_simple_llama_index_pdf_rag
    from .simple_docling import SimpleDoclingRag
    from .simple_docling_full_ctx import SimpleDoclingFullCtxRag

__all__ = [
    "LlamaIndexRag",
    "SimplePdfRag",
    "create_simple_llama_index_pdf_rag",
    "PgVectorRag",
    "build_pgvector_rag",
    "FullDocInCtxRag",
    "SimpleDoclingRag",
    "SimpleDoclingFullCtxRag",
    "ChapterRag",
    "ChapterRAG",
]


def __getattr__(name: str) -> Any:  # pragma: no cover
    if name in ("LlamaIndexRag", "SimplePdfRag", "create_simple_llama_index_pdf_rag"):
        from .simple import (
            LlamaIndexRag as _LlamaIndexRag,
            SimplePdfRag as _SimplePdfRag,
            create_simple_llama_index_pdf_rag as _create_simple_llama_index_pdf_rag,
        )

        return {
            "LlamaIndexRag": _LlamaIndexRag,
            "SimplePdfRag": _SimplePdfRag,
            "create_simple_llama_index_pdf_rag": _create_simple_llama_index_pdf_rag,
        }[name]
    if name in ("PgVectorRag", "build_pgvector_rag"):
        from .pgvector import PgVectorRag as _PgVectorRag, build_pgvector_rag as _build_pgvector_rag

        return {"PgVectorRag": _PgVectorRag, "build_pgvector_rag": _build_pgvector_rag}[name]
    if name == "FullDocInCtxRag":
        from .full_doc_in_ctx import FullDocInCtxRag as _FullDocInCtxRag

        return _FullDocInCtxRag
    if name == "SimpleDoclingRag":
        from .simple_docling import SimpleDoclingRag as _SimpleDoclingRag

        return _SimpleDoclingRag
    if name == "SimpleDoclingFullCtxRag":
        from .simple_docling_full_ctx import SimpleDoclingFullCtxRag as _SimpleDoclingFullCtxRag

        return _SimpleDoclingFullCtxRag
    if name in ("ChapterRag", "ChapterRAG"):
        from .chapter import ChapterRag as _ChapterRag, ChapterRAG as _ChapterRAG

        return {"ChapterRag": _ChapterRag, "ChapterRAG": _ChapterRAG}[name]
    raise AttributeError(name)
