CREATE TABLE IF NOT EXISTS monthly_work_confirmations (
  id INT AUTO_INCREMENT PRIMARY KEY,
  user_id INT NOT NULL COMMENT '작업자 user_id (workers.user_id)',
  year INT NOT NULL,
  month INT NOT NULL,
  status ENUM('pending', 'confirmed', 'rejected') NOT NULL DEFAULT 'pending',
  total_work_days INT DEFAULT 0 COMMENT '총 근무일수',
  total_work_hours DECIMAL(6,2) DEFAULT 0 COMMENT '총 근무시간',
  total_overtime_hours DECIMAL(6,2) DEFAULT 0 COMMENT '총 연장근로시간',
  vacation_days DECIMAL(4,2) DEFAULT 0 COMMENT '휴가 일수',
  mismatch_count INT DEFAULT 0 COMMENT '불일치 건수',
  reject_reason TEXT NULL COMMENT '반려 사유',
  confirmed_at TIMESTAMP NULL COMMENT '확인 일시',
  rejected_at TIMESTAMP NULL COMMENT '반려 일시',
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  UNIQUE KEY uq_user_year_month (user_id, year, month),
  KEY idx_year_month (year, month),
  KEY idx_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
COMMENT='월간 근무 확인 (승인/반려)'
