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

/**
 * Seed Admin Users
 * Creates initial admin accounts
 */
module.exports = {
  up: async (queryInterface) => {
    const now = new Date();
    const hashedPassword = await bcrypt.hash('admin123', 10);

    const admins = [
      {
        id: uuidv4(),
        username: 'admin',
        password: hashedPassword,
        email: 'admin@example.com',
        role: 'super_admin',
        status: 'active',
        last_login_at: null,
        created_at: now,
        updated_at: now,
      },
    ];

    await queryInterface.bulkInsert('admin', admins);
  },

  down: async (queryInterface) => {
    await queryInterface.bulkDelete('admin', null, {});
  },
};
