import { PrismaClient } from "@/generated/prisma";

export async function GET(
  request: Request,
  { params }: { params: Promise<{ id: string }> },
) {
  const prisma = new PrismaClient();
  const { id } = await params;

  const cliente = await prisma.cliente.findUnique({
    where: {
      id: Number(id),
    },
    include: {
      registratori: {
        include: {
          interventi: true,
        },
      },
    },
  });

  return Response.json({ cliente });
}
