import { prisma } from "@stamp/shared";

const tracks = [
  {
    title: "朝天宫之歌",
    subtitle: "金陵千年韵",
    audioFile: "/uploads/music/chaotiangong.m4a",
  },
];

async function seed() {
  console.log("Seeding music...");

  await prisma.music.deleteMany();

  const created = [];
  for (let i = 0; i < tracks.length; i++) {
    const t = tracks[i];
    const music = await prisma.music.create({
      data: {
        title: t.title,
        subtitle: t.subtitle,
        audioFile: t.audioFile,
        sortOrder: i + 1,
        enabled: true,
      },
    });
    created.push(music);
  }

  console.log(`Created ${created.length} music track(s)`);
  console.log("\nMusic IDs for testing:");
  created.forEach((m) => {
    console.log(`  ${m.sortOrder}. ${m.title}: /music/${m.id}`);
  });

  console.log("\nSeed complete!");
}

seed()
  .catch((e) => {
    console.error(e);
    process.exit(1);
  })
  .finally(() => prisma.$disconnect());
