-- Nay Store Admin Patch A - optional cleanup for old hardcoded home copy
-- Safe to run after uploading the patch. It only clears old default marketing text when it still matches the previous hardcoded phrases.

UPDATE settings
SET setting_value = ''
WHERE setting_key = 'home_hero_pill_text'
  AND setting_value = 'Nay Store';

UPDATE settings
SET setting_value = ''
WHERE setting_key = 'home_hero_title'
  AND setting_value = 'تجربة تسوق أخف وأجمل';

UPDATE settings
SET setting_value = ''
WHERE setting_key = 'home_hero_subtitle'
  AND setting_value = 'منتجات أصلية، عروض واضحة، وطلب أسرع';

UPDATE settings
SET setting_value = '0'
WHERE setting_key = 'home_soft_banner_enabled'
  AND setting_value = '1';

UPDATE settings
SET setting_value = ''
WHERE setting_key = 'home_soft_banner_title'
  AND setting_value = 'روتين عناية خفيف وسريع';

UPDATE settings
SET setting_value = ''
WHERE setting_key = 'home_soft_banner_subtitle'
  AND setting_value = 'اختاري منتجاتك المفضلة بخطوات قليلة';

UPDATE settings
SET setting_value = ''
WHERE setting_key IN ('home_feature_1_label','home_feature_2_label','home_feature_3_label','home_feature_4_label')
  AND setting_value IN ('توصيل سريع','هدايا وعروض','نقاط','دفع عند الاستلام');

INSERT INTO settings (setting_key, setting_value, setting_group, created_at, updated_at)
VALUES
('admin_log_changes_enabled', '1', 'security', NOW(), NOW()),
('admin_track_ip_enabled', '1', 'security', NOW(), NOW()),
('admin_session_timeout_minutes', '120', 'security', NOW(), NOW()),
('admin_max_login_attempts', '5', 'security', NOW(), NOW()),
('admin_lockout_minutes', '15', 'security', NOW(), NOW())
ON DUPLICATE KEY UPDATE
  setting_value = VALUES(setting_value),
  setting_group = VALUES(setting_group),
  updated_at = NOW();
