-- Script pour ajouter des trajets de test réalistes pour Go Transit Afrik
-- Routes et trajets pour le Bénin et Togo

-- D'abord, vérifions et créons quelques compagnies de transport supplémentaires
INSERT OR IGNORE INTO transport_companies (id, user_id, name, registration_number, phone, email, address, logo_url, description, status, created_at, updated_at) VALUES
(2, 2, 'Confort Lines', 'CL2023002', '+22997123456', 'contact@confortlines.bj', 'Cotonou, Bénin', 'https://example.com/logos/confort.png', 'Leader du transport confortable au Bénin', 'active', datetime('now'), datetime('now')),
(3, 2, 'ATB Transport', 'ATB2023003', '+22890123456', 'info@atb-transport.tg', 'Lomé, Togo', 'https://example.com/logos/atb.png', 'Votre partenaire de voyage au Togo', 'active', datetime('now'), datetime('now')),
(4, 2, 'Baobab Express', 'BE2023004', '+22995678901', 'contact@baobabexpress.bj', 'Porto-Novo, Bénin', 'https://example.com/logos/baobab.png', 'Rapidité et fiabilité garanties', 'active', datetime('now'), datetime('now')),
(5, 2, 'Etoile du Sud', 'ES2023005', '+22897654321', 'info@etoiledusud.tg', 'Kara, Togo', 'https://example.com/logos/etoile.png', 'Confort et sécurité sur toutes nos lignes', 'active', datetime('now'), datetime('now'));

-- Ajout de véhicules pour ces compagnies
INSERT OR IGNORE INTO vehicles (id, company_id, type, brand, model, registration_plate, capacity, year, features, status, created_at, updated_at) VALUES
-- Véhicules pour Confort Lines
(4, 2, 'bus', 'Mercedes', 'Tourismo', 'CL-001-BJ', 50, 2022, '["air_conditioning","wifi","usb_charging","reclining_seats","toilet"]', 'active', datetime('now'), datetime('now')),
(5, 2, 'bus', 'Volvo', 'B11R', 'CL-002-BJ', 45, 2021, '["air_conditioning","wifi","usb_charging","reclining_seats"]', 'active', datetime('now'), datetime('now')),
(6, 2, 'minibus', 'Toyota', 'Coaster', 'CL-003-BJ', 30, 2023, '["air_conditioning","usb_charging"]', 'active', datetime('now'), datetime('now')),

-- Véhicules pour ATB Transport
(7, 3, 'bus', 'Scania', 'Touring', 'ATB-001-TG', 55, 2022, '["air_conditioning","wifi","usb_charging","reclining_seats","entertainment_system"]', 'active', datetime('now'), datetime('now')),
(8, 3, 'bus', 'Mercedes', 'Citaro', 'ATB-002-TG', 48, 2021, '["air_conditioning","wifi","usb_charging"]', 'active', datetime('now'), datetime('now')),
(9, 3, 'minibus', 'Iveco', 'Daily', 'ATB-003-TG', 25, 2023, '["air_conditioning"]', 'active', datetime('now'), datetime('now')),

-- Véhicules pour Baobab Express
(10, 4, 'bus', 'MAN', 'Lion Coach', 'BE-001-BJ', 52, 2023, '["air_conditioning","wifi","usb_charging","reclining_seats","toilet","entertainment_system"]', 'active', datetime('now'), datetime('now')),
(11, 4, 'minibus', 'Mercedes', 'Sprinter', 'BE-002-BJ', 20, 2022, '["air_conditioning","usb_charging"]', 'active', datetime('now'), datetime('now')),

-- Véhicules pour Etoile du Sud
(12, 5, 'bus', 'Yutong', 'ZK6122H', 'ES-001-TG', 49, 2021, '["air_conditioning","wifi","reclining_seats"]', 'active', datetime('now'), datetime('now')),
(13, 5, 'minibus', 'Toyota', 'HiAce', 'ES-002-TG', 15, 2023, '["air_conditioning"]', 'active', datetime('now'), datetime('now'));

