-- ============================================
-- INSTALLATION BASE DE DONNÉES
-- Script pour phpMyAdmin - Copier/Coller directement
-- ============================================
-- 
-- INSTRUCTIONS :
-- 1. Créez d'abord la base de données "resa_detailing" dans phpMyAdmin
-- 2. Sélectionnez cette base de données
-- 3. Allez dans l'onglet "SQL"
-- 4. Copiez-collez TOUT ce script
-- 5. Cliquez sur "Exécuter"
-- ============================================

-- ============================================
-- TABLE: businesses (Entreprises)
-- ============================================
CREATE TABLE IF NOT EXISTS `businesses` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL UNIQUE,
  `name` VARCHAR(255) NOT NULL,
  `logo` VARCHAR(500) DEFAULT NULL,
  `banner` VARCHAR(500) DEFAULT NULL,
  `favicon` VARCHAR(500) DEFAULT NULL,
  `phone` VARCHAR(50) DEFAULT NULL,
  `email` VARCHAR(255) DEFAULT NULL,
  `address_street` VARCHAR(255) DEFAULT NULL,
  `address_city` VARCHAR(255) DEFAULT NULL,
  `address_postal_code` VARCHAR(50) DEFAULT NULL,
  `address_country` VARCHAR(100) DEFAULT 'France',
  `currency` VARCHAR(10) DEFAULT 'EUR',
  `website` VARCHAR(500) DEFAULT NULL,
  `social_facebook` VARCHAR(500) DEFAULT NULL,
  `social_instagram` VARCHAR(500) DEFAULT NULL,
  `social_tiktok` VARCHAR(500) DEFAULT NULL,
  `main_color` VARCHAR(50) DEFAULT '#0ea5e9',
  `page_title` VARCHAR(255) DEFAULT NULL,
  `page_description` TEXT DEFAULT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: vehicle_types (Types de véhicules)
