CREATE TABLE IF NOT EXISTS `scroll_popup_content` (
  `idscroll_popup_content` INT NOT NULL AUTO_INCREMENT,
  `title_text` VARCHAR(150) NOT NULL,
  `subtitle_text` VARCHAR(255) NOT NULL,
  `phone_placeholder` VARCHAR(100) NOT NULL DEFAULT 'Enter Mobile no.',
  `submit_button_text` VARCHAR(50) NOT NULL DEFAULT 'Submit',
  `terms_text` VARCHAR(120) NOT NULL DEFAULT '*T&C apply',
  `terms_url` VARCHAR(255) NOT NULL DEFAULT '/scroll-popup-terms',
  `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`idscroll_popup_content`),
  KEY `idx_scroll_popup_active_updated` (`is_active`, `updated_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `scroll_popup_content` (
  `idscroll_popup_content`,
  `title_text`,
  `subtitle_text`,
  `phone_placeholder`,
  `submit_button_text`,
  `terms_text`,
  `terms_url`,
  `is_active`
)
VALUES (
  1,
  'Apply for a Credit Card',
  'Get up to AED 1500 Welcome Bonus.',
  'Enter Mobile no.',
  'Submit',
  '*T&C apply',
  '/scroll-popup-terms',
  1
)
ON DUPLICATE KEY UPDATE
  `title_text` = VALUES(`title_text`),
  `subtitle_text` = VALUES(`subtitle_text`),
  `phone_placeholder` = VALUES(`phone_placeholder`),
  `submit_button_text` = VALUES(`submit_button_text`),
  `terms_text` = VALUES(`terms_text`),
  `terms_url` = VALUES(`terms_url`),
  `is_active` = VALUES(`is_active`);

-- Example update when you need to change popup content from DB:
-- UPDATE `scroll_popup_content`
-- SET
--   `title_text` = 'Apply for a Premium Credit Card',
--   `subtitle_text` = 'Enjoy exclusive welcome rewards.',
--   `terms_text` = '*Offer terms apply',
--   `terms_url` = '/scroll-popup-terms'
-- WHERE `idscroll_popup_content` = 1;
