-- ============================================================
--  rewards_card_design_migration.sql
--  Run this if you already have the rewards_db installed.
--  Safe to run multiple times (uses INSERT IGNORE).
-- ============================================================

USE `rewards_db`;

-- Add card_bg_image column support (increase setting_value length for base64)
ALTER TABLE `settings`
  MODIFY COLUMN `setting_value` MEDIUMTEXT NOT NULL DEFAULT '';

-- Insert new card design settings (safe – ignores duplicates)
INSERT IGNORE INTO `settings` (`setting_key`, `setting_value`, `setting_label`) VALUES
('card_bg_type',         'gradient',    'Card Background Type: gradient or image'),
('card_gradient_dir',    '135deg',      'Gradient Direction'),
('card_gradient_color1', '#1e3a8a',     'Gradient Color 1 (start)'),
('card_gradient_color2', '#1d4ed8',     'Gradient Color 2 (middle)'),
('card_gradient_color3', '#0ea5e9',     'Gradient Color 3 (end)'),
('card_text_color',      '#ffffff',     'Card Text Color'),
('card_accent_color',    '#facc15',     'Card Accent / Logo Color'),
('card_bg_image',        '',            'Card Background Image (base64)'),
('card_logo_icon',       'star-fill',   'Bootstrap Icon name for card logo'),
('card_show_shimmer',    '1',           'Show glossy shimmer overlay (1/0)'),
('card_label_text',      'MEMBER CARD', 'Card label text (bottom left)'),
('card_subtitle_text',   'REWARDS MEMBER', 'Card subtitle text'),
('card_counter_date',    '',            'Date of last counter reset (auto)');
