/* Demo seed: one org, one flagship hybrid conference with full lifecycle data,
   plus a second draft conference. Run: npm run db:seed */
import { PrismaClient } from "@prisma/client";
import bcrypt from "bcryptjs";
import { randomBytes } from "crypto";

const db = new PrismaClient();

const ALPHA = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
const code = (n: number) => Array.from(randomBytes(n)).map((b) => ALPHA[b % ALPHA.length]).join("");
const regCode = () => `CFX-${code(6)}`;
const certId = () => `CFX-CERT-${code(8)}`;

// Conference days: starts 2 days from now, runs 3 days (so it's "upcoming/live-ish")
const base = new Date();
base.setHours(0, 0, 0, 0);
const day = (offset: number, h: number, m = 0) => {
  const d = new Date(base);
  d.setDate(d.getDate() + offset);
  d.setHours(h, m, 0, 0);
  return d;
};
const D1 = 2, D2 = 3, D3 = 4; // day offsets

async function main() {
  console.log("Clearing existing data…");
  // order matters (FKs)
  await db.$transaction([
    db.auditLog.deleteMany(), db.notification.deleteMany(), db.feedback.deleteMany(),
    db.liveNote.deleteMany(), db.liveQuestion.deleteMany(), db.liveUpdate.deleteMany(),
    db.certificate.deleteMany(), db.scheduleItem.deleteMany(), db.checkIn.deleteMany(),
    db.volunteer.deleteMany(),
    db.payment.deleteMany(), db.registration.deleteMany(), db.coupon.deleteMany(),
    db.ticketType.deleteMany(), db.review.deleteMany(), db.submission.deleteMany(),
    db.sessionSpeaker.deleteMany(), db.session.deleteMany(), db.speaker.deleteMany(),
    db.sponsor.deleteMany(), db.announcement.deleteMany(), db.track.deleteMany(),
    db.room.deleteMany(), db.confMember.deleteMany(), db.conference.deleteMany(),
    db.orgMember.deleteMany(), db.organization.deleteMany(),
    db.authSession.deleteMany(), db.user.deleteMany(),
  ]);

  const pw = await bcrypt.hash("demo1234", 10);
  console.log("Users…");
  const [admin, organizer, attendee, reviewer, volunteer] = await Promise.all([
    db.user.create({ data: { email: "admin@demo.test", name: "Platform Admin", passwordHash: pw, platformRole: "SUPER_ADMIN", emailVerified: true } }),
    db.user.create({ data: { email: "organizer@demo.test", name: "Ananya Iyer", passwordHash: pw, organization: "Bharat Tech Foundation", designation: "Program Director", platformRole: "ORGANIZER", emailVerified: true } }),
    db.user.create({ data: { email: "attendee@demo.test", name: "Rohan Verma", passwordHash: pw, organization: "NIT Trichy", designation: "Research Scholar", emailVerified: true } }),
    db.user.create({ data: { email: "reviewer@demo.test", name: "Dr. Kavita Rao", passwordHash: pw, organization: "IISc Bengaluru", designation: "Associate Professor", emailVerified: true } }),
    db.user.create({ data: { email: "volunteer@demo.test", name: "Sameer Khan", passwordHash: pw, organization: "Bharat Tech Foundation", emailVerified: true } }),
  ]);

  console.log("Organization + conference…");
  const org = await db.organization.create({
    data: {
      name: "Bharat Tech Foundation",
      slug: "bharat-tech-foundation",
      description: "Non-profit advancing indigenous technology research and open innovation across India.",
      website: "https://example.org",
      members: { createMany: { data: [{ userId: organizer.id, role: "OWNER" }, { userId: volunteer.id, role: "MEMBER" }] } },
    },
  });

  const conf = await db.conference.create({
    data: {
      orgId: org.id,
      name: "TechBharat Summit 2026",
      slug: "techbharat-summit-2026",
      tagline: "India's flagship hybrid conference on AI, language technology, and digital public infrastructure.",
      description:
        "TechBharat Summit brings together researchers, founders, policymakers, and students for three days of keynotes, papers, panels, and workshops.\n\nThis year's edition focuses on Indian-language AI, DPI at population scale, and responsible deployment of generative models in government and industry. Join 500+ delegates in New Delhi or attend online from anywhere.",
      theme: "AI for a Billion Users",
      category: "TECH",
      type: "HYBRID",
      status: "LIVE",
      startAt: day(D1, 9),
      endAt: day(D3, 18),
      venueName: "Bharat Mandapam",
      venueAddress: "Pragati Maidan, Mathura Road",
      city: "New Delhi",
      country: "India",
      streamUrl: "https://www.youtube.com/watch?v=jNQXAC9IVRw",
      hashtags: "#TechBharat2026, #AIForBharat, #DigitalIndia",
      regOpensAt: day(-30, 9),
      regClosesAt: day(D3, 12),
      capacity: 500,
      languages: "English, Hindi",
      contactEmail: "hello@techbharat.example",
      contactPhone: "+91 11 4000 0000",
      primaryColor: "#e4610f",
      socialLinks: JSON.stringify({ twitter: "https://x.com/techbharat", linkedin: "https://linkedin.com/company/techbharat" }),
      cfpOpen: true,
      cfpDeadline: day(D1, 0),
      members: {
        createMany: {
          data: [
            { userId: organizer.id, role: "ORGANIZER" },
            { userId: volunteer.id, role: "VOLUNTEER" },
            { userId: reviewer.id, role: "REVIEWER" },
          ],
        },
      },
    },
  });

  console.log("Tracks, venue, halls…");
  const [trackAI, trackDPI, trackResearch] = await Promise.all([
    db.track.create({ data: { conferenceId: conf.id, name: "AI & Language Tech", color: "#e4610f" } }),
    db.track.create({ data: { conferenceId: conf.id, name: "Digital Public Infrastructure", color: "#0ea5e9" } }),
    db.track.create({ data: { conferenceId: conf.id, name: "Research Papers", color: "#8b5cf6" } }),
  ]);
  const venue = await db.venue.create({
    data: {
      conferenceId: conf.id,
      name: "Bharat Mandapam",
      address: "Pragati Maidan, Mathura Road",
      city: "New Delhi",
      mapUrl: "https://maps.google.com/?q=Bharat+Mandapam",
      description: "Main convention centre. Entry from Gate 4; paid parking at basement level P2.",
    },
  });
  const [hallMain, hallA, hallB] = await Promise.all([
    db.room.create({ data: { conferenceId: conf.id, venueId: venue.id, name: "Main Auditorium", capacity: 500, floor: "Ground" } }),
    db.room.create({ data: { conferenceId: conf.id, venueId: venue.id, name: "Hall A", capacity: 150, floor: "1" } }),
    db.room.create({ data: { conferenceId: conf.id, venueId: venue.id, name: "Hall B", capacity: 120, floor: "1" } }),
  ]);

  console.log("Speakers…");
  const speakerData = [
    ["Dr. Meera Krishnan", "Chief Scientist", "AI4Bharat", "Leads open Indic-language model efforts; previously at Microsoft Research. Keynote speaker on multilingual LLMs.", true, "KEYNOTE_SPEAKER"],
    ["Arjun Mehta", "CTO", "PaySwift", "Built UPI-scale payment rails; writes on DPI architecture.", true, "LEAD_SPEAKER"],
    ["Prof. Lakshmi Narayanan", "Professor", "IIT Madras", "Works on speech recognition for low-resource Indian languages.", true, "KEYNOTE_SPEAKER"],
    ["Divya Pillai", "Policy Lead", "Digital India Office", "Shapes national AI governance frameworks.", false, "GUEST_OF_HONOR"],
    ["Karan Singhania", "Founder", "VaaniAI", "Voice-first products for Bharat users.", false, "SPEAKER"],
    ["Sara Thomas", "Engineering Manager", "OpenMap India", "Geospatial DPI and open mapping.", false, "SPEAKER"],
  ] as const;
  const speakers = [] as { id: string; name: string; email: string }[];
  for (const [name, designation, organization, bio, featured, speakerType] of speakerData) {
    const slug = name.toLowerCase().replace(/[^a-z]+/g, "-").replace(/^-|-$/g, "");
    const email = slug.replace(/-/g, ".") + "@speaker.test";
    const s = await db.speaker.create({
      data: {
        conferenceId: conf.id, name, designation, organization, bio, featured, speakerType, email,
        socialLinks: JSON.stringify({
          linkedin: `https://www.linkedin.com/in/${slug}`,
          x: `https://x.com/${slug.replace(/-/g, "_")}`,
        }),
      },
    });
    speakers.push({ id: s.id, name, email });
  }

  console.log("Sessions…");
  const mk = (data: {
    title: string; type: string; d: number; sh: number; sm?: number; eh: number; em?: number;
    trackId?: string; roomId?: string; mode?: string; abstract?: string; speakerIdx?: number[];
  }) =>
    db.session.create({
      data: {
        conferenceId: conf.id,
        title: data.title,
        type: data.type,
        mode: data.mode ?? "HYBRID",
        startAt: day(data.d, data.sh, data.sm ?? 0),
        endAt: day(data.d, data.eh, data.em ?? 0),
        trackId: data.trackId,
        roomId: data.roomId,
        abstract: data.abstract,
        speakers: data.speakerIdx ? { create: data.speakerIdx.map((i) => ({ speakerId: speakers[i].id })) } : undefined,
      },
    });

  await mk({ title: "Registration & Welcome Coffee", type: "BREAK", d: D1, sh: 8, eh: 9, roomId: hallMain.id, mode: "PHYSICAL" });
  await mk({ title: "Opening Keynote: AI for a Billion Users", type: "KEYNOTE", d: D1, sh: 9, sm: 30, eh: 10, em: 30, trackId: trackAI.id, roomId: hallMain.id, speakerIdx: [0], abstract: "Where Indian-language AI stands today, what population-scale deployment demands, and the open problems worth working on." });
  await mk({ title: "Building DPI: Lessons from UPI at Scale", type: "TALK", d: D1, sh: 11, eh: 12, trackId: trackDPI.id, roomId: hallMain.id, speakerIdx: [1], abstract: "Architecture patterns that survived 10 billion transactions a month." });
  await mk({ title: "Speech Recognition for Low-Resource Languages", type: "TALK", d: D1, sh: 11, eh: 12, trackId: trackAI.id, roomId: hallA.id, speakerIdx: [2], abstract: "Data-efficient ASR approaches evaluated on 12 Indian languages." });
  await mk({ title: "Lunch & Networking", type: "BREAK", d: D1, sh: 12, sm: 30, eh: 14, mode: "PHYSICAL" });
  await mk({ title: "Panel: Regulating Generative AI in India", type: "PANEL", d: D1, sh: 14, eh: 15, em: 30, trackId: trackDPI.id, roomId: hallMain.id, speakerIdx: [3, 1, 0], abstract: "Policy, liability, and innovation — finding the balance." });
  await mk({ title: "Workshop: Fine-tuning Indic LLMs Hands-on", type: "WORKSHOP", d: D1, sh: 16, eh: 18, trackId: trackAI.id, roomId: hallB.id, speakerIdx: [4], abstract: "Bring a laptop. We fine-tune a 7B model on Hindi instruction data end to end." });

  await mk({ title: "Day 2 Keynote: Voice is the Interface for Bharat", type: "KEYNOTE", d: D2, sh: 9, sm: 30, eh: 10, em: 30, trackId: trackAI.id, roomId: hallMain.id, speakerIdx: [4] });
  await mk({ title: "Research Paper Session I", type: "TALK", d: D2, sh: 11, eh: 13, trackId: trackResearch.id, roomId: hallA.id, abstract: "Accepted papers presented in 15-minute slots." });
  await mk({ title: "Open Mapping as Public Infrastructure", type: "TALK", d: D2, sh: 11, eh: 12, trackId: trackDPI.id, roomId: hallB.id, speakerIdx: [5] });
  await mk({ title: "Networking Lounge & Expo", type: "NETWORKING", d: D2, sh: 15, eh: 18, mode: "PHYSICAL", abstract: "Meet sponsors and exhibitors on the expo floor." });

  await mk({ title: "Research Paper Session II", type: "TALK", d: D3, sh: 10, eh: 12, trackId: trackResearch.id, roomId: hallA.id });
  await mk({ title: "Closing Keynote & Awards", type: "KEYNOTE", d: D3, sh: 16, eh: 17, em: 30, roomId: hallMain.id, speakerIdx: [2, 0] });

  console.log("Tickets & coupons…");
  const [tEarly, tRegular, tStudent, tVip] = await Promise.all([
    db.ticketType.create({ data: { conferenceId: conf.id, name: "Early Bird", description: "Full 3-day access at launch pricing", price: 249900, quantity: 150, saleEndsAt: day(D1, 0), audience: "ATTENDEE" } }),
    db.ticketType.create({ data: { conferenceId: conf.id, name: "Regular", description: "Full 3-day access, all tracks", price: 399900, audience: "ATTENDEE" } }),
    db.ticketType.create({ data: { conferenceId: conf.id, name: "Student", description: "Valid student ID required at check-in", price: 99900, quantity: 100, audience: "STUDENT" } }),
    db.ticketType.create({ data: { conferenceId: conf.id, name: "VIP", description: "Front-row seating, speaker dinner, lounge access", price: 999900, quantity: 25, audience: "VIP" } }),
  ]);
  await db.ticketType.create({ data: { conferenceId: conf.id, name: "Virtual Pass", description: "Live stream + recordings + online Q&A", price: 49900, audience: "ATTENDEE" } });
  await db.coupon.createMany({
    data: [
      { conferenceId: conf.id, code: "STUDENT20", discountType: "PERCENT", value: 20, maxUses: 100 },
      { conferenceId: conf.id, code: "PARTNER50", discountType: "PERCENT", value: 50, maxUses: 20 },
    ],
  });

  console.log("Registrations, payments, check-ins…");
  const attendees = [
    ["Rohan Verma", "attendee@demo.test", "NIT Trichy", tStudent, "PHYSICAL", true, attendee.id],
    ["Priya Sharma", "priya@corp.test", "Infosys", tEarly, "PHYSICAL", true, null],
    ["Amit Patel", "amit@startup.test", "VaaniAI", tRegular, "PHYSICAL", false, null],
    ["Neha Gupta", "neha@univ.test", "Delhi University", tStudent, "PHYSICAL", true, null],
    ["John Matthew", "john@remote.test", "Google", tVip, "PHYSICAL", false, null],
    ["Fatima Sheikh", "fatima@ngo.test", "Digital Empowerment Foundation", tEarly, "VIRTUAL", false, null],
    ["Vikram Joshi", "vikram@gov.test", "MeitY", tRegular, "PHYSICAL", true, null],
    ["Li Wei", "li@intl.test", "NUS Singapore", tRegular, "VIRTUAL", false, null],
  ] as const;

  for (const [name, email, orgName, ticket, mode, checkIn, userId] of attendees) {
    const r = await db.registration.create({
      data: {
        regCode: regCode(),
        conferenceId: conf.id,
        ticketTypeId: ticket.id,
        userId: userId ?? undefined,
        name, email, organization: orgName, mode,
        status: "CONFIRMED",
        amount: ticket.price,
        createdAt: day(-Math.floor(Math.random() * 20) - 1, 12),
      },
    });
    await db.payment.create({
      data: { registrationId: r.id, amount: ticket.price, status: "SUCCESS", txnId: `txn_${code(10).toLowerCase()}` },
    });
    if (checkIn) {
      await db.checkIn.create({ data: { registrationId: r.id, type: "CONFERENCE", checkedInBy: "Sameer Khan" } });
    }
  }
  // one pending + one cancelled for realism
  const pending = await db.registration.create({
    data: { regCode: regCode(), conferenceId: conf.id, ticketTypeId: tRegular.id, name: "Deepak Nair", email: "deepak@pending.test", organization: "Freelance", mode: "PHYSICAL", status: "PENDING", amount: tRegular.price },
  });
  await db.payment.create({ data: { registrationId: pending.id, amount: tRegular.price, status: "FAILED", txnId: `txn_${code(10).toLowerCase()}` } });
  await db.registration.create({
    data: { regCode: regCode(), conferenceId: conf.id, ticketTypeId: tEarly.id, name: "Cancelled Person", email: "gone@nowhere.test", mode: "PHYSICAL", status: "CANCELLED", amount: tEarly.price },
  });

  console.log("Volunteer record…");
  await db.volunteer.create({
    data: {
      conferenceId: conf.id,
      userId: volunteer.id,
      name: "Sameer Khan",
      email: "volunteer@demo.test",
      phone: "+91 98100 00000",
      department: "Operations · Gate 4 team",
      linkedin: "https://www.linkedin.com/in/sameer-khan",
      areas: JSON.stringify(["checkin"]),
    },
  });

  console.log("Sponsors…");
  await db.sponsor.createMany({
    data: [
      { conferenceId: conf.id, name: "IndiaStack Cloud", tier: "TITLE", amount: 250000000, website: "https://example.com", description: "Sovereign cloud for public infrastructure.", boothNumber: "P-01" },
      { conferenceId: conf.id, name: "VaaniAI", tier: "GOLD", amount: 100000000, website: "https://example.com", description: "Voice AI for the next billion users.", boothNumber: "G-04" },
      { conferenceId: conf.id, name: "PaySwift", tier: "TECHNOLOGY_PARTNER", amount: 100000000, boothNumber: "G-05" },
      { conferenceId: conf.id, name: "DevSangam", tier: "SILVER", amount: 40000000, description: "India's developer community platform." },
      { conferenceId: conf.id, name: "Chai & Code", tier: "COMMUNITY_PARTNER", amount: 0, description: "Community partner" },
    ],
  });

  console.log("CFP submissions + reviews…");
  const sub1 = await db.submission.create({
    data: {
      conferenceId: conf.id, userId: attendee.id,
      title: "Low-Rank Adaptation for Hindi-English Code-Mixed Sentiment Analysis",
      abstract: "We present a parameter-efficient fine-tuning approach for sentiment analysis on Hindi-English code-mixed social media text. Using LoRA on a 7B multilingual base model, we achieve state-of-the-art F1 on three benchmark datasets while training under 1% of parameters. We release our models and the cleaned corpus.",
      category: "PAPER", keywords: "code-mixing, LoRA, sentiment analysis, Indic NLP",
      coAuthors: "S. Banerjee, T. Krishnamurthy", status: "UNDER_REVIEW",
    },
  });
  await db.review.create({
    data: { submissionId: sub1.id, reviewerId: reviewer.id, score: 8, status: "COMPLETED", recommendation: "ACCEPT", comments: "Solid methodology and useful released artifacts. Minor concerns about dataset overlap." },
  });
  await db.submission.create({
    data: {
      conferenceId: conf.id, userId: attendee.id,
      title: "A Survey of Speech Datasets for Scheduled Indian Languages",
      abstract: "This survey catalogues 47 publicly available speech datasets covering 19 of the 22 scheduled languages of India, analysing licence terms, recording conditions, and demographic balance, and identifies concrete gaps for future data collection efforts.",
      category: "POSTER", keywords: "speech, datasets, survey", status: "SUBMITTED",
    },
  });

  console.log("Announcements, notifications, certificates…");
  await db.announcement.createMany({
    data: [
      { conferenceId: conf.id, title: "Hall A workshop is full", body: "The Indic LLM fine-tuning workshop has hit capacity — a waitlist desk opens at 15:30 outside Hall B.", audience: "ATTENDEES", pinned: true },
      { conferenceId: conf.id, title: "Shuttle service from Pragati Maidan metro", body: "Free shuttles run every 15 minutes from Gate 4, 8:00–10:00 AM on all conference days.", audience: "ALL" },
    ],
  });
  await db.notification.createMany({
    data: [
      { userId: attendee.id, title: "TechBharat Summit 2026: Hall A workshop is full", body: "A waitlist desk opens at 15:30 outside Hall B.", link: `/c/${conf.slug}` },
      { userId: attendee.id, title: "Submission under review", body: "Your paper on code-mixed sentiment analysis is now under review." },
      { userId: reviewer.id, title: "New review assignment", body: "A paper has been assigned to you for review.", link: "/me" },
    ],
  });
  // A completed past conference with certificates, to demo verification
  const past = await db.conference.create({
    data: {
      orgId: org.id,
      name: "TechBharat Summit 2025",
      slug: "techbharat-summit-2025",
      tagline: "The 2025 edition — 420 delegates, 38 sessions.",
      description: "Last year's edition of the summit, kept for records and certificate verification.",
      category: "TECH", type: "PHYSICAL", status: "COMPLETED",
      startAt: day(-365, 9), endAt: day(-363, 18),
      venueName: "India Habitat Centre", city: "New Delhi", country: "India",
      primaryColor: "#0ea5e9",
      members: { create: { userId: organizer.id, role: "ORGANIZER" } },
    },
  });
  const pastTicket = await db.ticketType.create({ data: { conferenceId: past.id, name: "Delegate", price: 199900 } });
  const pastReg = await db.registration.create({
    data: { regCode: regCode(), conferenceId: past.id, ticketTypeId: pastTicket.id, userId: attendee.id, name: "Rohan Verma", email: "attendee@demo.test", status: "CONFIRMED", amount: 199900 },
  });
  await db.certificate.create({
    data: { certId: "CFX-CERT-DEMO2025", conferenceId: past.id, registrationId: pastReg.id, recipientName: "Rohan Verma", recipientEmail: "attendee@demo.test", type: "PARTICIPATION" },
  });
  await db.certificate.create({
    data: { certId: certId(), conferenceId: past.id, recipientName: "Dr. Meera Krishnan", recipientEmail: "dr.meera.krishnan@speaker.test", type: "SPEAKER" },
  });

  console.log("Live conference feed…");
  const minsAgo = (m: number) => new Date(Date.now() - m * 60000);
  const liveData: Array<Record<string, unknown>> = [
    { type: "TOPIC", title: "AI & India's Digital Future", body: "India needs to build AI systems that are multilingual, inclusive and accessible to every citizen.", speakerId: speakers[0].id, tags: "AI, DigitalIndia", featured: true, createdAt: minsAgo(2) },
    { type: "KEY_POINT", title: "AI adoption is moving from experimentation to deployment", body: "Production deployments across government and industry dominated the morning discussions.", speakerId: speakers[0].id, tags: "AI", createdAt: minsAgo(7) },
    { type: "QUOTE", title: "On inclusive technology", quote: "Technology must reach every citizen in the language they understand.", speakerId: speakers[0].id, tags: "AI, inclusion", featured: true, createdAt: minsAgo(12) },
    { type: "STATISTIC", title: "Multilingual AI adoption", statValue: "42%", statLabel: "increase in multilingual AI adoption year-on-year", tags: "AI", createdAt: minsAgo(18) },
    { type: "TOPIC", title: "Digital Public Infrastructure at population scale", body: "What UPI's architecture teaches the next wave of public AI systems.", speakerId: speakers[1].id, tags: "DPI", createdAt: minsAgo(22) },
    { type: "STATISTIC", title: "Government deployments", statValue: "15+", statLabel: "government AI deployments discussed", tags: "DPI, governance", createdAt: minsAgo(26) },
    { type: "KEY_POINT", title: "Public-private collaboration is accelerating innovation", body: "Panelists agreed sandbox programs shortened deployment cycles from years to months.", speakerId: speakers[3].id, tags: "governance", createdAt: minsAgo(31) },
    { type: "RESOURCE", title: "Keynote deck — AI for a Billion Users", link: "https://example.com/keynote.pdf", tags: "AI", createdAt: minsAgo(35) },
    { type: "ANNOUNCEMENT", title: "Lunch shifted to 1:15 PM", body: "To accommodate the extended panel discussion. Food courts on ground floor.", createdAt: minsAgo(40) },
    { type: "TOPIC", title: "Opening remarks", body: "Conference chair sets the theme: AI for a Billion Users.", createdAt: minsAgo(55) },
  ];
  for (const u of liveData) {
    await db.liveUpdate.create({ data: { conferenceId: conf.id, ...(u as object), createdById: organizer.id } as never });
  }
  await db.liveQuestion.createMany({
    data: [
      { conferenceId: conf.id, userId: attendee.id, name: "Rohan Verma", question: "How can multilingual AI be deployed across smaller government departments with limited budgets?", status: "APPROVED", createdAt: minsAgo(15) },
      { conferenceId: conf.id, name: "Neha Gupta", question: "Will the keynote slides and datasets be shared with attendees?", status: "APPROVED", createdAt: minsAgo(28) },
      { conferenceId: conf.id, name: "Amit Patel", question: "What is the panel's view on open-weight models for public infrastructure?", status: "PENDING", createdAt: minsAgo(5) },
    ],
  });

  console.log("Audit trail…");
  await db.auditLog.createMany({
    data: [
      { userId: organizer.id, conferenceId: conf.id, action: "conference.create", entity: "Conference", entityId: conf.id },
      { userId: organizer.id, conferenceId: conf.id, action: "conference.status.published" },
      { userId: attendee.id, conferenceId: conf.id, action: "registration.create" },
      { userId: reviewer.id, conferenceId: conf.id, action: "review.complete" },
    ],
  });

  console.log(`
Seeded ✔
  Conference:  http://localhost:3300/c/${conf.slug}
  Logins (password demo1234):
    organizer@demo.test  — organizer workspace
    attendee@demo.test   — attendee portal (ticket, submission, certificate)
    reviewer@demo.test   — review inbox
    volunteer@demo.test  — check-in desk access
    admin@demo.test      — super admin
  Demo certificate: http://localhost:3300/verify/CFX-CERT-DEMO2025`);
}

main().finally(() => db.$disconnect());
