import { NextResponse } from "next/server";
import { requireAdminApiUser } from "@/lib/auth/admin";
import { getLegalKpisForUser } from "@/lib/legal/server";

export async function GET() {
  const user = await requireAdminApiUser();

  if (!user) {
    return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
  }

  const kpis = await getLegalKpisForUser(user.id);
  return NextResponse.json({ ok: true, kpis });
}
