import sys
from pathlib import Path

print("=== HERMES V4 SMOKE TEST ===")

try:
    from nfl import app
    from hermes_api import obtener_usuario_hermes
    from hermes_v4_adapter import preguntar_hermes_panel

    import hermes_api

    if not hasattr(app, "routes"):
        raise RuntimeError("FastAPI no disponible")

    if obtener_usuario_hermes not in app.dependency_overrides:
        raise RuntimeError("Autenticacion no configurada")

    if hermes_api.preguntar_hermes_v2 if False else False:
        pass

    codigo = Path("hermes_api.py").read_text(
        encoding="utf-8"
    )

    if "from hermes_v4_adapter import preguntar_hermes_panel" not in codigo:
        raise RuntimeError("V4 no esta activo")

    print("FASTAPI: OK")
    print("AUTENTICACION: OK")
    print("CEREBRO V4: OK")
    print("SMOKE TEST: OK")

except Exception as e:
    print("ERROR:", str(e))
    sys.exit(1)
