import { db } from "./client";
import { tierDefinitions } from "./schema";

async function seed() {
  console.log("Seeding tier definitions...");
  await db
    .insert(tierDefinitions)
    .values([
      {
        tier: "free",
        maxRecipes: 50,
        aiCallsPerMonth: 10,
        storageMb: 500,
        maxPublicRecipes: 5,
      },
      {
        tier: "pro",
        maxRecipes: 99999,
        aiCallsPerMonth: 500,
        storageMb: 10000,
        maxPublicRecipes: 99999,
      },
      {
        tier: "family",
        // -1 is the actual "no cap" sentinel (see lib/tiers.ts UNLIMITED) —
        // pro uses large-but-finite numbers instead; family is genuinely unlimited.
        maxRecipes: -1,
        aiCallsPerMonth: 2000,
        storageMb: 50000,
        maxPublicRecipes: -1,
      },
    ])
    .onConflictDoNothing();

  console.log("Seed complete.");
  process.exit(0);
}

seed().catch((err) => {
  console.error(err);
  process.exit(1);
});
