import { AppDataSource } from "../data-source";
import { FileUploadSettingsSeeder } from "../seed/file-upload-settings.seeder";

/**
 * Idempotently (re)seed the company onboarding file-upload settings, including
 * the nationality-based document sets (ethiopian / foreign). Run on demand:
 *   pnpm --filter @edr/freight-api seed:file-upload-settings
 */
async function run() {
  await AppDataSource.initialize();
  try {
    const seeder = new FileUploadSettingsSeeder(AppDataSource);
    await seeder.run();
    console.log("Seeded company onboarding file-upload settings.");
  } finally {
    await AppDataSource.destroy();
  }
}

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