-- Ajout de routes populaires
INSERT OR IGNORE INTO routes (id, company_id, departure_city, arrival_city, distance_km, duration_minutes, stops, status, created_at, updated_at) VALUES
-- Routes Bénin
(4, 2, 'Cotonou', 'Parakou', 450, 420, '["Bohicon", "Dassa-Zoumé", "Savalou"]', 'active', datetime('now'), datetime('now')),
(5, 2, 'Porto-Novo', 'Abomey', 120, 120, '["Cotonou", "Allada"]', 'active', datetime('now'), datetime('now')),
(6, 4, 'Cotonou', 'Natitingou', 650, 540, '["Bohicon", "Dassa-Zoumé", "Parakou", "Djougou"]', 'active', datetime('now'), datetime('now')),
(7, 4, 'Porto-Novo', 'Parakou', 470, 450, '["Sakété", "Pobè", "Kétou", "Tchaourou"]', 'active', datetime('now'), datetime('now')),

-- Routes Togo
(8, 3, 'Lomé', 'Kara', 420, 360, '["Tsévié", "Atakpamé", "Sokodé"]', 'active', datetime('now'), datetime('now')),
(9, 3, 'Lomé', 'Dapaong', 650, 540, '["Atakpamé", "Sokodé", "Kara", "Niamtougou"]', 'active', datetime('now'), datetime('now')),
(10, 5, 'Kara', 'Lomé', 420, 360, '["Sokodé", "Atakpamé", "Tsévié"]', 'active', datetime('now'), datetime('now')),

-- Routes internationales Bénin-Togo
(11, 2, 'Cotonou', 'Lomé', 150, 180, '["Ouidah", "Grand-Popo", "Aného"]', 'active', datetime('now'), datetime('now')),
(12, 3, 'Lomé', 'Cotonou', 150, 180, '["Aného", "Grand-Popo", "Ouidah"]', 'active', datetime('now'), datetime('now'));

