const bcrypt = require('bcrypt');

module.exports = {
  up: async (queryInterface, Sequelize) => {
    // 샘플 사용자 10명 생성
    const users = [];
    for (let i = 1; i <= 10; i++) {
      const salt = await bcrypt.genSalt(10);
      const hashedPassword = await bcrypt.hash('1234', salt);
      users.push({
        username: `user${i}`,
        name: `샘플유저${i}`,
        email: `user${i}@test.com`,
        password: hashedPassword,
        role: 'user',
        status: 'active',
        createdAt: new Date(),
        updatedAt: new Date()
      });
    }
    await queryInterface.bulkInsert('Users', users, {});
  },
  down: async (queryInterface, Sequelize) => {
    await queryInterface.bulkDelete('Users', { email: { [Sequelize.Op.like]: 'user%@test.com' } }, {});
  }
};
