const DEFAULT_PRISMA_SLOW_QUERY_MS = 300;

export function resolvePrismaSlowQueryThreshold(): number {
  const parsed = Number(process.env.PRISMA_SLOW_QUERY_MS);
  if (!Number.isFinite(parsed) || parsed <= 0) return DEFAULT_PRISMA_SLOW_QUERY_MS;
  return Math.floor(parsed);
}

export function shouldLogPrismaQuery(durationMs: number, thresholdMs: number): boolean {
  return durationMs >= thresholdMs;
}