-- ============================================
CREATE TABLE IF NOT EXISTS `vehicle_types` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `description` TEXT DEFAULT NULL,
  `image` VARCHAR(500) DEFAULT NULL,
  `display_order` INT(11) DEFAULT 0,
  `active` TINYINT(1) DEFAULT 1,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_business` (`business_id`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: packs (Packs de nettoyage)
-- ============================================
CREATE TABLE IF NOT EXISTS `packs` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `slug` VARCHAR(255) NOT NULL,
  `description` TEXT DEFAULT NULL,
  `image` VARCHAR(500) DEFAULT NULL,
  `display_order` INT(11) DEFAULT 0,
  `active` TINYINT(1) DEFAULT 1,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_business` (`business_id`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: pack_pricing (Tarifs des packs par véhicule)
-- ============================================
CREATE TABLE IF NOT EXISTS `pack_pricing` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `pack_id` INT(11) NOT NULL,
  `vehicle_type_id` INT(11) NOT NULL,
  `price_ht` DECIMAL(10,2) NOT NULL,
  `price_ttc` DECIMAL(10,2) NOT NULL,
  `duration` DECIMAL(4,2) NOT NULL COMMENT 'Durée en heures',
  `available` TINYINT(1) DEFAULT 1,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_pack_vehicle` (`pack_id`, `vehicle_type_id`),
  KEY `idx_pack` (`pack_id`),
  KEY `idx_vehicle` (`vehicle_type_id`),
  FOREIGN KEY (`pack_id`) REFERENCES `packs`(`id`) ON DELETE CASCADE,
  FOREIGN KEY (`vehicle_type_id`) REFERENCES `vehicle_types`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: options (Options supplémentaires)
-- ============================================
CREATE TABLE IF NOT EXISTS `options` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `description` TEXT DEFAULT NULL,
  `icon` VARCHAR(100) DEFAULT NULL,
  `category` VARCHAR(100) DEFAULT NULL,
  `display_order` INT(11) DEFAULT 0,
  `active` TINYINT(1) DEFAULT 1,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_business` (`business_id`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: option_pricing (Tarifs des options par véhicule)
-- ============================================
CREATE TABLE IF NOT EXISTS `option_pricing` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `option_id` INT(11) NOT NULL,
  `vehicle_type_id` INT(11) NOT NULL,
  `price_ht` DECIMAL(10,2) NOT NULL,
  `price_ttc` DECIMAL(10,2) NOT NULL,
  `duration` DECIMAL(4,2) DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_option_vehicle` (`option_id`, `vehicle_type_id`),
  KEY `idx_option` (`option_id`),
  KEY `idx_vehicle` (`vehicle_type_id`),
  FOREIGN KEY (`option_id`) REFERENCES `options`(`id`) ON DELETE CASCADE,
  FOREIGN KEY (`vehicle_type_id`) REFERENCES `vehicle_types`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: option_availability (Disponibilité options par véhicule)
-- ============================================
CREATE TABLE IF NOT EXISTS `option_availability` (
  `option_id` INT(11) NOT NULL,
  `vehicle_type_id` INT(11) NOT NULL,
  PRIMARY KEY (`option_id`, `vehicle_type_id`),
  FOREIGN KEY (`option_id`) REFERENCES `options`(`id`) ON DELETE CASCADE,
  FOREIGN KEY (`vehicle_type_id`) REFERENCES `vehicle_types`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: working_hours (Horaires d'ouverture)
-- ============================================
CREATE TABLE IF NOT EXISTS `working_hours` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `day_of_week` INT(11) NOT NULL COMMENT '0=Lundi, 6=Dimanche',
  `open_time` TIME DEFAULT NULL,
  `close_time` TIME DEFAULT NULL,
  `closed` TINYINT(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_business_day` (`business_id`, `day_of_week`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: blocked_dates (Dates bloquées)
-- ============================================
CREATE TABLE IF NOT EXISTS `blocked_dates` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `date` DATE NOT NULL,
  `reason` TEXT DEFAULT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_business_date` (`business_id`, `date`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: clients (Clients)
-- ============================================
CREATE TABLE IF NOT EXISTS `clients` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `first_name` VARCHAR(255) NOT NULL,
  `last_name` VARCHAR(255) NOT NULL,
  `email` VARCHAR(255) NOT NULL,
  `phone` VARCHAR(50) DEFAULT NULL,
  `address_street` VARCHAR(255) DEFAULT NULL,
  `address_city` VARCHAR(255) DEFAULT NULL,
  `address_postal_code` VARCHAR(50) DEFAULT NULL,
  `total_spent` DECIMAL(10,2) DEFAULT 0.00,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_business` (`business_id`),
  KEY `idx_email` (`email`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: reservations (Réservations)
-- ============================================
CREATE TABLE IF NOT EXISTS `reservations` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `client_id` INT(11) DEFAULT NULL,
  `vehicle_type_id` INT(11) NOT NULL,
  `vehicle_details` TEXT DEFAULT NULL,
  `pack_id` INT(11) NOT NULL,
  `location_type` VARCHAR(100) DEFAULT 'local',
  `location_address` TEXT DEFAULT NULL,
  `appointment_date` DATE NOT NULL,
  `appointment_start_time` TIME NOT NULL,
  `appointment_end_time` TIME NOT NULL,
  `subtotal_ht` DECIMAL(10,2) NOT NULL,
  `subtotal_ttc` DECIMAL(10,2) NOT NULL,
  `deposit_percent` DECIMAL(5,2) DEFAULT 15.00,
  `deposit_ht` DECIMAL(10,2) NOT NULL,
  `deposit_ttc` DECIMAL(10,2) NOT NULL,
  `remaining_ht` DECIMAL(10,2) NOT NULL,
  `remaining_ttc` DECIMAL(10,2) NOT NULL,
  `deposit_paid` TINYINT(1) DEFAULT 0,
  `deposit_payment_id` VARCHAR(255) DEFAULT NULL,
  `full_payment_paid` TINYINT(1) DEFAULT 0,
  `full_payment_id` VARCHAR(255) DEFAULT NULL,
  `payment_method` VARCHAR(100) DEFAULT NULL,
  `status` VARCHAR(50) DEFAULT 'pending' COMMENT 'pending, confirmed, completed, cancelled',
  `special_instructions` TEXT DEFAULT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_business` (`business_id`),
  KEY `idx_client` (`client_id`),
  KEY `idx_date` (`appointment_date`),
  KEY `idx_status` (`status`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE,
  FOREIGN KEY (`client_id`) REFERENCES `clients`(`id`) ON DELETE SET NULL,
  FOREIGN KEY (`vehicle_type_id`) REFERENCES `vehicle_types`(`id`),
  FOREIGN KEY (`pack_id`) REFERENCES `packs`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: reservation_options (Options d'une réservation)
-- ============================================
CREATE TABLE IF NOT EXISTS `reservation_options` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `reservation_id` INT(11) NOT NULL,
  `option_id` INT(11) NOT NULL,
  `price_ht` DECIMAL(10,2) NOT NULL,
  `price_ttc` DECIMAL(10,2) NOT NULL,
  `duration` DECIMAL(4,2) DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `idx_reservation` (`reservation_id`),
  FOREIGN KEY (`reservation_id`) REFERENCES `reservations`(`id`) ON DELETE CASCADE,
  FOREIGN KEY (`option_id`) REFERENCES `options`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: email_templates (Modèles d'emails)
-- ============================================
CREATE TABLE IF NOT EXISTS `email_templates` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `business_id` INT(11) NOT NULL,
  `template_type` VARCHAR(100) NOT NULL COMMENT 'confirmation, reminder1h, reminder1d, reminder3d',
  `enabled` TINYINT(1) DEFAULT 1,
  `subject` VARCHAR(500) NOT NULL,
  `body` TEXT NOT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_business_template` (`business_id`, `template_type`),
  FOREIGN KEY (`business_id`) REFERENCES `businesses`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- TABLE: email_logs (Logs d'envoi d'emails)
-- ============================================
CREATE TABLE IF NOT EXISTS `email_logs` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `reservation_id` INT(11) NOT NULL,
  `template_type` VARCHAR(100) NOT NULL,
  `sent_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `status` VARCHAR(50) DEFAULT 'sent',
  `error_message` TEXT DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_reservation` (`reservation_id`),
  FOREIGN KEY (`reservation_id`) REFERENCES `reservations`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ============================================
-- DONNÉES D'EXEMPLE
-- ============================================

-- Entreprise exemple (ID sera 1)
INSERT INTO `businesses` (`slug`, `name`, `phone`, `email`, `address_street`, `address_city`, `address_postal_code`, `address_country`, `main_color`, `page_title`, `page_description`) VALUES
('cleantech-autodetail', 'CleanTech - AutoDetailing', '0750097950', 'contact@cleantech.fr', '117 Route de Briare', 'Gien', '45500', 'France', '#0ea5e9', 'Réservation - CleanTech AutoDetailing', 'Réservez votre prestation de detailing automobile de qualité professionnelle');

-- Types de véhicules (business_id = 1)
INSERT INTO `vehicle_types` (`business_id`, `name`, `slug`, `description`, `display_order`) VALUES
(1, '2 roues', '2-roues', 'Scooters, motos', 1),
(1, 'Citadine', 'citadine', 'Petits véhicules (Mini, Fiat 500)', 2),
(1, 'Berline', 'berline', 'Voitures standards (Corolla, Civic)', 3),
(1, 'Sportive', 'sportive', 'Voitures de sport (Porsche, Ferrari)', 4),
(1, 'SUV', 'suv', 'Véhicules plus grands (RAV4, CR-V)', 5),
(1, 'Monospace 5 places', 'monospace-5', 'Espace, Scenic, C4 Picasso', 6),
(1, 'Monospace 7 places', 'monospace-7', 'Grand Espace, Grand Scenic, C8', 7),
(1, 'Truck', 'truck', 'Silverado, Tacoma...', 8),
(1, 'Van', 'van', 'Minivans, fourgonnettes', 9);

-- Packs (business_id = 1)
INSERT INTO `packs` (`business_id`, `name`, `slug`, `description`, `display_order`) VALUES
(1, 'Pack Bronze', 'bronze', 'Nettoyage intérieur et extérieur de base', 1),
(1, 'Pack Gold', 'gold', 'Nettoyage complet avec traitement premium', 2),
(1, 'Pack Concession', 'concession', 'Prestation haut de gamme avec finitions professionnelles', 3);

-- Tarifs Pack Bronze (pack_id = 1)
INSERT INTO `pack_pricing` (`pack_id`, `vehicle_type_id`, `price_ht`, `price_ttc`, `duration`, `available`) VALUES
(1, 1, 50.00, 60.00, 1.00, 1),  -- 2 roues
(1, 2, 70.00, 84.00, 2.00, 1),  -- Citadine
(1, 3, 80.00, 96.00, 2.50, 1),  -- Berline
(1, 4, 90.00, 108.00, 3.00, 1), -- Sportive
(1, 5, 100.00, 120.00, 3.00, 1), -- SUV
(1, 6, 110.00, 132.00, 3.50, 1), -- Monospace 5
(1, 7, 120.00, 144.00, 4.00, 1), -- Monospace 7
(1, 8, 130.00, 156.00, 4.00, 1), -- Truck
(1, 9, 140.00, 168.00, 4.50, 1); -- Van

-- Tarifs Pack Gold (pack_id = 2)
INSERT INTO `pack_pricing` (`pack_id`, `vehicle_type_id`, `price_ht`, `price_ttc`, `duration`, `available`) VALUES
(2, 1, 80.00, 96.00, 1.50, 1),   -- 2 roues
(2, 2, 120.00, 144.00, 3.00, 1), -- Citadine
(2, 3, 140.00, 168.00, 3.50, 1), -- Berline
(2, 4, 160.00, 192.00, 4.00, 1), -- Sportive
(2, 5, 180.00, 216.00, 4.00, 1), -- SUV
(2, 6, 200.00, 240.00, 4.50, 1), -- Monospace 5
(2, 7, 220.00, 264.00, 5.00, 1), -- Monospace 7
(2, 8, 240.00, 288.00, 5.00, 1), -- Truck
(2, 9, 260.00, 312.00, 5.50, 1); -- Van

-- Tarifs Pack Concession (pack_id = 3) - Pas disponible pour 2 roues
INSERT INTO `pack_pricing` (`pack_id`, `vehicle_type_id`, `price_ht`, `price_ttc`, `duration`, `available`) VALUES
(3, 2, 180.00, 216.00, 4.00, 1), -- Citadine
(3, 3, 220.00, 264.00, 4.50, 1), -- Berline
(3, 4, 250.00, 300.00, 5.00, 1), -- Sportive
(3, 5, 280.00, 336.00, 5.50, 1), -- SUV
(3, 6, 300.00, 360.00, 6.00, 1), -- Monospace 5
(3, 7, 320.00, 384.00, 6.50, 1), -- Monospace 7
(3, 8, 340.00, 408.00, 6.50, 1), -- Truck
(3, 9, 360.00, 432.00, 7.00, 1); -- Van

-- Options supplémentaires
INSERT INTO `options` (`business_id`, `name`, `description`, `icon`, `category`, `display_order`) VALUES
(1, 'Traitement cuir', 'Nourriture et protection des sièges en cuir', 'leather', 'interior', 1),
(1, 'Traitement ozone', 'Désinfection et désodorisation complète', 'wind', 'interior', 2),
(1, 'Nettoyage vapeur', 'Nettoyage en profondeur à la vapeur', 'droplet', 'interior', 3),
(1, 'Shampoing tapis', 'Nettoyage professionnel des tapis et moquettes', 'sparkles', 'interior', 4),
(1, 'Supplément saleté excessive', 'Pour véhicules très sales ou négligés', 'alert-circle', 'supplement', 5),
(1, 'Senteur premium', 'Parfum d\'ambiance de qualité', 'flower', 'addon', 6);

-- Tarifs Options - Traitement cuir (option_id = 1)
INSERT INTO `option_pricing` (`option_id`, `vehicle_type_id`, `price_ht`, `price_ttc`, `duration`) VALUES
(1, 2, 30.00, 36.00, 0.50), -- Citadine
(1, 3, 40.00, 48.00, 0.50), -- Berline
(1, 4, 50.00, 60.00, 0.50), -- Sportive
(1, 5, 50.00, 60.00, 0.50), -- SUV
(1, 6, 60.00, 72.00, 1.00), -- Monospace 5
(1, 7, 70.00, 84.00, 1.00), -- Monospace 7
(1, 8, 70.00, 84.00, 1.00), -- Truck
(1, 9, 80.00, 96.00, 1.00); -- Van

-- Disponibilité options pour véhicules
INSERT INTO `option_availability` (`option_id`, `vehicle_type_id`) VALUES
-- Traitement cuir (1)
(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9),
-- Ozone (2)
(2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9),
-- Vapeur (3)
(3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9),
-- Shampoing (4)
(4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 7), (4, 8), (4, 9),
-- Supplément saleté (5) - Tous véhicules
(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 7), (5, 8), (5, 9),
-- Senteur (6) - Tous véhicules
(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6), (6, 7), (6, 8), (6, 9);

-- Horaires d'ouverture (business_id = 1)
INSERT INTO `working_hours` (`business_id`, `day_of_week`, `open_time`, `close_time`, `closed`) VALUES
(1, 0, '09:00', '20:00', 0), -- Lundi
(1, 1, '09:00', '20:00', 0), -- Mardi
(1, 2, '09:00', '20:00', 0), -- Mercredi
(1, 3, '09:00', '20:00', 0), -- Jeudi
(1, 4, '09:00', '20:00', 0), -- Vendredi
(1, 5, '09:00', '18:00', 0), -- Samedi
(1, 6, '09:00', '18:00', 1); -- Dimanche (fermé)

-- Modèles d'emails (business_id = 1)
INSERT INTO `email_templates` (`business_id`, `template_type`, `enabled`, `subject`, `body`) VALUES
(1, 'confirmation', 1, 'Confirmation de votre réservation - {{business_name}}', 'Bonjour {{client_first_name}},\n\nVotre réservation a été confirmée !\n\nDétails :\n- Service : {{pack_name}}\n- Date : {{appointment_date}}\n- Heure : {{appointment_time}}\n- Total : {{total_ttc}} € TTC\n- Acompte : {{deposit_ttc}} € TTC\n\nÀ bientôt !'),
(1, 'reminder1h', 1, 'Rappel : Votre rendez-vous dans 1 heure', 'Bonjour {{client_first_name}},\n\nRappel : Votre rendez-vous est prévu dans 1 heure.\n\nDate : {{appointment_date}} à {{appointment_time}}\n\nÀ très bientôt !'),
(1, 'reminder1d', 1, 'Rappel : Votre rendez-vous demain', 'Bonjour {{client_first_name}},\n\nRappel : Votre rendez-vous est prévu demain.\n\nDate : {{appointment_date}} à {{appointment_time}}\n\nÀ bientôt !'),
(1, 'reminder3d', 1, 'Rappel : Votre rendez-vous dans 3 jours', 'Bonjour {{client_first_name}},\n\nRappel : Votre rendez-vous est prévu dans 3 jours.\n\nDate : {{appointment_date}} à {{appointment_time}}\n\nÀ bientôt !');

-- ============================================
-- FIN DU SCRIPT
-- ============================================
-- 
-- Vérification :
-- - 14 tables créées
-- - 1 entreprise exemple
-- - 9 types de véhicules
-- - 3 packs avec tarifs
-- - 6 options supplémentaires
-- - 1 utilisateur admin
-- 
-- Vous pouvez maintenant accéder à :
-- - Page réservation : /book.php?slug=cleantech-autodetail
-- - Admin : /admin/login.php (admin@cleantech.fr / admin123)
-- ============================================

