const pool = require('./database');

async function seed() {
  try {
    const today = '2026-07-26';
    await pool.query(`
      INSERT INTO production_attendance (worker_id, worker_type, log_date, status) VALUES
      ('EMP001', 'permanent', '${today}', 'Present'),
      ('EMP002', 'permanent', '${today}', 'Present'),
      ('EMP003', 'permanent', '${today}', 'Present'),
      ('EMP004', 'permanent', '${today}', 'Present'),
      ('EMP005', 'permanent', '${today}', 'Present'),
      ('EMP006', 'permanent', '${today}', 'Absent'),
      ('OUT-001', 'outsourced', '${today}', 'Present'),
      ('OUT-002', 'outsourced', '${today}', 'Present'),
      ('OUT-003', 'outsourced', '${today}', 'Present'),
      ('OUT-004', 'outsourced', '${today}', 'Absent')
      ON CONFLICT (worker_id, log_date) DO UPDATE SET status = EXCLUDED.status;
    `);
    console.log('Successfully seeded attendance for all employees and outsourced workers for today:', today);
  } catch (err) {
    console.error('Error seeding attendance:', err);
  } finally {
    await pool.end();
  }
}

seed();
