'use server';

import { redirect } from 'next/navigation';
import { prisma } from '@/lib/prisma';

export async function deleteProof(formData: FormData) {
  const id = String(formData.get('id') ?? '');
  if (!id) return;

  // Chat messages cascade-delete automatically (set up on the Message relation).
  await prisma.designProof.delete({ where: { id } });

  redirect('/admin/proofs');
}