-- Ajout de trajets programmés pour les prochains jours
-- Trajets pour aujourd'hui et les 30 prochains jours
INSERT OR IGNORE INTO trips (route_id, vehicle_id, departure_datetime, arrival_datetime, price, available_seats, status, created_at, updated_at) VALUES
-- Trajets Cotonou - Porto-Novo (Route 1) - Plusieurs par jour
(1, 1, datetime('now', '+0 days', 'start of day', '+6 hours'), datetime('now', '+0 days', 'start of day', '+7 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+0 days', 'start of day', '+8 hours'), datetime('now', '+0 days', 'start of day', '+9 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+0 days', 'start of day', '+10 hours'), datetime('now', '+0 days', 'start of day', '+11 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+0 days', 'start of day', '+14 hours'), datetime('now', '+0 days', 'start of day', '+15 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+0 days', 'start of day', '+16 hours'), datetime('now', '+0 days', 'start of day', '+17 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),

-- Trajets pour demain
(1, 1, datetime('now', '+1 days', 'start of day', '+6 hours'), datetime('now', '+1 days', 'start of day', '+7 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+1 days', 'start of day', '+10 hours'), datetime('now', '+1 days', 'start of day', '+11 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+1 days', 'start of day', '+14 hours'), datetime('now', '+1 days', 'start of day', '+15 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),

-- Trajets Porto-Novo - Cotonou (Route 2)
(2, 2, datetime('now', '+0 days', 'start of day', '+7 hours'), datetime('now', '+0 days', 'start of day', '+8 hours'), 2500, 30, 'scheduled', datetime('now'), datetime('now')),
(2, 2, datetime('now', '+0 days', 'start of day', '+11 hours'), datetime('now', '+0 days', 'start of day', '+12 hours'), 2500, 30, 'scheduled', datetime('now'), datetime('now')),
(2, 2, datetime('now', '+0 days', 'start of day', '+15 hours'), datetime('now', '+0 days', 'start of day', '+16 hours'), 2500, 30, 'scheduled', datetime('now'), datetime('now')),

-- Trajets Cotonou - Parakou (Route 4)
(4, 4, datetime('now', '+0 days', 'start of day', '+6 hours'), datetime('now', '+0 days', 'start of day', '+13 hours'), 8500, 50, 'scheduled', datetime('now'), datetime('now')),
(4, 5, datetime('now', '+0 days', 'start of day', '+18 hours'), datetime('now', '+1 days', 'start of day', '+1 hours'), 8500, 45, 'scheduled', datetime('now'), datetime('now')),
(4, 4, datetime('now', '+1 days', 'start of day', '+6 hours'), datetime('now', '+1 days', 'start of day', '+13 hours'), 8500, 50, 'scheduled', datetime('now'), datetime('now')),

-- Trajets Cotonou - Lomé (Route 11)
(11, 6, datetime('now', '+0 days', 'start of day', '+7 hours'), datetime('now', '+0 days', 'start of day', '+10 hours'), 5000, 30, 'scheduled', datetime('now'), datetime('now')),
(11, 6, datetime('now', '+0 days', 'start of day', '+13 hours'), datetime('now', '+0 days', 'start of day', '+16 hours'), 5000, 30, 'scheduled', datetime('now'), datetime('now')),
(11, 6, datetime('now', '+1 days', 'start of day', '+7 hours'), datetime('now', '+1 days', 'start of day', '+10 hours'), 5000, 30, 'scheduled', datetime('now'), datetime('now')),

-- Trajets Lomé - Kara (Route 8)
(8, 7, datetime('now', '+0 days', 'start of day', '+8 hours'), datetime('now', '+0 days', 'start of day', '+14 hours'), 12000, 55, 'scheduled', datetime('now'), datetime('now')),
(8, 8, datetime('now', '+1 days', 'start of day', '+8 hours'), datetime('now', '+1 days', 'start of day', '+14 hours'), 12000, 48, 'scheduled', datetime('now'), datetime('now')),

-- Trajets pour la semaine prochaine
(1, 1, datetime('now', '+7 days', 'start of day', '+6 hours'), datetime('now', '+7 days', 'start of day', '+7 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+7 days', 'start of day', '+10 hours'), datetime('now', '+7 days', 'start of day', '+11 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(4, 4, datetime('now', '+7 days', 'start of day', '+6 hours'), datetime('now', '+7 days', 'start of day', '+13 hours'), 8500, 50, 'scheduled', datetime('now'), datetime('now')),
(11, 6, datetime('now', '+7 days', 'start of day', '+7 hours'), datetime('now', '+7 days', 'start of day', '+10 hours'), 5000, 30, 'scheduled', datetime('now'), datetime('now')),

-- Trajets pour dans 2 semaines
(1, 1, datetime('now', '+14 days', 'start of day', '+6 hours'), datetime('now', '+14 days', 'start of day', '+7 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, datetime('now', '+14 days', 'start of day', '+14 hours'), datetime('now', '+14 days', 'start of day', '+15 hours'), 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(8, 7, datetime('now', '+14 days', 'start of day', '+8 hours'), datetime('now', '+14 days', 'start of day', '+14 hours'), 12000, 55, 'scheduled', datetime('now'), datetime('now')),

-- Ajout du 15 août 2025 spécifiquement
(1, 1, '2025-08-15 06:00:00', '2025-08-15 07:00:00', 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, '2025-08-15 08:00:00', '2025-08-15 09:00:00', 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, '2025-08-15 10:00:00', '2025-08-15 11:00:00', 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, '2025-08-15 14:00:00', '2025-08-15 15:00:00', 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, '2025-08-15 16:00:00', '2025-08-15 17:00:00', 2500, 45, 'scheduled', datetime('now'), datetime('now')),
(1, 1, '2025-08-15 18:00:00', '2025-08-15 19:00:00', 2500, 45, 'scheduled', datetime('now'), datetime('now'));