"""Govdoc 公文格式审查引擎内核。

保持包级导入轻量，避免在控制器注册阶段提前拉起 LLM/OpenAI 依赖。
真正执行审查时再按需导入 pipeline / result 模块。
"""

from __future__ import annotations

from typing import Any

__all__ = [
    "audit_file",
    "run",
    "AuditResult",
    "AuditSummary",
    "CheckedRule",
]


def audit_file(*args: Any, **kwargs: Any):
    from fastapi_modules.fastapi_leaudit.govdoc_engine.pipeline import audit_file as _audit_file

    return _audit_file(*args, **kwargs)


async def run(*args: Any, **kwargs: Any):
    from fastapi_modules.fastapi_leaudit.govdoc_engine.pipeline import run as _run

    return await _run(*args, **kwargs)


def __getattr__(name: str):
    if name in {"AuditResult", "AuditSummary", "CheckedRule"}:
        from fastapi_modules.fastapi_leaudit.govdoc_engine.engine.result import (
            AuditResult,
            AuditSummary,
            CheckedRule,
        )

        return {
            "AuditResult": AuditResult,
            "AuditSummary": AuditSummary,
            "CheckedRule": CheckedRule,
        }[name]
    raise AttributeError(name)
