import { NextRequest, NextResponse } from "next/server";
import { db } from "@/lib/db";
import { getApiUser } from "@/lib/apiAuth";
export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string; eventId: string }> }) {
  const { eventId } = await params;
  const apiUser = await getApiUser(req);
  if (!apiUser || apiUser.role !== "ADMIN")
    return NextResponse.json({ error: "Unauthorized" }, { status: 401 });

  await db.matchEvent.delete({ where: { id: eventId } });
  return NextResponse.json({ success: true });
}
