const { PrismaClient } = require('@prisma/client');
const p = new PrismaClient({ datasourceUrl: 'postgresql://mopc:devpassword@localhost:5433/mopc' });

(async () => {
  const rounds = await p.round.findMany({
    orderBy: { sortOrder: 'asc' },
    select: { id: true, name: true, roundType: true, status: true, sortOrder: true, competitionId: true },
  });
  for (const r of rounds) console.log(r.sortOrder, '|', r.name, '|', r.roundType, '|', r.status, '|', r.id);

  console.log('\n--- File Requirements:');
  const reqs = await p.fileRequirement.findMany({ include: { round: { select: { name: true } } } });
  for (const r of reqs) console.log(r.round.name, '|', r.name, '|', r.isRequired, '|', r.id);

  console.log('\n--- Submission Windows:');
  const wins = await p.submissionWindow.findMany({ select: { id: true, name: true, roundNumber: true, windowOpenAt: true, windowCloseAt: true, competitionId: true } });
  for (const w of wins) console.log(w.name, '| round#', w.roundNumber, '| open:', w.windowOpenAt?.toISOString().slice(0,16), '| close:', w.windowCloseAt?.toISOString().slice(0,16));

  await p.$disconnect();
})();
