const bcrypt = require("bcryptjs");
const { v4: uuidv4 } = require("uuid");

module.exports = {
  up: async (queryInterface) => {
    const adminHashedPassword = await bcrypt.hash("adminsealspolinema24", 10);
    const teacherHashedPassword = await bcrypt.hash("sealsteacher24", 10);
    await queryInterface.bulkInsert("users", [
      {
        ID: uuidv4(),
        NAME_USERS: "Administrator",
        EMAIL: "adminseals@gmail.com",
        PASSWORD: adminHashedPassword,
        ROLE: "admin",
        IS_VALIDATED: 1,
        TIME_USERS: new Date(),
      },
      {
        ID: uuidv4(),
        NAME_USERS: "Initial Teacher",
        EMAIL: "sealsteach@gmail.com",
        PASSWORD: teacherHashedPassword,
        ROLE: "teacher",
        IS_VALIDATED: 1,
        TIME_USERS: new Date(),
      },
    ]);
  },
  down: async (queryInterface) => {
    await queryInterface.bulkDelete("users", {
      EMAIL: ["adminseals@gmail.com", "sealsteach@gmail.com"],
    });
  },
};
