-- Active: 1755472439040@@dev.wappcom.com@3306@nucleo_base

-- ============================================
-- Tabla: mod_popups
-- ============================================
DROP TABLE IF EXISTS `mod_popups`;

CREATE TABLE `mod_popups` (
  `mod_pop_id` int(11) NOT NULL AUTO_INCREMENT,
  `mod_pop_name` varchar(255) NOT NULL,
  `mod_pop_description` tinytext NOT NULL,
  `mod_pop_cls` varchar(45) NOT NULL,
  -- Configuración principal
  `mod_pop_animation` varchar(50) DEFAULT NULL COMMENT 'Animation (ZoomIn, FadeIn, etc.)',
  `mod_pop_open_event` varchar(50) DEFAULT NULL COMMENT 'Open Event (on load, on click, on scroll, etc.)',
  `mod_pop_close_event` varchar(50) DEFAULT NULL COMMENT 'On Close Event',
  `mod_pop_prevent_scroll` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Prevent Page Scrolling',
  `mod_pop_show_once` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Show Once',
  `mod_pop_ajax_load` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Loading content with Ajax',
  `mod_pop_use_close_button` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Use Close Button',
  `mod_pop_use_overlay` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Use Overlay',
  `mod_pop_close_on_overlay_click` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Close on overlay click',
  `mod_pop_json` text COMMENT 'Configuración adicional en JSON (timings, condiciones avanzadas, etc.)',
  `mod_pop_ent_id` int(11) NOT NULL COMMENT 'Entidad a la que pertenece el popup',
  `mod_pop_site_id` int(11) NOT NULL COMMENT 'Sitio específico dentro de la entidad',
  `mod_pop_date` datetime DEFAULT NULL,
  `mod_pop_date_register` datetime DEFAULT NULL,
  `mod_pop_user_id` int(11) DEFAULT NULL,
  `mod_pop_state` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`mod_pop_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci AUTO_INCREMENT=1;

-- ============================================
-- Tabla: mod_popups_items
-- (Elementos / contenidos que mostrará el popup)
-- ============================================
DROP TABLE IF EXISTS `mod_popups_items`;

CREATE TABLE `mod_popups_items` (
  `mod_pop_item_id` int(11) NOT NULL AUTO_INCREMENT,
  `mod_pop_item_pop_id` int(11) NOT NULL COMMENT 'FK a mod_popups',
  `mod_pop_item_file_id` int(11) DEFAULT NULL COMMENT 'Archivo opcional (imagen, video, etc.)',
  `mod_pop_item_title` varchar(255) DEFAULT NULL,
  `mod_pop_item_btn_title` varchar(255) DEFAULT NULL,
  `mod_pop_item_link` varchar(445) DEFAULT NULL,
  `mod_pop_item_target` varchar(22) DEFAULT '_self',
  `mod_pop_item_description` tinytext,
  `mod_pop_item_json` text COMMENT 'Configuración específica del item (por ejemplo, delays o variantes)',
  `mod_pop_item_order` int(11) DEFAULT '0',
  PRIMARY KEY (`mod_pop_item_id`) USING BTREE,
  KEY `idx_popup_id` (`mod_pop_item_pop_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci AUTO_INCREMENT=1;

COMMIT;
