-- Sample data for testing
USE medbooking;

-- Insert practitioners
INSERT INTO practitioners (email, phone, name, password_hash) VALUES
('dr.martin@example.com', '0612345678', 'Dr. Martin', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
('dr.dupont@example.com', '0698765432', 'Dr. Dupont', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi');

-- Insert patients
INSERT INTO patients (name, phone, email, consent_sms) VALUES
('Marie Dupont', '+33612345678', 'marie.dupont@email.com', 1),
('Jean Martin', '+33698765432', 'jean.martin@email.com', 1),
('Sophie Bernard', '+33711223344', NULL, 1),
('Luc Moreau', '+33655667788', 'luc.moreau@email.com', 1);

-- Insert availabilities for Dr. Martin (practitioner_id = 1)
INSERT INTO availabilities (practitioner_id, day_of_week, start_time, end_time, slot_duration, is_recurring) VALUES
(1, 'monday', '09:00:00', '12:00:00', 30, 1),
(1, 'monday', '14:00:00', '18:00:00', 30, 1),
(1, 'wednesday', '09:00:00', '17:00:00', 45, 1),
(1, 'friday', '10:00:00', '16:00:00', 30, 1);

-- Insert some appointments
INSERT INTO appointments (practitioner_id, patient_id, start, end, status, cancellation_token) VALUES
(1, 1, CONCAT(CURDATE(), ' 09:00:00'), CONCAT(CURDATE(), ' 09:30:00'), 'confirmed', MD5(CONCAT('apt1', NOW()))),
(1, 2, CONCAT(CURDATE(), ' 10:30:00'), CONCAT(CURDATE(), ' 11:00:00'), 'confirmed', MD5(CONCAT('apt2', NOW()))),
(1, 3, CONCAT(CURDATE(), ' 14:00:00'), CONCAT(CURDATE(), ' 14:30:00'), 'booked', MD5(CONCAT('apt3', NOW()))),
(1, 4, CONCAT(CURDATE(), ' 15:30:00'), CONCAT(CURDATE(), ' 16:00:00'), 'confirmed', MD5(CONCAT('apt4', NOW())));

-- Add tomorrow's appointments
INSERT INTO appointments (practitioner_id, patient_id, start, end, status, cancellation_token) VALUES
(1, 1, DATE_ADD(CONCAT(CURDATE(), ' 09:00:00'), INTERVAL 1 DAY), DATE_ADD(CONCAT(CURDATE(), ' 09:30:00'), INTERVAL 1 DAY), 'booked', MD5(CONCAT('apt5', NOW()))),
(1, 2, DATE_ADD(CONCAT(CURDATE(), ' 14:00:00'), INTERVAL 1 DAY), DATE_ADD(CONCAT(CURDATE(), ' 14:30:00'), INTERVAL 1 DAY), 'confirmed', MD5(CONCAT('apt6', NOW())));

-- Insert practitioner settings
INSERT INTO practitioner_settings (practitioner_id, msg_confirmation, msg_reminder, msg_cancellation) VALUES
(1,
 'Bonjour {patient_name}, votre RDV avec {practitioner_name} est confirmé le {date} à {time}. Pour annuler: {cancel_link}',
 'Rappel: RDV demain {date} à {time} avec {practitioner_name}. Pour annuler: {cancel_link}',
 'Votre RDV du {date} à {time} avec {practitioner_name} a été annulé. Merci de votre compréhension.');
