-- Step 21: Management reporting and correction/support fields.
-- Run after Step 18.

ALTER TABLE cameraman_attendance
  MODIFY status ENUM('Present','Late','Absent','Leave','Short Leave','Issue Reported') DEFAULT 'Present';

CREATE TABLE IF NOT EXISTS schedule_resource_changes (
  id INT AUTO_INCREMENT PRIMARY KEY,
  source_type ENUM('schedule','daily_instance') NOT NULL,
  source_id INT NOT NULL,
  old_cameraman_id INT NULL,
  new_cameraman_id INT NULL,
  old_camera_id INT NULL,
  new_camera_id INT NULL,
  old_room_id INT NULL,
  new_room_id INT NULL,
  reason TEXT NULL,
  changed_by INT NULL,
  changed_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  INDEX idx_source (source_type, source_id),
  INDEX idx_changed_at (changed_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
