'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    // Get company and plant IDs (assuming default company_id = 1, plant_id = 1)
    const companyId = 1;
    const plantId = 1;

    const instruments = [
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'VERNIER CALIPER',
        range: '0-300',
        least_count: '0.02',
        make: 'MITUTOYO',
        instrument_id: 'RI-VC-01',
        serial_no: '19178996',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'BENDING',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'VERNIER CALIPER',
        range: '0-300',
        least_count: '0.02',
        make: 'MITUTOYO',
        instrument_id: 'RI-VC-02',
        serial_no: '18046625',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'VERNIER CALIPER DIGITAL',
        range: '0-200',
        least_count: '0.02',
        make: 'INSUZE',
        instrument_id: 'RI-VC-04',
        serial_no: '2106212904',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'VERNIER CALIPER',
        range: '0-200',
        least_count: '0.02',
        make: 'MITUTOYO',
        instrument_id: 'RI-VC-05',
        serial_no: '17076421',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'BENDING',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'MICROMETER',
        range: '0-25',
        least_count: '0.01',
        make: 'MITUTOYO',
        instrument_id: 'RI-MM-01',
        serial_no: '66299977',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'FEELER GAUGE',
        range: '0.05 - 1',
        least_count: null,
        make: 'MITUTOYO',
        instrument_id: 'RI-FG-01',
        serial_no: '184-304S',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'RADIUS GAUGE',
        range: '1.0-7',
        least_count: null,
        make: 'KRISTELL',
        instrument_id: 'RI-RG-01',
        serial_no: '15121A',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'RADIUS GAUGE',
        range: '7.5-15',
        least_count: null,
        make: 'KRISTELL',
        instrument_id: 'RI-RG-02',
        serial_no: null,
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M3*0.5',
        least_count: null,
        make: 'QMI',
        instrument_id: 'RI-TPG-01',
        serial_no: 'CZ-165',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M4*0.7',
        least_count: null,
        make: 'QMI',
        instrument_id: 'RI-TPG-02',
        serial_no: 'CZ-255',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M5*0.8',
        least_count: null,
        make: 'QMG',
        instrument_id: 'RI-TPG-03',
        serial_no: 'PV-227',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M6*1',
        least_count: null,
        make: 'QMG',
        instrument_id: 'RI-TPG-04',
        serial_no: 'PK-1435',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M8*1.25',
        least_count: null,
        make: 'QMG',
        instrument_id: 'RI-TPG-05',
        serial_no: 'P-371',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M10*1.5',
        least_count: null,
        make: 'QMG',
        instrument_id: 'RI-TPG-06',
        serial_no: 'Z-427',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'THREAD PLUG GAUGE',
        range: 'M12*1.75',
        least_count: null,
        make: 'QMG',
        instrument_id: 'RI-TPG-07',
        serial_no: 'Z-457',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'TRY SQUARE',
        range: '100 X 75',
        least_count: null,
        make: 'SAMRAJ',
        instrument_id: 'RI-TS-01-2',
        serial_no: null,
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'BENDING',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'TRY SQUARE',
        range: '150 X 100',
        least_count: null,
        make: 'METRO',
        instrument_id: 'RI-TS-01-1',
        serial_no: null,
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'BENDING',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'TRY SQUARE',
        range: '150 X 100',
        least_count: null,
        make: 'METRO',
        instrument_id: 'RI-TS-02',
        serial_no: null,
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'BENDING',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'TRY SQUARE',
        range: '300 X 100',
        least_count: null,
        make: 'SAMRAJ',
        instrument_id: 'RI-TS-03-4',
        serial_no: null,
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12Month',
        location: 'BENDING',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'TEMPERATURE CONTROL',
        range: '0-200°',
        least_count: null,
        make: 'SELEC',
        instrument_id: 'RI-OV-01',
        serial_no: null,
        calibrated_on: '2024-12-24',
        due_date: '2025-12-23',
        frequency: '12Month',
        location: 'PowederCoating',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'OVEN TIMER',
        range: '0-59MINS',
        least_count: null,
        make: 'SELEC',
        instrument_id: 'RI-OV-02',
        serial_no: null,
        calibrated_on: '2024-12-24',
        due_date: '2025-12-23',
        frequency: '12Month',
        location: 'PowederCoating',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'DFT Meter',
        range: '1 mic',
        least_count: '0-1500 mic',
        make: 'Defelsko',
        instrument_id: 'RI-CTG-01',
        serial_no: 'FS 378814',
        calibrated_on: '2025-01-11',
        due_date: '2026-01-10',
        frequency: '12 Month',
        location: 'QUALITY',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      },
      {
        company_id: companyId,
        plant_id: plantId,
        description: 'DIGITAL TIMER',
        range: 'XT 546',
        least_count: '0.1 MIN 99.9',
        make: 'BELLTONICS',
        instrument_id: 'RI-DT-01',
        serial_no: null,
        calibrated_on: '2024-12-24',
        due_date: '2025-12-23',
        frequency: '12 Month',
        location: 'PowederCoating',
        remarks: 'GOOD',
        status: 'GOOD',
        created_at: new Date(),
        updated_at: new Date()
      }
    ];

    await queryInterface.bulkInsert('measuring_instruments', instruments, {});
  },

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