-- Doctor availability table
CREATE TABLE IF NOT EXISTS doctor_availability (
  id INT AUTO_INCREMENT PRIMARY KEY,
  doctor_id INT NOT NULL,
  day_of_week VARCHAR(20) NOT NULL,
  start_time TIME NOT NULL DEFAULT '09:00:00',
  end_time TIME NOT NULL DEFAULT '17:00:00',
  slot_duration INT DEFAULT 30,
  max_patients INT DEFAULT 10,
  is_available TINYINT(1) DEFAULT 1,
  UNIQUE KEY unique_doctor_day (doctor_id, day_of_week)
);

-- Add missing columns to appointments
ALTER TABLE appointments
  ADD COLUMN IF NOT EXISTS meeting_link VARCHAR(500) DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS notes TEXT DEFAULT NULL,
  ADD COLUMN IF NOT EXISTS consultation_type VARCHAR(20) DEFAULT 'clinic';

-- Add missing columns to doctors
ALTER TABLE doctors
  ADD COLUMN IF NOT EXISTS profile_photo VARCHAR(255) DEFAULT NULL;
