-- Migration: Create site_settings table
-- Description: Stores global site configuration settings
-- Date: 2026-01-26

CREATE TABLE IF NOT EXISTS site_settings (
  id INT AUTO_INCREMENT PRIMARY KEY,
  setting_key VARCHAR(100) UNIQUE NOT NULL,
  setting_value LONGTEXT,
  type VARCHAR(50),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

  INDEX idx_setting_key (setting_key)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Insert default settings
INSERT IGNORE INTO site_settings (setting_key, setting_value, type) VALUES
  ('site_title', 'WakaTraffic', 'string'),
  ('site_currency', 'NGN', 'string'),
  ('site_currency_symbol', '₦', 'string'),
  ('site_base_color', '#F3852C', 'string'),
  ('site_secondary_color', '#023A5F', 'string'),
  ('timezone', 'UTC', 'string'),
  ('user_registration_enabled', 'true', 'boolean'),
  ('email_verification_required', 'false', 'boolean'),
  ('mobile_verification_required', 'false', 'boolean');
