        redis_ok = False
    return {"status": "ok" if db_ok and redis_ok else "degraded",
            "database": "up" if db_ok else "down", "redis": "up" if redis_ok else "down"}


# Frontend SPA-ish pages
@app.get("/", include_in_schema=False)
async def index():
    return FileResponse("static/index.html")


@app.get("/{page}", include_in_schema=False)
async def page(page: str):
    import os
    safe = page.replace("/", "")
    path = f"static/{safe}.html"
    if os.path.exists(path):
        return FileResponse(path)
    return JSONResponse({"error": "not found"}, status_code=404)
