import { NextResponse } from "next/server";
import { db } from "@/lib/db";
import { ensureSeed } from "@/lib/seed";
import { handleApiError } from "@/lib/api-helpers";

export async function GET() {
  try {
    await ensureSeed();
    const userCount = await db.user.count();
    return NextResponse.json({ setupRequired: userCount === 0 });
  } catch (err) {
    return handleApiError(err);
  }
}
