import { AppDataSource } from "../data-source";
import { DropdownSettingsSeeder } from "../seed/dropdown-settings.seeder";

/**
 * Seed the dropdown settings catalog (codes/labels only, no options) into an
 * EMPTY dropdown_settings table; skips entirely if any rows exist. Run on
 * demand:
 *   pnpm --filter @edr/freight-api seed:dropdown-settings
 */
async function run() {
  await AppDataSource.initialize();
  try {
    const seeder = new DropdownSettingsSeeder(AppDataSource);
    await seeder.run();
  } finally {
    await AppDataSource.destroy();
  }
}

run().catch((error) => {
  console.error("Failed to seed dropdown settings:", error);
  process.exit(1);
});
