-- =============================================
-- Tok Tokkie Shuttles - Manual Seed Data
-- =============================================
-- Run after schema.sql to add reference data
-- =============================================

-- Routes
INSERT IGNORE INTO routes (route_code, origin, destination, country_origin, country_destination, distance_km, estimated_duration_hours) VALUES
('WHK-GAB', 'Windhoek', 'Gaborone', 'Namibia', 'Botswana', 1450, 18.0),
('WHK-JNB', 'Windhoek', 'Johannesburg', 'Namibia', 'South Africa', 1800, 22.0),
('WHK-HRE', 'Windhoek', 'Harare', 'Namibia', 'Zimbabwe', 2100, 26.0),
('WHK-CPT', 'Windhoek', 'Cape Town', 'Namibia', 'South Africa', 1600, 20.0),
('WHK-ETC', 'Windhoek', 'Any Town', 'Namibia', 'Namibia', NULL, NULL);

-- Vehicles
INSERT IGNORE INTO vehicles (vehicle_code, vehicle_type, vehicle_name, capacity, has_trailer, has_ac) VALUES
('QUANTUM-1', 'economy', 'Toyota Quantum', 14, TRUE, TRUE),
('PREMACY-1', 'vip', 'Premium Premacy', 4, FALSE, TRUE),
('HIACE-1', 'standard', 'Toyota Hiace', 12, TRUE, TRUE),
('PREMACY-2', 'vip', 'Premium Premacy', 4, FALSE, TRUE),
('SPRINTER-1', 'premium', 'Mercedes Sprinter', 20, TRUE, TRUE);

-- Schedules (Windhoek <> Gaborone route_id = 1)
INSERT IGNORE INTO schedules (route_id, vehicle_id, departure_day, departure_time, arrival_time, price_per_seat, currency, notes) VALUES
(1, 1, 'Friday', '05:00:00', '23:00:00', 1200.00, 'NAD', 'Economy Shuttle - Includes luggage trailer, 1 large suitcase + 1 carry-on'),
(1, 2, 'Friday', '06:30:00', '00:30:00', 1850.00, 'NAD', 'VIP Express - Door-to-door service, max 4 passengers'),
(1, 1, 'Sunday', '05:00:00', '23:00:00', 1200.00, 'NAD', 'Economy Shuttle - Includes luggage trailer, 1 large suitcase + 1 carry-on'),
(1, 2, 'Sunday', '06:30:00', '00:30:00', 1850.00, 'NAD', 'VIP Express - Door-to-door service, max 4 passengers');

-- Settings
INSERT IGNORE INTO settings (setting_key, setting_value, setting_group, description) VALUES
('deposit_percentage', '50', 'payment', 'Percentage of total amount required as deposit'),
('currency', 'NAD', 'general', 'Default currency'),
('whatsapp_number', '+264811275285', 'contact', 'WhatsApp contact number'),
('phone_number', '+264811275285', 'contact', 'Primary phone number'),
('support_email', 'tokkiebookings@shuttlesnamibia.com', 'contact', 'Support email address'),
('cancellation_policy', 'Cancellations must be made 24 hours before departure', 'general', 'Cancellation policy text');

-- Sample booking for testing
INSERT IGNORE INTO customers (email, full_name, phone, total_bookings, total_spent) VALUES
('john@example.com', 'John Doe', '+264811000000', 1, 1200.00);

INSERT IGNORE INTO bookings (booking_reference, schedule_id, customer_id, customer_name, customer_email, customer_phone, number_of_passengers, total_amount, deposit_amount, balance_amount, booking_status, payment_status)
SELECT 'TK2026010001', 1, c.id, 'John Doe', 'john@example.com', '+264811000000', 1, 1200.00, 600.00, 600.00, 'confirmed', 'deposit_only'
FROM customers c WHERE c.email = 'john@example.com';
