import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();

async function test() {
  console.log('Attempting to create an AnalyticsEvent (ESM)...');
  try {
    const event = await prisma.analyticsEvent.create({
      data: {
        type: 'TEST_ESM',
        path: '/test-esm',
        label: 'ESM Test',
        metadata: { source: 'esm-script' }
      }
    });
    console.log('SUCCESS! Event created:', event.id);
  } catch (error) {
    console.error('FAILURE! Prisma Error:');
    console.error(error.message);
    if (error.code) console.log('Prisma Code:', error.code);
  } finally {
    await prisma.$disconnect();
  }
}

test();
