import 'dotenv/config';
import 'temporal-polyfill/full/global';
import postgres from '@prisma/orm-postgres/runtime';
import type { Contract } from './contract.d';
import contractJson from './contract.json' with { type: 'json' };

// URL is validated at application startup via loadAppConfig().
// Prisma connects lazily, which keeps unit tests free of a live database.
export const db = postgres<Contract>({
  contractJson,
  url: process.env['DATABASE_URL'],
});
