const { v4: uuidv4 } = require('uuid');

async function populateRolesTable(queryInterface, Sequelize) {
  await queryInterface.bulkInsert('roles', [
    {
      id: uuidv4(),
      name: 'SUPER_ADMIN',
      description: 'Super administrator with full system access',
      created_at: new Date(),
      updated_at: new Date(),
    },
    {
      id: uuidv4(),
      name: 'ADMIN',
      description: 'Administrator with organisation management access',
      created_at: new Date(),
      updated_at: new Date(),
    },
    {
      id: uuidv4(),
      name: 'MEMBER',
      description: 'Regular member with basic access',
      created_at: new Date(),
      updated_at: new Date(),
    },
  ]);
}

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await populateRolesTable(queryInterface, Sequelize);
  },
  down: async (queryInterface, Sequelize) => {
    await queryInterface.bulkDelete('roles', null, {});
  },
};
