import { NextResponse } from "next/server";
import { getCurrentUser } from "@/lib/auth";
import { getRecommendationSuccessRates } from "@/lib/services/outcome-tracker";

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 rates = await getRecommendationSuccessRates(industry);
  return NextResponse.json({ rates });
}
