import { NextRequest, NextResponse } from "next/server"; import { requireArmaServer } from "@/lib/arma-bridge/server"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; /** * Called by the Arma 3 bridge (get_reinforcements) on the server's ~15 s * reinforcement cycle. Returns every enabled reinforcement pool with its * current balance and the Arma faction classes it counts, so the game can * attribute curator placements and render the Zeus HUD. */ export async function GET(req: NextRequest) { const auth = await requireArmaServer(req); if (auth instanceof NextResponse) return auth; const { payload } = auth; const pools = await payload.find({ collection: "reinforcement-pools", where: { enabled: { equals: true } }, limit: 200, depth: 0, overrideAccess: true, }); return NextResponse.json({ ok: true, pools: pools.docs.map((pool) => ({ poolId: pool.id, name: pool.name, available: pool.available ?? 0, armaFactions: pool.armaFactions ?? [], })), }); }