import { NextResponse } from "next/server";
import { getCurrentUser } from "@/lib/auth";
import { getIndustryBenchmarks } from "@/lib/services/benchmark-engine";

export const dynamic = "force-dynamic";

export async function GET(req: Request) {
  const user = await getCurrentUser();
  if (!user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
  const industry = new URL(req.url).searchParams.get("industry");
  if (!industry) return NextResponse.json({ error: "industry required" }, { status: 400 });
  const benchmarks = await getIndustryBenchmarks(industry);
  return NextResponse.json({ benchmarks });
}
