from fastapi import APIRouter
from app.services import prometheus

router = APIRouter()


@router.get("/network/status")
async def network_status():
    nfs = await prometheus.get_nf_status()
    up   = sum(1 for n in nfs if n["state"] == "up")
    down = sum(1 for n in nfs if n["state"] == "down")
    return {"nfs": nfs, "summary": {"up": up, "down": down, "total": len(nfs)}}
