"""vSphere Automation REST routers.

Package init stays free of FastAPI so probes (e.g. pulumi-tests) can import
``app.vsphere.rest.coverage`` / matrix helpers without the full app stack.
``vsphere_rest_router`` is assembled lazily on first access.
"""

from __future__ import annotations

from typing import Any

__all__ = ["vsphere_rest_router"]


def __getattr__(name: str) -> Any:
    if name == "vsphere_rest_router":
        from fastapi import APIRouter

        from app.vsphere.rest.appliance_ext import router as appliance_ext_router
        from app.vsphere.rest.content_rest import router as content_router
        from app.vsphere.rest.inventory_ext import router as inventory_ext_router
        from app.vsphere.rest.legacy import router as legacy_router
        from app.vsphere.rest.nfc_rest import router as nfc_router
        from app.vsphere.rest.platform_rest import router as platform_router
        from app.vsphere.rest.router import router as core_router
        from app.vsphere.rest.stub_surface import router as stub_surface_router
        from app.vsphere.rest.tagging_rest import router as tagging_router
        from app.vsphere.rest.tasks import router as tasks_router
        from app.vsphere.rest.vm_ext import router as vm_ext_router

        vsphere_rest_router = APIRouter()
        vsphere_rest_router.include_router(core_router)
        vsphere_rest_router.include_router(tasks_router)
        vsphere_rest_router.include_router(vm_ext_router)
        vsphere_rest_router.include_router(inventory_ext_router)
        vsphere_rest_router.include_router(tagging_router)
        vsphere_rest_router.include_router(content_router)
        vsphere_rest_router.include_router(appliance_ext_router)
        vsphere_rest_router.include_router(platform_router)
        vsphere_rest_router.include_router(nfc_router)
        vsphere_rest_router.include_router(legacy_router)
        # Broadcom universe per-path stubs — must stay last so deep handlers win.
        vsphere_rest_router.include_router(stub_surface_router)
        globals()["vsphere_rest_router"] = vsphere_rest_router
        return vsphere_rest_router
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
