CREATE TABLE IF NOT EXISTS daily_activities (
  id INT AUTO_INCREMENT PRIMARY KEY,
  activity_date DATE NOT NULL,
  unit_id INT NOT NULL,
  level ENUM('Kadiv','Kasubdiv','KaUnit','Katim','Perawat','Lainnya') NOT NULL DEFAULT 'Lainnya',
  jenis_kegiatan ENUM('asuhan_keperawatan','manajerial','koordinasi','supervisi','evaluasi','monitoring','lainnya') DEFAULT 'lainnya',
  activity_name TEXT NOT NULL,
  start_time TIME DEFAULT NULL,
  end_time TIME DEFAULT NULL,
  description TEXT DEFAULT NULL,
  created_by INT DEFAULT NULL,
  updated_by INT DEFAULT NULL,
  created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  INDEX idx_daily_date (activity_date),
  INDEX idx_daily_unit (unit_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE daily_activities ADD COLUMN IF NOT EXISTS job_title VARCHAR(160) NULL AFTER level;
ALTER TABLE daily_activities ADD COLUMN IF NOT EXISTS coaching_unit_context VARCHAR(160) NULL AFTER job_title;
