/// <reference path="../pb_data/types.d.ts" />

$app.rootCmd.addCommand(
  new Command({
    use: "seed",
    run: (cmd, args) => {
      $app.importCollections(require(`${__hooks}/seed/schema.json`));

      $app.reloadCachedCollections();
      $app.reloadSettings();
      console.log("reload table done");

      console.log("start seeding data");
      require(`${__hooks}/seed/000_seed_t1.js`)($app);
      require(`${__hooks}/seed/001_seed_LessonsTypes.js`)($app);
      require(`${__hooks}/seed/002_LessonsCategories.js`)($app);
      require(`${__hooks}/seed/003_Categories.js`)($app);
      require(`${__hooks}/seed/004_clean_users.js`)($app);
      require(`${__hooks}/seed/005_Users_teacher.js`)($app);
      require(`${__hooks}/seed/006_Users_student.js`)($app);
      require(`${__hooks}/seed/010_Vocabularies.js`)($app);
      //
      require(`${__hooks}/seed/020_QuizLPCategories.js`)($app);
      require(`${__hooks}/seed/021_QuizLPQuestions.js`)($app);
      //
      require(`${__hooks}/seed/030_QuizMFCategories.js`)($app);
      require(`${__hooks}/seed/031_QuizMFQuestions.js`)($app);
      //
      require(`${__hooks}/seed/040_QuizCRCategories.js`)($app);

      $app.reloadCachedCollections();
      $app.reloadSettings();
    },
  })
);
