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

// MySQL devuelve COUNT(*) y columnas UNSIGNED INT como BigInt, que JSON.stringify
// no puede serializar. Lo convertimos a Number — los valores reales caben
// holgadamente en 53 bits para este dominio.
(BigInt.prototype as unknown as { toJSON: () => number }).toJSON = function () {
  return Number(this);
};

export const prisma = new PrismaClient({
  log: ["warn", "error"],
});
