'use strict';

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

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    try {
      await queryInterface.bulkInsert('branches', [
        {
          branch_id: uuidv4(),
          branch_name: 'ALL',
          active_status: true,
          created_at: new Date(),
          updated_at: new Date(),
        },
        {
          branch_id: uuidv4(),
          branch_name: 'A',
          active_status: true,
          created_at: new Date(),
          updated_at: new Date(),
        },
        {
          branch_id: uuidv4(),
          branch_name: 'B',
          active_status: true,
          created_at: new Date(),
          updated_at: new Date(),
        },
        {
          branch_id: uuidv4(),
          branch_name: 'C',
          active_status: true,
          created_at: new Date(),
          updated_at: new Date(),
        },
        {
          branch_id: uuidv4(),
          branch_name: 'D',
          active_status: true,
          created_at: new Date(),
          updated_at: new Date(),
        },
      ]);
    } catch (error) {
      console.error('Error seeding branches data:', error);
    }
  },

  async down(queryInterface, Sequelize) {
    await queryInterface.bulkDelete('branches', null, {});
  },
};
