from fastapi import APIRouter, Depends, Request from fastapi.responses import JSONResponse from app.api.dependencies import current_actor from app.services import system as service router = APIRouter() @router.get("/health") async def health(request: Request): return await service.health(request.app.state) @router.get("/live") async def live(): return {"status": "ok"} @router.get("/ready") async def ready(request: Request): checks = await service.readiness(request.app.state) healthy = all(checks.values()) return JSONResponse( status_code=200 if healthy else 503, content={"status": "ready" if healthy else "not_ready", "checks": checks}, ) @router.get("/capabilities", dependencies=[Depends(current_actor)]) async def capabilities(request: Request): return await service.capabilities(request.app.state) @router.get("/system/status", dependencies=[Depends(current_actor)]) async def status(request: Request): return await service.status(request.app.state)