import { NextResponse } from "next/server";
import { validateInquiry } from "@/lib/inquiry";

export async function POST(request: Request) {
  try {
    const body = await request.json();
    const result = validateInquiry(body);

    if (!result.ok) {
      return NextResponse.json({ ok: false, error: result.error }, { status: 400 });
    }

    console.info("[GRV Summit Inquiry]", JSON.stringify(result.data, null, 2));

    return NextResponse.json({ ok: true });
  } catch {
    return NextResponse.json({ ok: false, error: "Invalid JSON" }, { status: 400 });
  }
}
