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

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

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

  return Response.json({ cliente });
}
