ALTER TABLE customer_requests
  ADD COLUMN IF NOT EXISTS country_code VARCHAR(12) NULL AFTER phone,
  ADD COLUMN IF NOT EXISTS quantity_unit VARCHAR(40) NULL AFTER quantity,
  ADD COLUMN IF NOT EXISTS payment_method VARCHAR(40) NULL AFTER quantity_unit,
  ADD COLUMN IF NOT EXISTS calculated_price DECIMAL(12,2) NOT NULL DEFAULT 0 AFTER material_price;

INSERT INTO settings (setting_key, setting_value) VALUES
('request_default_country_code', '+964'),
('request_country_codes_json', '[{"code":"+964","name_ar":"العراق","name_en":"Iraq"},{"code":"+966","name_ar":"السعودية","name_en":"Saudi Arabia"},{"code":"+971","name_ar":"الإمارات","name_en":"United Arab Emirates"},{"code":"+965","name_ar":"الكويت","name_en":"Kuwait"},{"code":"+974","name_ar":"قطر","name_en":"Qatar"},{"code":"+973","name_ar":"البحرين","name_en":"Bahrain"},{"code":"+968","name_ar":"عمان","name_en":"Oman"},{"code":"+962","name_ar":"الأردن","name_en":"Jordan"},{"code":"+961","name_ar":"لبنان","name_en":"Lebanon"},{"code":"+963","name_ar":"سوريا","name_en":"Syria"},{"code":"+20","name_ar":"مصر","name_en":"Egypt"},{"code":"+90","name_ar":"تركيا","name_en":"Turkey"},{"code":"+98","name_ar":"إيران","name_en":"Iran"},{"code":"+1","name_ar":"الولايات المتحدة / كندا","name_en":"United States / Canada"},{"code":"+44","name_ar":"المملكة المتحدة","name_en":"United Kingdom"},{"code":"+49","name_ar":"ألمانيا","name_en":"Germany"},{"code":"+33","name_ar":"فرنسا","name_en":"France"},{"code":"+39","name_ar":"إيطاليا","name_en":"Italy"},{"code":"+34","name_ar":"إسبانيا","name_en":"Spain"},{"code":"+31","name_ar":"هولندا","name_en":"Netherlands"},{"code":"+46","name_ar":"السويد","name_en":"Sweden"},{"code":"+47","name_ar":"النرويج","name_en":"Norway"},{"code":"+45","name_ar":"الدنمارك","name_en":"Denmark"},{"code":"+41","name_ar":"سويسرا","name_en":"Switzerland"},{"code":"+43","name_ar":"النمسا","name_en":"Austria"},{"code":"+61","name_ar":"أستراليا","name_en":"Australia"},{"code":"+64","name_ar":"نيوزيلندا","name_en":"New Zealand"},{"code":"+91","name_ar":"الهند","name_en":"India"},{"code":"+92","name_ar":"باكستان","name_en":"Pakistan"},{"code":"+880","name_ar":"بنغلادش","name_en":"Bangladesh"},{"code":"+86","name_ar":"الصين","name_en":"China"},{"code":"+81","name_ar":"اليابان","name_en":"Japan"},{"code":"+82","name_ar":"كوريا الجنوبية","name_en":"South Korea"},{"code":"+60","name_ar":"ماليزيا","name_en":"Malaysia"},{"code":"+62","name_ar":"إندونيسيا","name_en":"Indonesia"},{"code":"+63","name_ar":"الفلبين","name_en":"Philippines"},{"code":"+7","name_ar":"روسيا","name_en":"Russia"},{"code":"+27","name_ar":"جنوب أفريقيا","name_en":"South Africa"},{"code":"+212","name_ar":"المغرب","name_en":"Morocco"},{"code":"+213","name_ar":"الجزائر","name_en":"Algeria"},{"code":"+216","name_ar":"تونس","name_en":"Tunisia"},{"code":"+218","name_ar":"ليبيا","name_en":"Libya"},{"code":"+249","name_ar":"السودان","name_en":"Sudan"},{"code":"+234","name_ar":"نيجيريا","name_en":"Nigeria"},{"code":"+55","name_ar":"البرازيل","name_en":"Brazil"},{"code":"+52","name_ar":"المكسيك","name_en":"Mexico"},{"code":"+54","name_ar":"الأرجنتين","name_en":"Argentina"}]'),
('request_iraq_cities', 'بغداد\nالبصرة\nنينوى\nأربيل\nالنجف\nكربلاء\nكركوك\nالسليمانية\nدهوك\nديالى\nالأنبار\nصلاح الدين\nبابل\nواسط\nميسان\nذي قار\nالمثنى\nالقادسية'),
('request_payment_methods', 'نقد\nأقساط'),
('request_default_material_slug', 'solar-energy'),
('request_solar_material_slug', 'solar-energy'),
('request_solar_unit_label', 'أمبير'),
('request_quantity_unit_label', 'كمية'),
('request_currency_label', 'IQD')
ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value);

UPDATE page_sections
SET button_text = 'اختر الخدمة'
WHERE section_key = 'hero' AND button_text = 'ابدأ مشروعك';
