-- Table structure for mod_places_accounts_ads
-- ----------------------------
CREATE TABLE `mod_places_accounts_ads` (
  `mod_plc_aca_aca_id` int NOT NULL COMMENT 'ID de plc aca aca',
  `mod_plc_aca_plc_id` int NOT NULL COMMENT 'ID de plc aca plc',
  `mod_plc_aca_date_register` datetime NOT NULL COMMENT 'Valor de mod plc aca date register',
  PRIMARY KEY (`mod_plc_aca_aca_id`,`mod_plc_aca_plc_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_places_accounts_ads
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_places_categorys
-- ----------------------------
CREATE TABLE `mod_places_categorys` (
  `mod_plc_cat_plc_id` int NOT NULL COMMENT 'ID de plc cat plc',
  `mod_plc_cat_cat_id` int NOT NULL COMMENT 'ID de plc cat cat',
  `mod_plc_cat_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_plc_cat_plc_id`,`mod_plc_cat_cat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_places_categorys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_prices_list
-- ----------------------------
CREATE TABLE `mod_prices_list` (
  `mod_prl_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prl',
  `mod_prl_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_prl_description` varchar(450) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Descripción del registro',
  `mod_prl_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `mod_prl_base_list` int DEFAULT NULL COMMENT 'lista base id\r\n\r\n',
  `mod_prl_factor` float(11,3) DEFAULT '1.000' COMMENT 'Valor de mod prl factor',
  `mod_prl_rounding_method` int NOT NULL COMMENT '0. sin *  1: si el siguiente dígito hacia la derecha después del último que desea conservarse es menor a 5, entonces el último no debe ser modificado. Por ejemplo: 8,453 se convertiría en 8,45;\r\n\r\n*2: en el caso opuesto al anterior, cuando el dígito siguiente al límite es mayor a 5, el último se debe incrementar en una unidad. Por ejemplo: 8,459 se convertiría en 8,46;\r\n\r\n*3: si un 5 sigue al último dígito que desea conservarse y después del 5 hay al menos un número diferente de 0, el último se debe incrementar en una unidad. Por ejemplo: 6,345070 se convertiría en 6,35;\r\n\r\n*4 si el último dígito deseado es un número par y a su derecha hay un 5 como dígito final o seguido de ceros, entonces no se realizan más cambios que el mero truncamiento. Por ejemplo, 4,32500 y 4,325 pasarían a ser 4,32;\r\n\r\n*\r\n5: de manera opuesta a la regla anterior, si el último dígito requerido es un número impar, entonces debemos aumentarlo en una unidad. Por ejemplo: 4,31500 y 4,315 se convertirían en 4,32. \r\n',
  `mod_prl_register_date` datetime NOT NULL COMMENT 'Fecha de registro',
  `mod_prl_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_prl_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_prl_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_prices_list
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_producers
-- ----------------------------
CREATE TABLE `mod_producers` (
  `mod_prd_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prd',
  `mod_prd_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_prd_description` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Descripción del registro',
  `mod_prd_img_id` int NOT NULL COMMENT 'ID de prd img',
  `mod_prd_state` int NOT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_prd_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_producers
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products
-- ----------------------------
CREATE TABLE `mod_products` (
  `mod_prod_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod',
  `mod_prod_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_prod_pathurl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta URL del recurso',
  `mod_prod_description` varchar(445) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Descripción del registro',
  `mod_prod_tags` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod tags',
  `mod_prod_img` int DEFAULT NULL COMMENT 'Valor de mod prod img',
  `mod_prod_code` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código interno',
  `mod_prod_record_date` datetime DEFAULT NULL COMMENT 'Fecha de registro',
  `mod_prod_type` int NOT NULL DEFAULT '0' COMMENT 'Tipo de registro',
  `mod_prod_ent_id` int DEFAULT '0' COMMENT 'ID de la entidad',
  `mod_prod_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_prod_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_categorys
-- ----------------------------
CREATE TABLE `mod_products_categorys` (
  `mod_prod_cat_prod_id` int NOT NULL COMMENT 'ID de prod cat prod',
  `mod_prod_cat_cat_id` int NOT NULL COMMENT 'ID de prod cat cat',
  `mod_prod_cat_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_prod_cat_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_prod_cat_prod_id`,`mod_prod_cat_cat_id`,`mod_prod_cat_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_categorys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_clothing_store
-- ----------------------------
CREATE TABLE `mod_products_clothing_store` (
  `mod_prod_cst_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod cst',
  `mod_prod_cst_prod_id` int NOT NULL COMMENT 'ID de prod cst prod',
  `mod_prod_cst_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'sx,l,m,l',
  `mod_prod_cst_codebar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod prod cst codebar',
  `mod_prod_cst_contents` int NOT NULL COMMENT 'Valor de mod prod cst contents',
  `mod_prod_cst_colors` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'json',
  `mod_prop_cst_notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Notas del registro',
  PRIMARY KEY (`mod_prod_cst_id`,`mod_prod_cst_prod_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_clothing_store
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_colors
-- ----------------------------
CREATE TABLE `mod_products_colors` (
  `mod_prod_color_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod color',
  `mod_prod_color_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_prod_color_hex` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod color hex',
  `mod_prod_color_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_prod_color_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_prod_color_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_prod_color_id`,`mod_prod_color_hex`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_colors
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_files
-- ----------------------------
CREATE TABLE `mod_products_files` (
  `mod_prod_file_prod_id` int NOT NULL COMMENT 'ID de prod file prod',
  `mod_prod_file_file_id` int NOT NULL COMMENT 'ID de prod file file',
  `mod_prod_file_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_prod_file_prod_id`,`mod_prod_file_file_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_files
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_food
-- ----------------------------
CREATE TABLE `mod_products_food` (
  `mod_prod_food_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod food',
  `mod_prod_food_prod_id` int DEFAULT NULL COMMENT 'ID de prod food prod',
  PRIMARY KEY (`mod_prod_food_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_food
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_options
-- ----------------------------
CREATE TABLE `mod_products_options` (
  `mod_prod_opt_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod opt',
  `mod_prod_opt_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_prod_opt_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod opt value',
  `mod_prod_opt_autoload` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod opt autoload',
  PRIMARY KEY (`mod_prod_opt_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_options
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_pharmacy
-- ----------------------------
CREATE TABLE `mod_products_pharmacy` (
  `mod_prod_pha_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod pha',
  `mod_prod_pha_code_provider` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha code provider',
  `mod_prod_pha_prov_id` int NOT NULL COMMENT 'ID de prod pha prov',
  `mod_prod_pha_lab_id` int NOT NULL COMMENT 'ID de prod pha lab',
  `mod_prod_pha_mak_id` int NOT NULL COMMENT 'ID de prod pha mak',
  `mod_prod_pha_presentation` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha presentation',
  `mod_prod_pha_codebar` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha codebar',
  `mod_prod_pha_phar_form` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha phar form',
  `mod_prod_pha_active_concentration_1` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha active concentration 1',
  `mod_prod_pha_active_concentration_2` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha active concentration 2',
  `mod_prod_pha_active_concentration_3` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha active concentration 3',
  `mod_prod_pha_therapy_action` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha therapy action',
  `mod_prod_pha_condition_sale` int NOT NULL COMMENT 'Valor de mod prod pha condition sale',
  PRIMARY KEY (`mod_prod_pha_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_pharmacy
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_pharmacy_stock
-- ----------------------------
CREATE TABLE `mod_products_pharmacy_stock` (
  `mod_prod_pha_stk_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod pha stk',
  `mod_prod_pha_stk_contry_id` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID de prod pha stk contry',
  `mod_prod_pha_stk_nro_health_registration` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha stk nro health registration',
  `mod_prod_pha_stk_expiration_date` datetime NOT NULL COMMENT 'Fecha del registro',
  `mod_prod_pha_stk_registration_date` datetime NOT NULL COMMENT 'Fecha del registro',
  `mod_prod_pha_stk_purchase_unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha stk purchase unit',
  `mod_prod_pha_stk_ratio_units_box` int NOT NULL COMMENT 'Valor de mod prod pha stk ratio units box',
  `mod_prod_pha_stk_lot` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha stk lot',
  `mod_prod_pha_stk_box_blister_ratio` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha stk box blister ratio',
  `mod_prod_pha_stk_height_cm` int NOT NULL COMMENT 'Valor de mod prod pha stk height cm',
  `mod_prod_pha_stk_width_cm` int NOT NULL COMMENT 'Valor de mod prod pha stk width cm',
  `mod_prod_pha_stk_depth_cm` int NOT NULL COMMENT 'Valor de mod prod pha stk depth cm',
  `mod_prod_pha_stk_diameter_cm` int NOT NULL COMMENT 'Valor de mod prod pha stk diameter cm',
  `mod_prod_pha_stk_storage_temperature_c` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod pha stk storage temperature c',
  PRIMARY KEY (`mod_prod_pha_stk_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_pharmacy_stock
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_prices_list
-- ----------------------------
CREATE TABLE `mod_products_prices_list` (
  `mod_prod_prl_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod prl',
  `mod_prod_prl_prod_id` int NOT NULL COMMENT 'ID de prod prl prod',
  `mod_prod_prl_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código interno',
  `mod_prod_prl_price` decimal(20,2) NOT NULL COMMENT 'Valor de mod prod prl price',
  `mod_prod_prl_previous_price` decimal(20,2) DEFAULT NULL COMMENT 'Valor de mod prod prl previous price',
  `mod_prod_prl_coin` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod prod prl coin',
  `mod_prod_prl_register_date` date NOT NULL COMMENT 'Fecha de registro',
  PRIMARY KEY (`mod_prod_prl_id`,`mod_prod_prl_prod_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_prices_list
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_relation
-- ----------------------------
CREATE TABLE `mod_products_relation` (
  `mod_prod_rel_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod rel',
  `mod_prod_rel_prod_id` int NOT NULL COMMENT 'ID de prod rel prod',
  `mod_prod_rel_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_prod_rel_type` int DEFAULT NULL COMMENT 'Tipo de registro',
  `mod_prod_rel_stock` int DEFAULT NULL COMMENT 'Valor de mod prod rel stock',
  `mod_prod_rel_pricing` int DEFAULT NULL COMMENT 'Valor de mod prod rel pricing',
  PRIMARY KEY (`mod_prod_rel_id`,`mod_prod_rel_prod_id`,`mod_prod_rel_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_relation
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_rw
-- ----------------------------
CREATE TABLE `mod_products_rw` (
  `mod_prod_rw_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod rw',
  `mod_prod_rw_prod_id` int NOT NULL COMMENT 'ID de prod rw prod',
  `mod_prod_rw_state` tinyint DEFAULT '0' COMMENT 'Estado del registro',
  `mod_prod_rw_rmc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw rmc',
  `mod_prod_rw_reference` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw reference',
  `mod_prod_rw_familyname` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw familyname',
  `mod_prod_rw_modelname` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw modelname',
  `mod_prod_rw_ranking` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw ranking',
  `mod_prod_rw_spec_modelcase` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec modelcase',
  `mod_prod_rw_spec_diameter` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec diameter',
  `mod_prod_rw_spec_material` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec material',
  `mod_prod_rw_spec_bezel` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec bezel',
  `mod_prod_rw_spec_windingcrown` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec windingcrown',
  `mod_prod_rw_spec_crystal` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec crystal',
  `mod_prod_rw_spec_waterresistance` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec waterresistance',
  `mod_prod_rw_spec_movement` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec movement',
  `mod_prod_rw_spec_calibre` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec calibre',
  `mod_prod_rw_spec_bracelet` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec bracelet',
  `mod_prod_rw_spec_braceletmaterial` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec braceletmaterial',
  `mod_prod_rw_spec_clasp` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec clasp',
  `mod_prod_rw_spec_dial` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec dial',
  `mod_prod_rw_spec_gem_setting` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec gem setting',
  `mod_prod_rw_spec_powerreserve` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec powerreserve',
  `mod_prod_rw_spec_certification` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw spec certification',
  `mod_prod_rw_gallery_image1` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw gallery image1',
  `mod_prod_rw_gallery_image2` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw gallery image2',
  `mod_prod_rw_gallery_image3` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw gallery image3',
  `mod_prod_rw_gallery_image4` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw gallery image4',
  `mod_prod_rw_feature1_title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature1 title',
  `mod_prod_rw_feature1_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature1 text',
  `mod_prod_rw_feature1_asset` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature1 asset',
  `mod_prod_rw_feature2_title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature2 title',
  `mod_prod_rw_feature2_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature2 text',
  `mod_prod_rw_feature2_asset` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature2 asset',
  `mod_prod_rw_feature3_title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature3 title',
  `mod_prod_rw_feature3_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature3 text',
  `mod_prod_rw_feature3_asset` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw feature3 asset',
  `mod_prod_rw_brochure` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw brochure',
  `mod_prod_rw_h1` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod prod rw h1',
  PRIMARY KEY (`mod_prod_rw_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_rw
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_products_types
-- ----------------------------
CREATE TABLE `mod_products_types` (
  `mod_prod_type_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prod type',
  `mod_prod_type_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_prod_type_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta del recurso',
  `mod_prod_type_subfix` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prod type subfix',
  `mod_prod_type_subfix_db` varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod prod type subfix db',
  `mod_prod_type_primary` int DEFAULT '0' COMMENT 'Valor de mod prod type primary',
  `mod_prod_type_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_prod_type_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_prod_type_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_prod_type_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_types
-- ----------------------------
BEGIN;
INSERT INTO `mod_products_types` VALUES (1, 'Store', 'store', '_str', '_store', 0, '', 1, 1);
INSERT INTO `mod_products_types` VALUES (2, 'Clothing store', 'clothingStore', '_cst', '_clothing_store', 1, NULL, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_products_warehouses
-- ----------------------------
CREATE TABLE `mod_products_warehouses` (
  `mod_prod_wrh_prod_id` int NOT NULL COMMENT 'ID de prod wrh prod',
  `mod_prod_wrh_wrh_id` int NOT NULL COMMENT 'ID de prod wrh wrh',
  `mod_prod_wrh_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_prod_wrh_prod_id`,`mod_prod_wrh_wrh_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_products_warehouses
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_providers
-- ----------------------------
CREATE TABLE `mod_providers` (
  `mod_prov_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de prov',
  `mod_prov_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Código interno',
  `mod_prov_user_id` int NOT NULL COMMENT 'ID del usuario',
  `mod_prov_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_prov_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Correo electrónico',
  `mod_prov_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Número de teléfono',
  `mod_prov_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prov address',
  `mod_prov_rating` decimal(3,2) DEFAULT NULL COMMENT 'Valor de mod prov rating',
  `mod_prov_city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prov city',
  `mod_prov_zip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prov zip',
  `mod_prov_country` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prov country',
  `mod_prov_website` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prov website',
  `mod_prov_logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod prov logo',
  `mod_prov_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Descripción del registro',
  `mod_prov_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Tipo de registro',
  `mod_prov_created` datetime NOT NULL COMMENT 'Valor de mod prov created',
  `mod_prov_modified` datetime NOT NULL COMMENT 'Valor de mod prov modified',
  `mod_prov_deleted` datetime DEFAULT NULL COMMENT 'Fecha de eliminación (si aplica)',
  `mod_prov_state` int DEFAULT '0' COMMENT 'Estado (0: Inactivo, 1: Activo)',
  PRIMARY KEY (`mod_prov_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_providers
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_attachments
-- ----------------------------
CREATE TABLE `mod_ps_attachments` (
  `mod_ps_attachments_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_attachments_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id',
  `mod_ps_attachments_task_id` int NOT NULL COMMENT 'FK a mod_ps_tasks',
  `mod_ps_attachments_user_id` int NOT NULL COMMENT 'FK a users',
  `mod_ps_attachments_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre',
  `mod_ps_attachments_path` varchar(500) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Ruta',
  `mod_ps_attachments_mime` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'MIME',
  `mod_ps_attachments_size` int DEFAULT '0' COMMENT 'Bytes',
  `mod_ps_attachments_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Carga',
  `mod_ps_attachments_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_attachments_id`),
  KEY `idx_attachments_ent` (`mod_ps_attachments_ent_id`),
  KEY `idx_attachments_task` (`mod_ps_attachments_task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_attachments
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_comments
-- ----------------------------
CREATE TABLE `mod_ps_comments` (
  `mod_ps_comments_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_comments_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id',
  `mod_ps_comments_task_id` int NOT NULL COMMENT 'FK a mod_ps_tasks',
  `mod_ps_comments_user_id` int NOT NULL COMMENT 'FK a users',
  `mod_ps_comments_parent_id` int DEFAULT NULL COMMENT 'Respuesta',
  `mod_ps_comments_body` text COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Contenido (markdown)',
  `mod_ps_comments_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creación',
  `mod_ps_comments_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Actualización',
  `mod_ps_comments_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_comments_id`),
  KEY `idx_comments_ent` (`mod_ps_comments_ent_id`),
  KEY `idx_comments_task` (`mod_ps_comments_task_id`),
  KEY `idx_comments_user` (`mod_ps_comments_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_comments
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_members
-- ----------------------------
CREATE TABLE `mod_ps_members` (
  `mod_ps_members_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_members_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id',
  `mod_ps_members_project_id` int NOT NULL COMMENT 'FK a mod_ps_projects',
  `mod_ps_members_user_id` int NOT NULL COMMENT 'FK a users',
  `mod_ps_members_role` enum('owner','manager','member','viewer') COLLATE utf8mb4_general_ci DEFAULT 'member' COMMENT 'Rol',
  `mod_ps_members_hours_cost` decimal(10,2) DEFAULT NULL COMMENT 'Costo/hora',
  `mod_ps_members_joined_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Alta',
  `mod_ps_members_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_members_id`),
  UNIQUE KEY `uk_members_project_user` (`mod_ps_members_project_id`,`mod_ps_members_user_id`),
  KEY `idx_members_ent` (`mod_ps_members_ent_id`),
  KEY `idx_members_project` (`mod_ps_members_project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_members
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_process_links
-- ----------------------------
CREATE TABLE `mod_ps_process_links` (
  `mod_ps_process_links_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_process_links_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id',
  `mod_ps_process_links_project_id` int NOT NULL COMMENT 'FK a mod_ps_projects',
  `mod_ps_process_links_from_id` int NOT NULL COMMENT 'FK a mod_ps_processes (origen)',
  `mod_ps_process_links_to_id` int NOT NULL COMMENT 'FK a mod_ps_processes (destino)',
  `mod_ps_process_links_label` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Etiqueta de la transición',
  `mod_ps_process_links_condition` text COLLATE utf8mb4_general_ci COMMENT 'Condición',
  `mod_ps_process_links_order` int DEFAULT '0' COMMENT 'Orden',
  `mod_ps_process_links_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_process_links_id`),
  KEY `idx_proc_links_ent` (`mod_ps_process_links_ent_id`),
  KEY `idx_proc_links_project` (`mod_ps_process_links_project_id`),
  KEY `idx_proc_links_from` (`mod_ps_process_links_from_id`),
  KEY `idx_proc_links_to` (`mod_ps_process_links_to_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_process_links
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_process_links` VALUES (1, 1, 1, 1, 2, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (2, 1, 1, 2, 3, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (3, 1, 1, 3, 4, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (4, 1, 1, 4, 5, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (5, 1, 2, 6, 7, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (6, 1, 2, 7, 8, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (7, 1, 2, 8, 9, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_process_links` VALUES (8, 1, 2, 9, 10, NULL, NULL, 0, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_processes
-- ----------------------------
CREATE TABLE `mod_ps_processes` (
  `mod_ps_processes_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_processes_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id',
  `mod_ps_processes_project_id` int NOT NULL COMMENT 'FK a mod_ps_projects',
  `mod_ps_processes_template_process_id` int DEFAULT NULL COMMENT 'FK a mod_ps_template_processes (origen, trazabilidad)',
  `mod_ps_processes_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre',
  `mod_ps_processes_slug` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Slug',
  `mod_ps_processes_markdown` longtext COLLATE utf8mb4_general_ci COMMENT 'Markdown del proceso (copiado de la plantilla, editable)',
  `mod_ps_processes_category` enum('todo','doing','done') COLLATE utf8mb4_general_ci DEFAULT 'todo' COMMENT 'Categoría',
  `mod_ps_processes_owner_user_id` int DEFAULT NULL COMMENT 'Responsable del proceso (FK a users)',
  `mod_ps_processes_color` varchar(20) COLLATE utf8mb4_general_ci DEFAULT '#94a3b8' COMMENT 'Color',
  `mod_ps_processes_icon` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Icono',
  `mod_ps_processes_pos_x` int DEFAULT '0' COMMENT 'Pos X en canvas',
  `mod_ps_processes_pos_y` int DEFAULT '0' COMMENT 'Pos Y en canvas',
  `mod_ps_processes_order` int DEFAULT '0' COMMENT 'Orden lineal',
  `mod_ps_processes_start_date` date DEFAULT NULL COMMENT 'Inicio planeado',
  `mod_ps_processes_end_date` date DEFAULT NULL COMMENT 'Fin planeado',
  `mod_ps_processes_status` enum('not_started','in_progress','completed','blocked') COLLATE utf8mb4_general_ci DEFAULT 'not_started' COMMENT 'Estado del proceso',
  `mod_ps_processes_progress` int DEFAULT '0' COMMENT 'Progreso (0-100)',
  `mod_ps_processes_wip_limit` int DEFAULT '0' COMMENT 'Límite WIP',
  `mod_ps_processes_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creación',
  `mod_ps_processes_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Actualización',
  `mod_ps_processes_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_processes_id`),
  KEY `idx_processes_ent` (`mod_ps_processes_ent_id`),
  KEY `idx_processes_project` (`mod_ps_processes_project_id`),
  KEY `idx_processes_order` (`mod_ps_processes_order`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_processes
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_processes` VALUES (1, 1, 1, 1, 'Planificación', 'planning', NULL, 'todo', NULL, '#94a3b8', NULL, 50, 200, 1, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (2, 1, 1, 2, 'Movimiento suelo', 'earthwork', NULL, 'doing', NULL, '#f59e0b', NULL, 250, 200, 2, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (3, 1, 1, 3, 'Estructura', 'structure', NULL, 'doing', NULL, '#3b82f6', NULL, 450, 200, 3, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (4, 1, 1, 4, 'Acabados', 'finishing', NULL, 'doing', NULL, '#8b5cf6', NULL, 650, 200, 4, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (5, 1, 1, 5, 'Entrega', 'delivery', NULL, 'done', NULL, '#10b981', NULL, 850, 200, 5, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (6, 1, 2, 6, 'Brief', 'brief', NULL, 'todo', NULL, '#94a3b8', NULL, 50, 200, 1, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (7, 1, 2, 7, 'Creatividad', 'creative', NULL, 'doing', NULL, '#ec4899', NULL, 250, 200, 2, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (8, 1, 2, 8, 'Producción', 'production', NULL, 'doing', NULL, '#f59e0b', NULL, 450, 200, 3, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (9, 1, 2, 9, 'Lanzamiento', 'launch', NULL, 'doing', NULL, '#3b82f6', NULL, 650, 200, 4, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_processes` VALUES (10, 1, 2, 10, 'Medición', 'measuring', NULL, 'done', NULL, '#10b981', NULL, 850, 200, 5, NULL, NULL, 'not_started', 0, 0, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_project_types
-- ----------------------------
CREATE TABLE `mod_ps_project_types` (
  `mod_ps_project_types_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del tipo',
  `mod_ps_project_types_ent_id` int DEFAULT NULL COMMENT 'FK a entities.ent_id (NULL = global, valor = privado de esa entidad)',
  `mod_ps_project_types_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre (Construcción, Marketing…)',
  `mod_ps_project_types_slug` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Slug interno',
  `mod_ps_project_types_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción',
  `mod_ps_project_types_icon` varchar(50) COLLATE utf8mb4_general_ci DEFAULT 'icon-operations' COMMENT 'Icono',
  `mod_ps_project_types_color` varchar(20) COLLATE utf8mb4_general_ci DEFAULT '#3b82f6' COMMENT 'Color',
  `mod_ps_project_types_order` int DEFAULT '0' COMMENT 'Orden',
  `mod_ps_project_types_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creación',
  `mod_ps_project_types_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Actualización',
  `mod_ps_project_types_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_project_types_id`),
  UNIQUE KEY `uk_project_types_ent_slug` (`mod_ps_project_types_ent_id`,`mod_ps_project_types_slug`),
  KEY `idx_project_types_ent` (`mod_ps_project_types_ent_id`),
  KEY `idx_project_types_state` (`mod_ps_project_types_state`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_project_types
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_project_types` VALUES (1, NULL, 'Construcción', 'construction', NULL, 'icon-building', '#f59e0b', 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_project_types` VALUES (2, NULL, 'Marketing', 'marketing', NULL, 'icon-megaphone', '#ec4899', 2, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_project_types` VALUES (3, NULL, 'Consultoría', 'consulting', NULL, 'icon-users', '#10b981', 3, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_project_types` VALUES (4, NULL, 'TI / Software', 'software', NULL, 'icon-code', '#3b82f6', 4, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_project_types` VALUES (5, NULL, 'RRHH', 'hr', NULL, 'icon-user', '#8b5cf6', 5, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_project_types` VALUES (6, NULL, 'Genérico', 'generic', NULL, 'icon-operations', '#64748b', 99, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_projects
-- ----------------------------
CREATE TABLE `mod_ps_projects` (
  `mod_ps_projects_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_projects_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id (entidad dueña del proyecto)',
  `mod_ps_projects_type_id` int DEFAULT NULL COMMENT 'FK a mod_ps_project_types',
  `mod_ps_projects_template_id` int DEFAULT NULL COMMENT 'FK a mod_ps_templates (origen, trazabilidad)',
  `mod_ps_projects_key` varchar(10) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Clave para códigos de tarea (OBRA, MKT)',
  `mod_ps_projects_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre',
  `mod_ps_projects_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción',
  `mod_ps_projects_markdown` longtext COLLATE utf8mb4_general_ci COMMENT 'Markdown del proyecto (copiado de la plantilla al crear, editable)',
  `mod_ps_projects_client` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Cliente',
  `mod_ps_projects_client_id` int DEFAULT NULL COMMENT 'FK a contactos',
  `mod_ps_projects_lead_user_id` int DEFAULT NULL COMMENT 'PM (FK a users)',
  `mod_ps_projects_color` varchar(20) COLLATE utf8mb4_general_ci DEFAULT '#3b82f6' COMMENT 'Color',
  `mod_ps_projects_icon` varchar(50) COLLATE utf8mb4_general_ci DEFAULT 'icon-operations' COMMENT 'Icono',
  `mod_ps_projects_task_seq` int DEFAULT '0' COMMENT 'Último número de tarea',
  `mod_ps_projects_status` enum('planning','in_progress','on_hold','completed','cancelled','archived') COLLATE utf8mb4_general_ci DEFAULT 'planning' COMMENT 'Estado',
  `mod_ps_projects_priority` enum('low','medium','high','critical') COLLATE utf8mb4_general_ci DEFAULT 'medium' COMMENT 'Prioridad',
  `mod_ps_projects_budget` decimal(15,2) DEFAULT '0.00' COMMENT 'Presupuesto',
  `mod_ps_projects_currency` varchar(3) COLLATE utf8mb4_general_ci DEFAULT 'USD' COMMENT 'Moneda',
  `mod_ps_projects_progress` int DEFAULT '0' COMMENT 'Progreso (0-100)',
  `mod_ps_projects_start_date` date DEFAULT NULL COMMENT 'Inicio planeado',
  `mod_ps_projects_end_date` date DEFAULT NULL COMMENT 'Fin planeado',
  `mod_ps_projects_actual_start` date DEFAULT NULL COMMENT 'Inicio real',
  `mod_ps_projects_actual_end` date DEFAULT NULL COMMENT 'Fin real',
  `mod_ps_projects_visibility` enum('public','private','team') COLLATE utf8mb4_general_ci DEFAULT 'team' COMMENT 'Visibilidad',
  `mod_ps_projects_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creación',
  `mod_ps_projects_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Actualización',
  `mod_ps_projects_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_projects_id`),
  UNIQUE KEY `uk_projects_ent_key` (`mod_ps_projects_ent_id`,`mod_ps_projects_key`),
  KEY `idx_projects_ent` (`mod_ps_projects_ent_id`),
  KEY `idx_projects_type` (`mod_ps_projects_type_id`),
  KEY `idx_projects_template` (`mod_ps_projects_template_id`),
  KEY `idx_projects_status` (`mod_ps_projects_status`),
  KEY `idx_projects_state` (`mod_ps_projects_state`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_projects
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_projects` VALUES (1, 1, 1, 1, 'OBRA', 'Edificio Las Palmeras', 'Obra civil de 15 pisos', NULL, NULL, NULL, NULL, '#f59e0b', 'icon-building', 0, 'in_progress', 'high', 0.00, 'USD', 0, NULL, NULL, NULL, NULL, 'team', '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_projects` VALUES (2, 1, 2, 2, 'MKT', 'Campaña Lanzamiento Q2', 'Campaña digital', NULL, NULL, NULL, NULL, '#ec4899', 'icon-megaphone', 0, 'planning', 'medium', 0.00, 'USD', 0, NULL, NULL, NULL, NULL, 'team', '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_tasks
-- ----------------------------
CREATE TABLE `mod_ps_tasks` (
  `mod_ps_tasks_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_tasks_ent_id` int NOT NULL COMMENT 'FK a entities.ent_id',
  `mod_ps_tasks_project_id` int NOT NULL COMMENT 'FK a mod_ps_projects',
  `mod_ps_tasks_process_id` int NOT NULL COMMENT 'FK a mod_ps_processes (proceso actual)',
  `mod_ps_tasks_code` varchar(20) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Código visible: OBRA-12',
  `mod_ps_tasks_title` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Título',
  `mod_ps_tasks_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción',
  `mod_ps_tasks_type` enum('task','milestone','deliverable','meeting','risk','issue') COLLATE utf8mb4_general_ci DEFAULT 'task' COMMENT 'Tipo',
  `mod_ps_tasks_priority` enum('low','medium','high','critical') COLLATE utf8mb4_general_ci DEFAULT 'medium' COMMENT 'Prioridad',
  `mod_ps_tasks_assignee_id` int DEFAULT NULL COMMENT 'Asignado (FK a users)',
  `mod_ps_tasks_reporter_id` int DEFAULT NULL COMMENT 'Creador (FK a users)',
  `mod_ps_tasks_parent_id` int DEFAULT NULL COMMENT 'Tarea padre',
  `mod_ps_tasks_estimate_hours` decimal(8,2) DEFAULT NULL COMMENT 'Horas estimadas',
  `mod_ps_tasks_spent_hours` decimal(8,2) DEFAULT '0.00' COMMENT 'Horas reales',
  `mod_ps_tasks_progress` int DEFAULT '0' COMMENT 'Progreso (0-100)',
  `mod_ps_tasks_cost_estimated` decimal(15,2) DEFAULT '0.00' COMMENT 'Costo estimado',
  `mod_ps_tasks_cost_actual` decimal(15,2) DEFAULT '0.00' COMMENT 'Costo real',
  `mod_ps_tasks_labels` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Etiquetas',
  `mod_ps_tasks_start_date` date DEFAULT NULL COMMENT 'Inicio',
  `mod_ps_tasks_due_date` date DEFAULT NULL COMMENT 'Fecha límite',
  `mod_ps_tasks_completed_at` timestamp NULL DEFAULT NULL COMMENT 'Cierre real',
  `mod_ps_tasks_order` int DEFAULT '0' COMMENT 'Orden en el proceso',
  `mod_ps_tasks_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creación',
  `mod_ps_tasks_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Actualización',
  `mod_ps_tasks_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_tasks_id`),
  UNIQUE KEY `uk_tasks_ent_code` (`mod_ps_tasks_ent_id`,`mod_ps_tasks_code`),
  KEY `idx_tasks_ent` (`mod_ps_tasks_ent_id`),
  KEY `idx_tasks_project` (`mod_ps_tasks_project_id`),
  KEY `idx_tasks_process` (`mod_ps_tasks_process_id`),
  KEY `idx_tasks_assignee` (`mod_ps_tasks_assignee_id`),
  KEY `idx_tasks_parent` (`mod_ps_tasks_parent_id`),
  KEY `idx_tasks_order` (`mod_ps_tasks_order`),
  KEY `idx_tasks_state` (`mod_ps_tasks_state`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_tasks
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_tasks` VALUES (1, 1, 1, 1, 'OBRA-1', 'Aprobar planos', NULL, 'milestone', 'high', NULL, NULL, NULL, NULL, 0.00, 0, 0.00, 0.00, NULL, NULL, NULL, NULL, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_tasks` VALUES (2, 1, 1, 2, 'OBRA-2', 'Excavación de cimientos', NULL, 'task', 'high', NULL, NULL, NULL, NULL, 0.00, 0, 0.00, 0.00, NULL, NULL, NULL, NULL, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_tasks` VALUES (3, 1, 1, 3, 'OBRA-3', 'Encofrado y hormigonado', NULL, 'deliverable', 'high', NULL, NULL, NULL, NULL, 0.00, 0, 0.00, 0.00, NULL, NULL, NULL, NULL, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_tasks` VALUES (4, 1, 2, 6, 'MKT-1', 'Reunión con cliente', NULL, 'meeting', 'high', NULL, NULL, NULL, NULL, 0.00, 0, 0.00, 0.00, NULL, NULL, NULL, NULL, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_tasks` VALUES (5, 1, 2, 7, 'MKT-2', 'Propuestas creativas', NULL, 'deliverable', 'high', NULL, NULL, NULL, NULL, 0.00, 0, 0.00, 0.00, NULL, NULL, NULL, NULL, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_template_process_links
-- ----------------------------
CREATE TABLE `mod_ps_template_process_links` (
  `mod_ps_template_process_links_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_template_process_links_template_id` int NOT NULL COMMENT 'FK a mod_ps_templates',
  `mod_ps_template_process_links_from_id` int NOT NULL COMMENT 'FK a mod_ps_template_processes (origen)',
  `mod_ps_template_process_links_to_id` int NOT NULL COMMENT 'FK a mod_ps_template_processes (destino)',
  `mod_ps_template_process_links_label` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Etiqueta visible en el arco (ej: "aprobado", "rechazado")',
  `mod_ps_template_process_links_condition` text COLLATE utf8mb4_general_ci COMMENT 'Condición descriptiva de la transición',
  `mod_ps_template_process_links_order` int DEFAULT '0' COMMENT 'Orden cuando hay varios outgoing',
  `mod_ps_template_process_links_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_template_process_links_id`),
  KEY `idx_tpl_links_template` (`mod_ps_template_process_links_template_id`),
  KEY `idx_tpl_links_from` (`mod_ps_template_process_links_from_id`),
  KEY `idx_tpl_links_to` (`mod_ps_template_process_links_to_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_template_process_links
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_template_process_links` VALUES (1, 1, 1, 2, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (2, 1, 2, 3, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (3, 1, 3, 4, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (4, 1, 4, 5, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (5, 2, 6, 7, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (6, 2, 7, 8, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (7, 2, 8, 9, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (8, 2, 9, 10, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (9, 3, 11, 12, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (10, 3, 12, 13, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (11, 3, 13, 14, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (12, 4, 15, 16, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (13, 4, 16, 17, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (14, 4, 17, 18, 'aprobado', NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (15, 4, 17, 16, 'rechazado', NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (16, 5, 19, 20, NULL, NULL, 0, 1);
INSERT INTO `mod_ps_template_process_links` VALUES (17, 5, 20, 21, NULL, NULL, 0, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_template_process_tasks
-- ----------------------------
CREATE TABLE `mod_ps_template_process_tasks` (
  `mod_ps_template_process_tasks_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_template_process_tasks_process_id` int NOT NULL COMMENT 'FK a mod_ps_template_processes',
  `mod_ps_template_process_tasks_title` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Título',
  `mod_ps_template_process_tasks_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción',
  `mod_ps_template_process_tasks_type` enum('task','milestone','deliverable','meeting','risk','issue') COLLATE utf8mb4_general_ci DEFAULT 'task' COMMENT 'Tipo',
  `mod_ps_template_process_tasks_priority` enum('low','medium','high','critical') COLLATE utf8mb4_general_ci DEFAULT 'medium' COMMENT 'Prioridad',
  `mod_ps_template_process_tasks_estimate_hours` decimal(8,2) DEFAULT NULL COMMENT 'Horas estimadas',
  `mod_ps_template_process_tasks_offset_days` int DEFAULT NULL COMMENT 'Días desde inicio del proyecto para due_date',
  `mod_ps_template_process_tasks_order` int DEFAULT '0' COMMENT 'Orden dentro del proceso',
  `mod_ps_template_process_tasks_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_template_process_tasks_id`),
  KEY `idx_tpl_proc_tasks_process` (`mod_ps_template_process_tasks_process_id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_template_process_tasks
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_template_process_tasks` VALUES (1, 1, 'Aprobar planos', NULL, 'milestone', 'high', NULL, 7, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (2, 1, 'Contratar proveedores', NULL, 'task', 'high', NULL, 14, 2, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (3, 2, 'Excavación de cimientos', NULL, 'task', 'high', NULL, 30, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (4, 3, 'Encofrado y hormigonado', NULL, 'deliverable', 'high', NULL, 120, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (5, 4, 'Acabados interiores', NULL, 'task', 'medium', NULL, 300, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (6, 5, 'Entrega al cliente', NULL, 'milestone', 'critical', NULL, 365, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (7, 6, 'Reunión con cliente', NULL, 'meeting', 'high', NULL, 2, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (8, 7, 'Propuestas creativas', NULL, 'deliverable', 'high', NULL, 15, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (9, 8, 'Producción de piezas', NULL, 'task', 'medium', NULL, 45, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (10, 9, 'Salida al aire', NULL, 'milestone', 'critical', NULL, 60, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (11, 10, 'Informe de resultados', NULL, 'deliverable', 'high', NULL, 90, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (12, 11, 'Entrevistas iniciales', NULL, 'task', 'medium', NULL, 5, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (13, 12, 'Brechas y oportunidades', NULL, 'task', 'high', NULL, 20, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (14, 13, 'Informe final', NULL, 'deliverable', 'high', NULL, 28, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (15, 14, 'Presentación directorio', NULL, 'milestone', 'critical', NULL, 30, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (16, 15, 'Refinement historias', NULL, 'task', 'medium', NULL, 1, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (17, 16, 'Desarrollar historia', NULL, 'task', 'high', NULL, 15, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (18, 17, 'Pruebas de regresión', NULL, 'task', 'high', NULL, 25, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (19, 18, 'Deploy a producción', NULL, 'milestone', 'critical', NULL, 30, 1, 1);
INSERT INTO `mod_ps_template_process_tasks` VALUES (20, 19, 'Primera tarea (ejemplo)', NULL, 'task', 'medium', NULL, NULL, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_template_processes
-- ----------------------------
CREATE TABLE `mod_ps_template_processes` (
  `mod_ps_template_processes_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_template_processes_template_id` int NOT NULL COMMENT 'FK a mod_ps_templates',
  `mod_ps_template_processes_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del proceso (paso)',
  `mod_ps_template_processes_slug` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Slug interno (planning, earthwork, delivery)',
  `mod_ps_template_processes_markdown` longtext COLLATE utf8mb4_general_ci COMMENT 'Documento markdown del proceso: objetivo, entregables, checklist',
  `mod_ps_template_processes_category` enum('todo','doing','done') COLLATE utf8mb4_general_ci DEFAULT 'todo' COMMENT 'Categoría lógica (para progreso y stats)',
  `mod_ps_template_processes_owner_role` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Rol sugerido responsable (PM, Lead, etc.)',
  `mod_ps_template_processes_color` varchar(20) COLLATE utf8mb4_general_ci DEFAULT '#94a3b8' COMMENT 'Color del nodo',
  `mod_ps_template_processes_icon` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Icono del nodo',
  `mod_ps_template_processes_pos_x` int DEFAULT '0' COMMENT 'Posición X en el canvas del workflow',
  `mod_ps_template_processes_pos_y` int DEFAULT '0' COMMENT 'Posición Y en el canvas del workflow',
  `mod_ps_template_processes_order` int DEFAULT '0' COMMENT 'Orden lineal (fallback si no hay canvas)',
  `mod_ps_template_processes_duration_days` int DEFAULT NULL COMMENT 'Días estimados del proceso',
  `mod_ps_template_processes_wip_limit` int DEFAULT '0' COMMENT 'Límite WIP (0=ninguno)',
  `mod_ps_template_processes_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_template_processes_id`),
  UNIQUE KEY `uk_tpl_proc_template_slug` (`mod_ps_template_processes_template_id`,`mod_ps_template_processes_slug`),
  KEY `idx_tpl_proc_template` (`mod_ps_template_processes_template_id`),
  KEY `idx_tpl_proc_order` (`mod_ps_template_processes_order`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_template_processes
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_template_processes` VALUES (1, 1, 'Planificación', 'planning', '## Planificación\n\n**Objetivo:** aprobar planos y permisos.\n\n### Entregables\n- Planos firmados\n- Permisos municipales\n\n### Checklist\n- [ ] Revisión arquitecto\n- [ ] Cálculo estructural\n- [ ] Permisos', 'todo', 'PM', '#94a3b8', NULL, 50, 200, 1, 30, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (2, 1, 'Movimiento suelo', 'earthwork', '## Movimiento de Suelo\n\n**Objetivo:** preparar el terreno.\n\n### Entregables\n- Terreno nivelado\n- Cimientos listos\n\n### Checklist\n- [ ] Excavación\n- [ ] Retiro escombros\n- [ ] Compactación', 'doing', 'Jefe obra', '#f59e0b', NULL, 250, 200, 2, 45, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (3, 1, 'Estructura', 'structure', '## Estructura\n\n**Objetivo:** construir esqueleto.\n\n### Entregables\n- Columnas y losas\n- Estructura de 15 pisos', 'doing', 'Jefe obra', '#3b82f6', NULL, 450, 200, 3, 180, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (4, 1, 'Acabados', 'finishing', '## Acabados\n\n**Objetivo:** terminaciones interiores y exteriores.\n\n### Entregables\n- Pintura, pisos, carpintería\n- Instalaciones', 'doing', 'Jefe obra', '#8b5cf6', NULL, 650, 200, 4, 90, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (5, 1, 'Entrega', 'delivery', '## Entrega\n\n**Objetivo:** recepción final.\n\n### Entregables\n- Acta de recepción\n- Manuales de uso', 'done', 'PM', '#10b981', NULL, 850, 200, 5, 20, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (6, 2, 'Brief', 'brief', '## Brief\n\n**Objetivo:** definir alcance con cliente.\n\n### Entregables\n- Brief firmado', 'todo', 'Cuenta', '#94a3b8', NULL, 50, 200, 1, 5, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (7, 2, 'Creatividad', 'creative', '## Creatividad\n\n**Objetivo:** propuestas gráficas.\n\n### Entregables\n- 3 líneas creativas', 'doing', 'Director arte', '#ec4899', NULL, 250, 200, 2, 15, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (8, 2, 'Producción', 'production', '## Producción\n\n**Objetivo:** adaptar piezas a formatos.\n\n### Entregables\n- Piezas finales', 'doing', 'Productor', '#f59e0b', NULL, 450, 200, 3, 30, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (9, 2, 'Lanzamiento', 'launch', '## Lanzamiento\n\n**Objetivo:** publicar en canales.\n\n### Entregables\n- Campaña al aire', 'doing', 'Media', '#3b82f6', NULL, 650, 200, 4, 7, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (10, 2, 'Medición', 'measuring', '## Medición\n\n**Objetivo:** analizar resultados.\n\n### Entregables\n- Reporte de KPIs', 'done', 'Analytics', '#10b981', NULL, 850, 200, 5, 33, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (11, 3, 'Diagnóstico', 'diagnosis', '## Diagnóstico\n\n**Objetivo:** entender situación actual.\n\n### Entregables\n- Mapa AS-IS', 'todo', 'Consultor', '#94a3b8', NULL, 50, 200, 1, 7, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (12, 3, 'Análisis', 'analysis', '## Análisis\n\n**Objetivo:** identificar brechas.\n\n### Entregables\n- Matriz de oportunidades', 'doing', 'Consultor', '#3b82f6', NULL, 250, 200, 2, 10, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (13, 3, 'Informe', 'report', '## Informe\n\n**Objetivo:** documentar hallazgos.\n\n### Entregables\n- Informe ejecutivo', 'doing', 'Consultor', '#f59e0b', NULL, 450, 200, 3, 10, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (14, 3, 'Presentación', 'delivery', '## Presentación\n\n**Objetivo:** exponer al directorio.\n\n### Entregables\n- Presentación + Q&A', 'done', 'Partner', '#10b981', NULL, 650, 200, 4, 3, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (15, 4, 'Backlog', 'backlog', '## Backlog\n\n**Objetivo:** refinar historias.', 'todo', 'PO', '#94a3b8', NULL, 50, 200, 1, 2, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (16, 4, 'En progreso', 'doing', '## En progreso\n\n**Objetivo:** desarrollar.', 'doing', 'Dev', '#3b82f6', NULL, 250, 200, 2, 15, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (17, 4, 'QA', 'qa', '## QA\n\n**Objetivo:** validar calidad.', 'doing', 'QA', '#f59e0b', NULL, 450, 200, 3, 10, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (18, 4, 'Listo', 'done', '## Listo\n\n**Objetivo:** deploy a producción.', 'done', 'DevOps', '#10b981', NULL, 650, 200, 4, 3, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (19, 5, 'Por hacer', 'todo', '## Por hacer\n\nTareas pendientes.', 'todo', NULL, '#94a3b8', NULL, 50, 200, 1, NULL, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (20, 5, 'En progreso', 'doing', '## En progreso\n\nEn ejecución.', 'doing', NULL, '#3b82f6', NULL, 250, 200, 2, NULL, 0, 1);
INSERT INTO `mod_ps_template_processes` VALUES (21, 5, 'Completado', 'done', '## Completado\n\nTerminadas.', 'done', NULL, '#10b981', NULL, 450, 200, 3, NULL, 0, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_ps_templates
-- ----------------------------
CREATE TABLE `mod_ps_templates` (
  `mod_ps_templates_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_ps_templates_ent_id` int DEFAULT NULL COMMENT 'FK a entities.ent_id (NULL = global, valor = privado de esa entidad)',
  `mod_ps_templates_type_id` int NOT NULL COMMENT 'FK a mod_ps_project_types',
  `mod_ps_templates_name` varchar(150) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre de la plantilla',
  `mod_ps_templates_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción corta',
  `mod_ps_templates_markdown` longtext COLLATE utf8mb4_general_ci COMMENT 'Documento markdown con la definición completa del flujo (título, objetivo, pasos, notas)',
  `mod_ps_templates_default_days` int DEFAULT NULL COMMENT 'Duración sugerida en días',
  `mod_ps_templates_is_default` tinyint(1) DEFAULT '0' COMMENT '1 = default del tipo',
  `mod_ps_templates_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creación',
  `mod_ps_templates_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Actualización',
  `mod_ps_templates_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_ps_templates_id`),
  KEY `idx_templates_ent` (`mod_ps_templates_ent_id`),
  KEY `idx_templates_type` (`mod_ps_templates_type_id`),
  KEY `idx_templates_state` (`mod_ps_templates_state`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_ps_templates
-- ----------------------------
BEGIN;
INSERT INTO `mod_ps_templates` VALUES (1, NULL, 1, 'Obra civil estándar', 'Flujo típico de obra: movimiento de suelo → estructura → acabados → entrega', '# Obra Civil Estándar\n\n**Duración estimada:** 12 meses\n\n## Flujo\n\n1. **Planificación** — aprobación de planos y permisos\n2. **Movimiento de suelo** — excavación y nivelación\n3. **Estructura** — encofrado, hormigonado, columnas\n4. **Acabados** — pintura, pisos, carpintería\n5. **Entrega** — acta de recepción\n\n## Notas\n- Cada proceso se gestiona por separado con su equipo.\n- Los hitos críticos deben tener aprobación del cliente.', 365, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_templates` VALUES (2, NULL, 2, 'Campaña digital 90 días', 'Brief → creatividad → producción → lanzamiento → medición', '# Campaña Digital 90 Días\n\n**Duración:** 3 meses\n\n## Flujo\n\n1. **Brief** — levantamiento con cliente\n2. **Creatividad** — propuestas gráficas\n3. **Producción** — adaptación de piezas\n4. **Lanzamiento** — publicación en canales\n5. **Medición** — análisis de KPIs', 90, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_templates` VALUES (3, NULL, 3, 'Consultoría 30 días', 'Diagnóstico → análisis → informe → presentación', '# Consultoría 30 Días\n\n## Flujo\n\n1. **Diagnóstico** — entrevistas y relevamiento\n2. **Análisis** — mapeo AS-IS vs TO-BE\n3. **Informe** — documento ejecutivo\n4. **Presentación** — exposición al directorio', 30, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_templates` VALUES (4, NULL, 4, 'Sprint de desarrollo', 'Backlog → en progreso → QA → listo', '# Sprint de Desarrollo\n\n**Duración:** 2-4 semanas\n\n## Flujo\n\n1. **Backlog** — refinamiento\n2. **En progreso** — desarrollo\n3. **QA** — pruebas\n4. **Listo** — deploy a producción', 30, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
INSERT INTO `mod_ps_templates` VALUES (5, NULL, 6, 'Plantilla simple', 'Flujo básico: por hacer → en progreso → completado', '# Flujo Simple\n\n## Pasos\n\n1. **Por hacer**\n2. **En progreso**\n3. **Completado**', NULL, 1, '2026-04-23 01:54:50', '2026-04-23 01:54:50', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rehabilitation_centers
-- ----------------------------
CREATE TABLE `mod_rehabilitation_centers` (
  `mod_rhb_center_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de rhb center',
  `mod_rhb_center_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_rhb_center_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb center address',
  `mod_rhb_center_coord` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb center coord',
  `mod_rhb_center_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `mod_rhb_center_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_rhb_center_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rhb_center_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rehabilitation_centers
-- ----------------------------
BEGIN;
INSERT INTO `mod_rehabilitation_centers` VALUES (1, 'Centro 1', NULL, NULL, 4, 1, 1);
INSERT INTO `mod_rehabilitation_centers` VALUES (2, 'Centro 2', NULL, NULL, 2, 1, 1);
INSERT INTO `mod_rehabilitation_centers` VALUES (3, 'Centro 3', NULL, NULL, 0, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rehabilitation_intern
-- ----------------------------
CREATE TABLE `mod_rehabilitation_intern` (
  `mod_rhb_int_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de rhb int',
  `mod_rhb_int_acu_id` int NOT NULL COMMENT 'ID de rhb int acu',
  `mod_rhb_int_date_intern` datetime DEFAULT NULL COMMENT 'Valor de mod rhb int date intern',
  `mod_rhb_int_date_graduation` datetime DEFAULT NULL COMMENT 'Valor de mod rhb int date graduation',
  `mod_rhb_int_date_leaving` datetime DEFAULT NULL COMMENT 'Valor de mod rhb int date leaving',
  `mod_rhb_int_reason_leaving` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod rhb int reason leaving',
  `mod_rhb_int_reason_addiction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb int reason addiction',
  `mod_rhb_int_primary_consumption` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb int primary consumption',
  `mod_rhb_int_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rhb_int_id`,`mod_rhb_int_acu_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rehabilitation_intern
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rehabilitation_primary_consumption
-- ----------------------------
CREATE TABLE `mod_rehabilitation_primary_consumption` (
  `mod_rhb_pcn_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de rhb pcn',
  `mod_rhb_pcn_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_rhb_pcn_summary` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb pcn summary',
  `mod_rhb_pcn_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta del recurso',
  `mod_rhb_pcn_order` int DEFAULT NULL COMMENT 'Orden de visualización',
  `mod_rhb_pcn_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rhb_pcn_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rehabilitation_primary_consumption
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rehabilitation_tutor
-- ----------------------------
CREATE TABLE `mod_rehabilitation_tutor` (
  `mod_rhb_tutor_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de rhb tutor',
  `mod_rhb_tutor_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_rhb_tutor_fathers_lastname` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor fathers lastname',
  `mod_rhb_tutor_mothers_lastname` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor mothers lastname',
  `mod_rhb_tutor_rhb_id` int DEFAULT NULL COMMENT 'mod_rhb_user_id',
  `mod_rhb_tutor_gender` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor gender',
  `mod_rhb_tutor_ci` int DEFAULT NULL COMMENT 'Valor de mod rhb tutor ci',
  `mod_rhb_tutor_ext` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor ext',
  `mod_rhb_tutor_dial` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor dial',
  `mod_rhb_tutor_celular` int DEFAULT NULL COMMENT 'Valor de mod rhb tutor celular',
  `mod_rhb_tutor_relationship` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor relationship',
  `mod_rhb_tutor_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor address',
  `mod_rhb_tutor_intern_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor intern ids',
  `mod_rhb_tutor_coordinates` varchar(450) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb tutor coordinates',
  `mod_rhb_tutor_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rhb_tutor_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rehabilitation_tutor
-- ----------------------------
BEGIN;
INSERT INTO `mod_rehabilitation_tutor` VALUES (1, 'Hermany', 'Terrazas', 'Cossio', 1, '0', 4735799, 'SC', '591', 75313126, '', '', '', '', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rehabilitation_user
-- ----------------------------
CREATE TABLE `mod_rehabilitation_user` (
  `mod_rhb_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de rhb',
  `mod_rhb_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_rhb_lastname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod rhb lastname',
  `mod_rhb_acu_id` int DEFAULT NULL COMMENT 'ID de rhb acu',
  `mod_rhb_tepcyr` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Time from First Consumption to Rehabilitation',
  `mod_rhb_birthday` date DEFAULT NULL COMMENT 'Valor de mod rhb birthday',
  `mod_rhb_nationality` varchar(550) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod rhb nationality',
  `mod_rhb_age_first_use` int DEFAULT NULL COMMENT 'Valor de mod rhb age first use',
  `mod_rhb_register_date` date DEFAULT NULL COMMENT 'Fecha de registro',
  `mod_rhb_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `mod_rhb_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rhb_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rehabilitation_user
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_cob_contract_lots
-- ----------------------------
CREATE TABLE `mod_rems_cob_contract_lots` (
  `mod_rems_cob_cl_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de la relación contrato-lote',
  `mod_rems_cob_cl_contract_id` int NOT NULL DEFAULT '0' COMMENT 'ID del contrato (mod_rems_cob_contracts)',
  `mod_rems_cob_cl_lot_id` int NOT NULL DEFAULT '0' COMMENT 'ID del lote (mod_rems_lots)',
  `mod_rems_cob_cl_lot_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Precio negociado para este lote en el contrato',
  `mod_rems_cob_cl_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  PRIMARY KEY (`mod_rems_cob_cl_id`),
  UNIQUE KEY `uq_contract_lot` (`mod_rems_cob_cl_contract_id`,`mod_rems_cob_cl_lot_id`),
  KEY `idx_cl_lot` (`mod_rems_cob_cl_lot_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_cob_contract_lots
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_cob_contract_lots` VALUES (1, 1, 13, 45000.00, 1);
INSERT INTO `mod_rems_cob_contract_lots` VALUES (2, 2, 19, 32000.00, 1);
INSERT INTO `mod_rems_cob_contract_lots` VALUES (3, 3, 7, 28500.00, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_cob_contracts
-- ----------------------------
CREATE TABLE `mod_rems_cob_contracts` (
  `mod_rems_cob_con_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del contrato de cobranza',
  `mod_rems_cob_con_code` varchar(30) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código o número de contrato (ej: COL-2025-001)',
  `mod_rems_cob_con_contact_id` int NOT NULL DEFAULT '0' COMMENT 'ID del cliente (contacts)',
  `mod_rems_cob_con_project_id` int NOT NULL DEFAULT '0' COMMENT 'ID del proyecto (mod_rems_projects)',
  `mod_rems_cob_con_executive_id` int DEFAULT '0' COMMENT 'ID del ejecutivo/vendedor (users)',
  `mod_rems_cob_con_doc_id` int DEFAULT '0' COMMENT 'ID del documento escaneado (mod_rems_documents), 0=sin documento',
  `mod_rems_cob_con_condition` enum('cash','installments') COLLATE utf8mb4_general_ci DEFAULT 'installments' COMMENT 'Condición de pago: cash=contado pago único, installments=a plazo con cuotas',
  `mod_rems_cob_con_payment_condition_id` int DEFAULT NULL COMMENT 'ID condición de pago (mod_rems_payment_conditions)',
  `mod_rems_cob_con_currency` varchar(3) COLLATE utf8mb4_general_ci DEFAULT 'USD' COMMENT 'Moneda del contrato: USD, PYG, BOB, etc.',
  `mod_rems_cob_con_total_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Precio total de venta (suma de todos los lotes)',
  `mod_rems_cob_con_down_payment` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Anticipo/enganche inicial',
  `mod_rems_cob_con_financed_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Saldo a financiar = total_price - down_payment',
  `mod_rems_cob_con_term_months` int NOT NULL DEFAULT '0' COMMENT 'Número de cuotas mensuales (0 si es contado)',
  `mod_rems_cob_con_annual_rate` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT 'Tasa de interés anual en porcentaje (0 = sin interés)',
  `mod_rems_cob_con_annual_extras` json DEFAULT NULL COMMENT 'Pagos adicionales anuales: [{month:12,amount:1000.00}]',
  `mod_rems_cob_con_due_day` tinyint NOT NULL DEFAULT '1' COMMENT 'Día del mes en que vencen las cuotas (1-28)',
  `mod_rems_cob_con_contract_date` date DEFAULT NULL COMMENT 'Fecha de firma del contrato',
  `mod_rems_cob_con_start_date` date DEFAULT NULL COMMENT 'Fecha desde la que corre el plan de cuotas',
  `mod_rems_cob_con_status` enum('no_contract','active','overdue','cancelled','paid_off') COLLATE utf8mb4_general_ci DEFAULT 'no_contract' COMMENT 'Estado: no_contract=vendido sin documento, active=vigente, overdue=cuotas vencidas, cancelled=rescindido, paid_off=liquidado',
  `mod_rems_cob_con_notes` text COLLATE utf8mb4_general_ci COMMENT 'Notas internas del contrato',
  `mod_rems_cob_con_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_cob_con_created_by` int DEFAULT '0' COMMENT 'Usuario que creó el registro',
  `mod_rems_cob_con_updated_by` int DEFAULT '0' COMMENT 'Usuario que actualizó el registro',
  `mod_rems_cob_con_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_cob_con_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha de actualización',
  `mod_rems_cob_con_state` int DEFAULT '1' COMMENT 'Estado del registro: 1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_rems_cob_con_id`),
  KEY `idx_con_contact` (`mod_rems_cob_con_contact_id`),
  KEY `idx_con_project` (`mod_rems_cob_con_project_id`),
  KEY `idx_con_status` (`mod_rems_cob_con_status`),
  KEY `idx_con_ent` (`mod_rems_cob_con_ent_id`),
  KEY `idx_con_ent_status` (`mod_rems_cob_con_ent_id`,`mod_rems_cob_con_status`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_cob_contracts
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_cob_contracts` VALUES (1, 'COL-2025-001', 1, 1, 1, 0, 'installments', NULL, 'USD', 45000.00, 9000.00, 36000.00, 36, 0.00, NULL, 1, '2025-07-30', '2025-09-01', 'overdue', NULL, 1, 1, 0, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_contracts` VALUES (2, 'COL-2025-002', 2, 1, 1, 0, 'cash', NULL, 'USD', 32000.00, 32000.00, 0.00, 0, 0.00, NULL, 1, '2025-08-01', '2025-08-01', 'paid_off', NULL, 1, 1, 0, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_contracts` VALUES (3, 'COL-2025-003', 3, 1, 2, 0, 'installments', NULL, 'USD', 28500.00, 5000.00, 23500.00, 24, 0.00, NULL, 5, '2025-09-19', '2025-11-05', 'active', NULL, 1, 1, 0, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_cob_installments
-- ----------------------------
CREATE TABLE `mod_rems_cob_installments` (
  `mod_rems_cob_inst_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de la cuota',
  `mod_rems_cob_inst_contract_id` int NOT NULL DEFAULT '0' COMMENT 'ID del contrato (mod_rems_cob_contracts)',
  `mod_rems_cob_inst_number` int NOT NULL DEFAULT '0' COMMENT 'Número de cuota dentro del plan (1, 2, 3... / 0 para annual_extra)',
  `mod_rems_cob_inst_type` enum('regular','annual_extra') COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'regular' COMMENT 'Tipo: regular=cuota mensual, annual_extra=pago adicional anual',
  `mod_rems_cob_inst_due_date` date NOT NULL COMMENT 'Fecha de vencimiento de la cuota',
  `mod_rems_cob_inst_principal` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Porción de capital de la cuota',
  `mod_rems_cob_inst_interest` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Porción de interés de la cuota (0 si sin interés)',
  `mod_rems_cob_inst_total` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Monto total = principal + interest',
  `mod_rems_cob_inst_paid` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Monto acumulado pagado sobre esta cuota',
  `mod_rems_cob_inst_balance` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Saldo pendiente = total - paid',
  `mod_rems_cob_inst_paid_date` date DEFAULT NULL COMMENT 'Fecha en que quedó completamente saldada, NULL si pendiente',
  `mod_rems_cob_inst_overdue_days` int NOT NULL DEFAULT '0' COMMENT 'Días de mora acumulados al momento del pago',
  `mod_rems_cob_inst_status` enum('pending','partial','paid','overdue') COLLATE utf8mb4_general_ci DEFAULT 'pending' COMMENT 'Estado: pending=sin pagar, partial=pago incompleto, paid=saldada, overdue=fecha superada sin pagar',
  `mod_rems_cob_inst_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_cob_inst_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_cob_inst_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha de actualización',
  `mod_rems_cob_inst_state` int DEFAULT '1' COMMENT 'Estado del registro: 1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_rems_cob_inst_id`),
  KEY `idx_inst_contract` (`mod_rems_cob_inst_contract_id`),
  KEY `idx_inst_status` (`mod_rems_cob_inst_status`),
  KEY `idx_inst_due_date` (`mod_rems_cob_inst_due_date`),
  KEY `idx_inst_contract_status` (`mod_rems_cob_inst_contract_id`,`mod_rems_cob_inst_status`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_cob_installments
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_cob_installments` VALUES (1, 1, 1, 'regular', '2025-10-01', 1000.00, 0.00, 1000.00, 1000.00, 0.00, '2025-09-28', 0, 'paid', 1, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_installments` VALUES (2, 1, 2, 'regular', '2025-11-01', 1000.00, 0.00, 1000.00, 1000.00, 0.00, '2025-10-30', 0, 'paid', 1, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_installments` VALUES (3, 1, 3, 'regular', '2025-12-01', 1000.00, 0.00, 1000.00, 500.00, 500.00, NULL, 0, 'partial', 1, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_installments` VALUES (4, 1, 4, 'regular', '2026-01-01', 1000.00, 0.00, 1000.00, 0.00, 1000.00, NULL, 0, 'overdue', 1, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_installments` VALUES (5, 1, 5, 'regular', '2026-02-01', 1000.00, 0.00, 1000.00, 0.00, 1000.00, NULL, 0, 'overdue', 1, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_installments` VALUES (6, 1, 6, 'regular', '2026-03-01', 1000.00, 0.00, 1000.00, 0.00, 1000.00, NULL, 0, 'pending', 1, '2026-04-22 18:35:10', '2026-04-22 18:35:10', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_cob_ledger
-- ----------------------------
CREATE TABLE `mod_rems_cob_ledger` (
  `mod_rems_cob_led_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del movimiento',
  `mod_rems_cob_led_contract_id` int NOT NULL DEFAULT '0' COMMENT 'ID del contrato (mod_rems_cob_contracts)',
  `mod_rems_cob_led_type` enum('charge','credit','adjustment') COLLATE utf8mb4_general_ci DEFAULT 'charge' COMMENT 'Tipo: charge=cargo/deuda generada, credit=abono/pago recibido, adjustment=corrección manual',
  `mod_rems_cob_led_concept` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Descripción del movimiento (ej: Cuota 3/24, Enganche, Pago transferencia)',
  `mod_rems_cob_led_ref_type` enum('installment','payment','manual') COLLATE utf8mb4_general_ci DEFAULT 'installment' COMMENT 'Origen del movimiento: installment=cuota, payment=pago, manual=ajuste manual',
  `mod_rems_cob_led_ref_id` int NOT NULL DEFAULT '0' COMMENT 'ID de la cuota o pago que originó este movimiento',
  `mod_rems_cob_led_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Monto del movimiento (siempre positivo)',
  `mod_rems_cob_led_balance` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Saldo del contrato tras este movimiento (charge suma, credit resta)',
  `mod_rems_cob_led_date` date NOT NULL COMMENT 'Fecha del movimiento',
  `mod_rems_cob_led_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_cob_led_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_cob_led_state` int DEFAULT '1' COMMENT 'Estado del registro: 1=activo, 2=eliminado',
  PRIMARY KEY (`mod_rems_cob_led_id`),
  KEY `idx_led_contract` (`mod_rems_cob_led_contract_id`),
  KEY `idx_led_type` (`mod_rems_cob_led_type`),
  KEY `idx_led_date` (`mod_rems_cob_led_date`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_cob_ledger
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_cob_ledger` VALUES (1, 1, 'charge', 'Precio total del contrato', 'manual', 0, 45000.00, 45000.00, '2025-07-30', 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_ledger` VALUES (2, 1, 'credit', 'Enganche inicial', 'payment', 1, 9000.00, 36000.00, '2025-07-30', 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_ledger` VALUES (3, 1, 'credit', 'Cuota 1/36 — Oct 2025', 'payment', 2, 1000.00, 35000.00, '2025-09-28', 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_ledger` VALUES (4, 1, 'credit', 'Cuota 2/36 — Nov 2025', 'payment', 3, 1000.00, 34000.00, '2025-10-30', 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_ledger` VALUES (5, 1, 'credit', 'Abono parcial cuota 3/36', 'payment', 4, 500.00, 33500.00, '2025-11-25', 1, '2026-04-22 18:35:10', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_cob_payments
-- ----------------------------
CREATE TABLE `mod_rems_cob_payments` (
  `mod_rems_cob_pay_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del pago',
  `mod_rems_cob_pay_contract_id` int NOT NULL DEFAULT '0' COMMENT 'ID del contrato (mod_rems_cob_contracts)',
  `mod_rems_cob_pay_installment_id` int NOT NULL DEFAULT '0' COMMENT 'ID de la cuota aplicada (0=enganche o pago libre)',
  `mod_rems_cob_pay_type` enum('down_payment','installment','partial','adjustment','refund') COLLATE utf8mb4_general_ci DEFAULT 'installment' COMMENT 'Tipo: down_payment=enganche, installment=cuota mensual, partial=abono libre, adjustment=corrección, refund=devolución',
  `mod_rems_cob_pay_amount` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'Monto del pago',
  `mod_rems_cob_pay_date` date NOT NULL COMMENT 'Fecha en que se recibió el pago',
  `mod_rems_cob_pay_method` enum('cash','transfer','check','card','other') COLLATE utf8mb4_general_ci DEFAULT 'cash' COMMENT 'Método: cash=efectivo, transfer=transferencia, check=cheque, card=tarjeta, other=otro',
  `mod_rems_cob_pay_reference` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Número de referencia de transferencia, cheque, etc.',
  `mod_rems_cob_pay_notes` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Notas u observaciones del pago',
  `mod_rems_cob_pay_received_by` int DEFAULT '0' COMMENT 'ID del usuario que registró el cobro (users)',
  `mod_rems_cob_pay_receipt_id` int DEFAULT '0' COMMENT 'ID del comprobante adjunto (mod_rems_documents), 0=sin comprobante',
  `mod_rems_cob_pay_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_cob_pay_created_by` int DEFAULT '0' COMMENT 'Usuario que creó el registro',
  `mod_rems_cob_pay_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_cob_pay_state` int DEFAULT '1' COMMENT 'Estado del registro: 1=activo, 0=anulado, 2=eliminado',
  PRIMARY KEY (`mod_rems_cob_pay_id`),
  KEY `idx_pay_contract` (`mod_rems_cob_pay_contract_id`),
  KEY `idx_pay_installment` (`mod_rems_cob_pay_installment_id`),
  KEY `idx_pay_date` (`mod_rems_cob_pay_date`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_cob_payments
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_cob_payments` VALUES (1, 1, 0, 'down_payment', 9000.00, '2025-07-30', 'transfer', 'TRF-001-2025', NULL, 1, 0, 1, 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_payments` VALUES (2, 1, 1, 'installment', 1000.00, '2025-09-28', 'transfer', 'TRF-002-2025', NULL, 1, 0, 1, 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_payments` VALUES (3, 1, 2, 'installment', 1000.00, '2025-10-30', 'cash', NULL, NULL, 1, 0, 1, 1, '2026-04-22 18:35:10', 1);
INSERT INTO `mod_rems_cob_payments` VALUES (4, 1, 3, 'partial', 500.00, '2025-11-25', 'cash', NULL, NULL, 1, 0, 1, 1, '2026-04-22 18:35:10', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_doc_activity
-- ----------------------------
CREATE TABLE `mod_rems_doc_activity` (
  `mod_rems_doc_act_id` int NOT NULL AUTO_INCREMENT,
  `mod_rems_doc_act_doc_id` int NOT NULL DEFAULT '0',
  `mod_rems_doc_act_user_id` int NOT NULL DEFAULT '0',
  `mod_rems_doc_act_user_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `mod_rems_doc_act_action` enum('upload','view','edit','delete','share','download','comment') COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'view',
  `mod_rems_doc_act_notes` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `mod_rems_doc_act_ent_id` int NOT NULL DEFAULT '1',
  `mod_rems_doc_act_created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`mod_rems_doc_act_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_doc_activity
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_doc_categories
-- ----------------------------
CREATE TABLE `mod_rems_doc_categories` (
  `mod_rems_doc_cat_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único de la categoría',
  `mod_rems_doc_cat_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre de la categoría',
  `mod_rems_doc_cat_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción de la categoría',
  `mod_rems_doc_cat_icon` varchar(100) COLLATE utf8mb4_general_ci DEFAULT 'icon icon-document' COMMENT 'Clase de ícono CSS',
  `mod_rems_doc_cat_color` varchar(7) COLLATE utf8mb4_general_ci DEFAULT '#4b5267' COMMENT 'Color hex de la categoría',
  `mod_rems_doc_cat_order` int DEFAULT '0' COMMENT 'Orden de visualización',
  `mod_rems_doc_cat_state` tinyint DEFAULT '1' COMMENT '0=inactivo, 1=activo, 2=eliminado',
  `mod_rems_doc_cat_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de entidad (multi-tenant)',
  `mod_rems_doc_cat_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_doc_cat_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha de última actualización',
  PRIMARY KEY (`mod_rems_doc_cat_id`) USING BTREE,
  KEY `idx_doc_cat_ent_id` (`mod_rems_doc_cat_ent_id`),
  KEY `idx_doc_cat_state` (`mod_rems_doc_cat_state`),
  KEY `idx_doc_cat_order` (`mod_rems_doc_cat_order`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Categorías de tipos de documentos REMS';

-- ----------------------------
-- Records of mod_rems_doc_categories
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_doc_categories` VALUES (1, 'Comercial', 'Documentos de pre-venta y ventas', 'icon icon-store', '#3369e7', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_categories` VALUES (2, 'Legal', 'Contratos, escrituras y documentos notariales', 'icon icon-credential', '#8e43e7', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_categories` VALUES (3, 'Financiero', 'Facturas, recibos y planes de pago', 'icon icon-money', '#25c16f', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_categories` VALUES (4, 'Proyecto / Obra', 'Planos, permisos y documentos de construcción', 'icon icon-blocks', '#ff6b35', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_categories` VALUES (5, 'CRM / Postventa', 'Atención al cliente y entrega de unidades', 'icon icon-users', '#00aeff', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_categories` VALUES (6, 'Interno', 'Documentos internos del sistema y auditoría', 'icon icon-conf', '#4b5267', 6, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_categories` VALUES (7, 'Regulatorio', 'Certificados, permisos y cumplimiento legal', 'icon icon-check-ok', '#fe3535', 7, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_doc_config
-- ----------------------------
CREATE TABLE `mod_rems_doc_config` (
  `mod_rems_doc_cfg_id` int NOT NULL AUTO_INCREMENT,
  `mod_rems_doc_cfg_key` varchar(100) COLLATE utf8mb4_general_ci NOT NULL,
  `mod_rems_doc_cfg_value` text COLLATE utf8mb4_general_ci,
  `mod_rems_doc_cfg_label` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `mod_rems_doc_cfg_ent_id` int NOT NULL DEFAULT '1',
  `mod_rems_doc_cfg_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`mod_rems_doc_cfg_id`),
  UNIQUE KEY `uq_cfg` (`mod_rems_doc_cfg_key`,`mod_rems_doc_cfg_ent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_doc_config
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_doc_config` VALUES (1, 'storage_path', '/files/rems/documents/', 'Ruta base de almacenamiento', 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_config` VALUES (2, 'storage_max_mb', '50', 'Tamano maximo por archivo MB', 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_config` VALUES (3, 'allowed_ext', 'pdf,docx,doc,xlsx,xls,pptx,zip,rar,jpg,jpeg,png', 'Extensiones permitidas', 1, '2026-04-22 18:35:09');
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_doc_lots
-- ----------------------------
CREATE TABLE `mod_rems_doc_lots` (
  `mod_rems_dl_id` int NOT NULL AUTO_INCREMENT,
  `mod_rems_dl_doc_id` int NOT NULL DEFAULT '0',
  `mod_rems_dl_lot_id` int NOT NULL DEFAULT '0',
  `mod_rems_dl_ent_id` int NOT NULL DEFAULT '1',
  PRIMARY KEY (`mod_rems_dl_id`),
  UNIQUE KEY `uq_dl` (`mod_rems_dl_doc_id`,`mod_rems_dl_lot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_doc_lots
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_doc_types
-- ----------------------------
CREATE TABLE `mod_rems_doc_types` (
  `mod_rems_dt_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único del tipo de documento',
  `mod_rems_dt_cat_id` int NOT NULL COMMENT 'ID de categoría (FK → mod_rems_doc_categories)',
  `mod_rems_dt_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del tipo de documento',
  `mod_rems_dt_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción / uso del documento',
  `mod_rems_dt_code` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código corto (ej: CCV, LOI, FAC)',
  `mod_rems_dt_order` int DEFAULT '0' COMMENT 'Orden dentro de su categoría',
  `mod_rems_dt_state` tinyint DEFAULT '1' COMMENT '0=inactivo, 1=activo, 2=eliminado',
  `mod_rems_dt_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de entidad (multi-tenant)',
  `mod_rems_dt_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_dt_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha de última actualización',
  PRIMARY KEY (`mod_rems_dt_id`) USING BTREE,
  UNIQUE KEY `uq_dt_code_ent` (`mod_rems_dt_code`,`mod_rems_dt_ent_id`),
  KEY `idx_dt_cat_id` (`mod_rems_dt_cat_id`),
  KEY `idx_dt_ent_id` (`mod_rems_dt_ent_id`),
  KEY `idx_dt_state` (`mod_rems_dt_state`),
  KEY `idx_dt_order` (`mod_rems_dt_order`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Tipos de documentos REMS por categoría';

-- ----------------------------
-- Records of mod_rems_doc_types
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_doc_types` VALUES (1, 1, 'Reserva de unidad o lote', NULL, 'RSV', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (2, 1, 'Cotización / Propuesta comercial', NULL, 'COT', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (3, 1, 'Intención de compra (LOI)', NULL, 'LOI', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (4, 1, 'Seña o acuerdo de reserva', NULL, 'SEN', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (5, 1, 'Brochure / Ficha técnica de unidad', NULL, 'BRO', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (6, 1, 'Simulación de financiamiento', NULL, 'SIM', 6, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (7, 2, 'Contrato de compraventa', NULL, 'CCV', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (8, 2, 'Promesa de compra-venta', NULL, 'PCV', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (9, 2, 'Poder notarial', NULL, 'POD', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (10, 2, 'Escritura pública', NULL, 'ESC', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (11, 2, 'Addenda / Anexo contractual', NULL, 'ADD', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (12, 2, 'Acta de conformidad o entrega', NULL, 'ACT', 6, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (13, 3, 'Factura', NULL, 'FAC', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (14, 3, 'Recibo de pago', NULL, 'REC', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (15, 3, 'Plan de pago / Cronograma', NULL, 'PGO', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (16, 3, 'Estado de cuenta del cliente', NULL, 'EDC', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (17, 3, 'Nota de crédito / débito', NULL, 'NCD', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (18, 3, 'Comprobante de transferencia', NULL, 'TRF', 6, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (19, 4, 'Plano arquitectónico', NULL, 'PLA', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (20, 4, 'Plano estructural', NULL, 'PLE', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (21, 4, 'Memoria descriptiva', NULL, 'MEM', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (22, 4, 'Permiso de construcción', NULL, 'PER', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (23, 4, 'Licencia municipal', NULL, 'LIC', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (24, 4, 'Cronograma de obra (Gantt)', NULL, 'CRO', 6, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (25, 4, 'Orden de cambio (Change Order)', NULL, 'OCH', 7, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (26, 5, 'Ticket de soporte / Incidencia', NULL, 'TIC', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (27, 5, 'Acta de entrega de unidad', NULL, 'AEU', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (28, 5, 'Garantía', NULL, 'GAR', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (29, 5, 'Manual de uso del inmueble', NULL, 'MAN', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (30, 5, 'Encuesta de satisfacción', NULL, 'ENC', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (31, 6, 'Perfil de proyecto', NULL, 'PRF', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (32, 6, 'Historial de actividad / Auditoría', NULL, 'AUD', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (33, 6, 'Aprobación interna (Workflow)', NULL, 'APR', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (34, 6, 'Roles y permisos', NULL, 'RPM', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (35, 6, 'Bitácora de cambios', NULL, 'BIT', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (36, 7, 'Certificado de habitabilidad', NULL, 'HAB', 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (37, 7, 'Inspección técnica', NULL, 'INS', 2, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (38, 7, 'Registro catastral', NULL, 'CAT', 3, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (39, 7, 'Cumplimiento ambiental', NULL, 'AMB', 4, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_doc_types` VALUES (40, 7, 'Declaración fiscal del proyecto', NULL, 'DFP', 5, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_documents
-- ----------------------------
CREATE TABLE `mod_rems_documents` (
  `mod_rems_doc_id` int NOT NULL AUTO_INCREMENT,
  `mod_rems_doc_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
  `mod_rems_doc_code` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `mod_rems_doc_type_id` int NOT NULL DEFAULT '0',
  `mod_rems_doc_project_id` int DEFAULT '0',
  `mod_rems_doc_lot_id` int DEFAULT '0',
  `mod_rems_doc_contact_id` int DEFAULT '0',
  `mod_rems_doc_unit_id` int DEFAULT '0',
  `mod_rems_doc_incident_id` int DEFAULT '0',
  `mod_rems_doc_transfer_id` int DEFAULT '0',
  `mod_rems_doc_upload_date` date DEFAULT NULL,
  `mod_rems_doc_version` smallint unsigned NOT NULL DEFAULT '1',
  `mod_rems_doc_file_id` int DEFAULT NULL,
  `mod_rems_doc_file_path` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `mod_rems_doc_file_size` bigint DEFAULT '0',
  `mod_rems_doc_file_ext` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `mod_rems_doc_status` varchar(20) COLLATE utf8mb4_general_ci DEFAULT 'borrador' COMMENT 'borrador | revision | finalizado',
  `mod_rems_doc_shared` tinyint DEFAULT '0' COMMENT '0=privado, 1=compartido',
  `mod_rems_doc_state` tinyint DEFAULT '1' COMMENT '0=inactivo, 1=activo, 2=eliminado',
  `mod_rems_doc_ent_id` int NOT NULL DEFAULT '1',
  `mod_rems_doc_created_by` int DEFAULT '0',
  `mod_rems_doc_updated_by` int DEFAULT '0',
  `mod_rems_doc_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `mod_rems_doc_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`mod_rems_doc_id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_documents
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_documents` VALUES (1, 'Contrato_Compraventa_Lote01', NULL, 7, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 524288, 'pdf', 'finalizado', 1, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (2, 'Propuesta_Comercial_Nexus', NULL, 2, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 131072, 'docx', 'borrador', 1, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (3, 'Factura_Agosto_2024', NULL, 13, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 204800, 'pdf', 'finalizado', 1, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (4, 'Plano_Arquitectonico_Bloque_A', NULL, 19, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 2097152, 'pdf', 'revision', 0, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (5, 'Minuta_Reunion_Ejecutiva', NULL, 2, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 98304, 'pdf', 'revision', 1, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (6, 'Politica_Privacidad_Final', NULL, 33, 0, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 163840, 'pdf', 'finalizado', 0, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (7, 'Presupuesto_Anual_2025', NULL, 15, 0, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 458752, 'xlsx', 'borrador', 1, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (8, 'Brand_Guidelines_V2', NULL, 36, 0, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 5242880, 'zip', 'finalizado', 1, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (9, 'Acta_Entrega_Unidad_B205', NULL, 27, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 245760, 'pdf', 'finalizado', 0, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
INSERT INTO `mod_rems_documents` VALUES (10, 'Permiso_Construccion_2024', NULL, 22, 1, 0, 0, 0, 0, 0, NULL, 1, NULL, NULL, 307200, 'pdf', 'finalizado', 0, 1, 1, 1, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09');
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_lots
-- ----------------------------
CREATE TABLE `mod_rems_lots` (
  `mod_rems_lots_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del lote',
  `mod_rems_lots_project_id` int DEFAULT NULL COMMENT 'FK a mod_rems_projects',
  `mod_rems_lots_phase_id` int DEFAULT NULL COMMENT 'FK a mod_rems_phases, NULL si no aplica',
  `mod_rems_lots_block` varchar(10) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Manzana o bloque, ej: M05',
  `mod_rems_lots_number` int NOT NULL COMMENT 'Número de lote en la manzana',
  `mod_rems_lots_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre descriptivo del lote',
  `mod_rems_lots_area_m2` decimal(10,2) NOT NULL COMMENT 'Superficie en m²',
  `mod_rems_lots_status` varchar(50) COLLATE utf8mb4_general_ci DEFAULT 'disponible' COMMENT 'Estado comercial: disponible, reservado, en_negociacion, promesa_compra, vendido, en_construccion, entregado, no_disponible',
  `mod_rems_lots_available` int DEFAULT '1' COMMENT '1=disponible, 5=vendido (legado)',
  `mod_rems_lots_coordinates` varchar(455) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Coordenadas SVG del lote en el plano',
  `mod_rems_lots_details` varchar(455) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'HTML de tooltip para plano interactivo',
  `mod_rems_lots_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_lots_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_lots_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Última actualización',
  `mod_rems_lots_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_rems_lots_id`),
  KEY `idx_lots_ent` (`mod_rems_lots_ent_id`),
  KEY `idx_lots_project` (`mod_rems_lots_project_id`),
  KEY `idx_lots_phase` (`mod_rems_lots_phase_id`),
  KEY `idx_lots_status` (`mod_rems_lots_status`),
  KEY `idx_lots_block` (`mod_rems_lots_block`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_lots
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_lots` VALUES (1, 1, NULL, '16', 1, 'Lote 1-MZ5', 200.00, 'disponible', 1, NULL, NULL, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_payment_conditions
-- ----------------------------
CREATE TABLE `mod_rems_payment_conditions` (
  `mod_rems_pc_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mod_rems_pc_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre visible',
  `mod_rems_pc_code` varchar(30) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Código interno',
  `mod_rems_pc_requires_schedule` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1 = genera plan de cuotas',
  `mod_rems_pc_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción',
  `mod_rems_pc_order` int NOT NULL DEFAULT '0' COMMENT 'Orden en formulario',
  `mod_rems_pc_ent_id` int DEFAULT NULL COMMENT 'NULL=global',
  `mod_rems_pc_state` tinyint NOT NULL DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  `mod_rems_pc_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`mod_rems_pc_id`),
  KEY `idx_pc_ent` (`mod_rems_pc_ent_id`),
  KEY `idx_pc_code` (`mod_rems_pc_code`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_payment_conditions
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_payment_conditions` VALUES (1, 'Contado', 'cash', 0, 'Pago total en una sola cuota al momento de la firma.', 1, NULL, 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_payment_conditions` VALUES (2, 'Financiado', 'installments', 1, 'Pago con enganche y cuotas mensuales con tasa de interés.', 2, NULL, 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_payment_conditions` VALUES (3, 'Financiado sin interés', 'zero_interest', 1, 'Cuotas mensuales sin cargo de interés (plan propio).', 3, NULL, 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_payment_conditions` VALUES (4, 'Enganche + contado', 'down_cash', 0, 'Enganche inicial y saldo restante en un pago al entregar el lote.', 4, NULL, 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_payment_conditions` VALUES (5, 'Permuta', 'exchange', 0, 'El cliente entrega un bien como parte del pago.', 5, NULL, 1, '2026-04-22 18:35:09');
INSERT INTO `mod_rems_payment_conditions` VALUES (6, 'Crédito bancario', 'bank_credit', 0, 'El cliente financia con entidad bancaria externa.', 6, NULL, 1, '2026-04-22 18:35:09');
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_phases
-- ----------------------------
CREATE TABLE `mod_rems_phases` (
  `mod_rems_phases_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de la fase',
  `mod_rems_phases_project_id` int NOT NULL COMMENT 'FK a mod_rems_projects',
  `mod_rems_phases_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre de la fase',
  `mod_rems_phases_type` enum('subdivision','urbanization','construction','delivery') COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Tipo de fase',
  `mod_rems_phases_class` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Clase CSS para visualización en plano',
  `mod_rems_phases_color` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Color hex para identificar en plano',
  `mod_rems_phases_start_date` date DEFAULT NULL COMMENT 'Inicio de la fase',
  `mod_rems_phases_end_date` date DEFAULT NULL COMMENT 'Fin estimado de la fase',
  `mod_rems_phases_status` enum('not_started','in_progress','completed','delayed') COLLATE utf8mb4_general_ci DEFAULT 'not_started' COMMENT 'Estado de la fase',
  `mod_rems_phases_budget` decimal(15,2) DEFAULT '0.00' COMMENT 'Presupuesto asignado',
  `mod_rems_phases_notes` text COLLATE utf8mb4_general_ci COMMENT 'Notas internas',
  `mod_rems_phases_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_phases_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_phases_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Última actualización',
  `mod_rems_phases_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_rems_phases_id`),
  KEY `idx_phases_ent` (`mod_rems_phases_ent_id`),
  KEY `idx_phases_project` (`mod_rems_phases_project_id`),
  KEY `idx_phases_status` (`mod_rems_phases_status`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_phases
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_phases` VALUES (1, 1, 'fase 1', 'subdivision', NULL, NULL, NULL, NULL, 'not_started', 0.00, NULL, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09', 1);
INSERT INTO `mod_rems_phases` VALUES (2, 1, 'fase 2', 'subdivision', NULL, NULL, NULL, NULL, 'not_started', 0.00, NULL, 1, '2026-04-22 18:35:09', '2026-04-22 18:35:09', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_projects
-- ----------------------------
CREATE TABLE `mod_rems_projects` (
  `mod_rems_projects_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del proyecto',
  `mod_rems_projects_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre completo del proyecto',
  `mod_rems_projects_country_code` varchar(3) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código ISO país: PY, BO, AR, etc.',
  `mod_rems_projects_abbrev` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Abreviatura para código de contrato, ej: CL',
  `mod_rems_projects_location` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ubicación o dirección',
  `mod_rems_projects_description` text COLLATE utf8mb4_general_ci COMMENT 'Descripción general',
  `mod_rems_projects_start_date` date DEFAULT NULL COMMENT 'Fecha de inicio',
  `mod_rems_projects_end_date` date DEFAULT NULL COMMENT 'Fecha de entrega estimada',
  `mod_rems_projects_status` enum('planning','in_progress','on_hold','completed','cancelled') COLLATE utf8mb4_general_ci DEFAULT 'planning' COMMENT 'Estado del proyecto',
  `mod_rems_projects_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_projects_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_rems_projects_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Última actualización',
  `mod_rems_projects_state` int DEFAULT '1' COMMENT '1=activo, 0=inactivo, 2=eliminado',
  PRIMARY KEY (`mod_rems_projects_id`),
  KEY `idx_projects_ent` (`mod_rems_projects_ent_id`),
  KEY `idx_projects_status` (`mod_rems_projects_status`),
  KEY `idx_projects_state` (`mod_rems_projects_state`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_projects
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_projects` VALUES (1, 'Colinas del Lago', 'PY', 'CL', NULL, NULL, NULL, NULL, 'planning', 1, '2026-04-22 18:35:08', '2026-04-22 18:35:08', 1);
INSERT INTO `mod_rems_projects` VALUES (2, 'prueba 2', NULL, NULL, 'av siempre viva', 'descripción', '2026-04-08', '2026-04-24', 'planning', 1, '2026-04-22 18:35:08', '2026-04-22 18:35:50', 2);
COMMIT;

-- ----------------------------
-- Table structure for mod_rems_settings
-- ----------------------------
CREATE TABLE `mod_rems_settings` (
  `mod_rems_set_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID del registro',
  `mod_rems_set_key` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Clave de configuración',
  `mod_rems_set_value` text COLLATE utf8mb4_general_ci COMMENT 'Valor: texto plano o JSON',
  `mod_rems_set_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad (multi-tenant)',
  `mod_rems_set_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Última actualización',
  `mod_rems_set_updated_by` int DEFAULT NULL COMMENT 'Usuario que actualizó',
  PRIMARY KEY (`mod_rems_set_id`),
  UNIQUE KEY `uq_rems_set` (`mod_rems_set_key`,`mod_rems_set_ent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rems_settings
-- ----------------------------
BEGIN;
INSERT INTO `mod_rems_settings` VALUES (1, 'executive_roles', '[]', 1, '2026-04-22 18:35:09', NULL);
INSERT INTO `mod_rems_settings` VALUES (2, 'contract_code_prefix', 'CT', 1, '2026-04-22 18:35:09', NULL);
INSERT INTO `mod_rems_settings` VALUES (3, 'client_code_prefix', 'CL', 1, '2026-04-22 18:35:09', NULL);
INSERT INTO `mod_rems_settings` VALUES (4, 'contract_seq_digits', '5', 1, '2026-04-22 18:35:09', NULL);
COMMIT;

-- ----------------------------
-- Table structure for mod_rewards
-- ----------------------------
CREATE TABLE `mod_rewards` (
  `mod_rwd_id` int NOT NULL COMMENT 'ID de rwd',
  `mod_rwd_cpa_id` int NOT NULL COMMENT 'ID de rwd cpa',
  `mod_rwd_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_rwd_img` int DEFAULT NULL COMMENT 'Valor de mod rwd img',
  `mod_rwd_description` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `mod_rwd_code` varchar(21) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código interno',
  `mod_rwd_value` int NOT NULL DEFAULT '0' COMMENT 'Valor de mod rwd value',
  `mod_rwd_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Datos adicionales en formato JSON',
  `mod_rwd_register_date` datetime NOT NULL COMMENT 'Fecha de registro',
  `mod_rwd_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `mod_rwd_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rwd_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rewards
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rewards_register
-- ----------------------------
CREATE TABLE `mod_rewards_register` (
  `mod_rwd_reg_rwd_id` int NOT NULL COMMENT 'ID de rwd reg rwd',
  `mod_rwd_reg_acu_id` int NOT NULL COMMENT 'ID de rwd reg acu',
  `mod_rwd_reg_cpa_id` int NOT NULL COMMENT 'ID de rwd reg cpa',
  `mod_rwd_reg_register_date` datetime NOT NULL COMMENT 'Fecha de registro',
  `mod_rwd_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_rwd_reg_rwd_id`,`mod_rwd_reg_acu_id`,`mod_rwd_reg_cpa_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_rewards_register
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_addresses
-- ----------------------------
CREATE TABLE `mod_rrhh_addresses` (
  `mod_addr_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único de la dirección',
  `mod_addr_employee_id` int NOT NULL COMMENT 'ID del empleado',
  `mod_addr_description` varchar(255) DEFAULT NULL COMMENT 'Descripción o referencia de la dirección',
  `mod_addr_type` varchar(20) DEFAULT 'permanent' COMMENT 'Tipo de dirección (permanent, temporary, etc.)',
  `mod_addr_street` varchar(255) DEFAULT NULL COMMENT 'Calle y numeración de la dirección',
  `mod_addr_city` varchar(120) DEFAULT NULL COMMENT 'Ciudad de la dirección',
  `mod_addr_state_region` varchar(120) DEFAULT NULL COMMENT 'Departamento/estado/provincia',
  `mod_addr_country` varchar(80) DEFAULT NULL COMMENT 'País de la dirección',
  `mod_addr_zip` varchar(20) DEFAULT NULL COMMENT 'Código postal',
  `mod_addr_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  `mod_addr_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_addr_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh addresses';

-- ----------------------------
-- Records of mod_rrhh_addresses
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_addresses` VALUES (1, 4, NULL, 'permanent', '226 Heather St', 'Cranston', 'RI', 'Estados Unidos', '02920-7267', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_attendance
-- ----------------------------
CREATE TABLE `mod_rrhh_attendance` (
  `mod_att_id` int NOT NULL AUTO_INCREMENT,
  `mod_att_employee_id` int NOT NULL COMMENT 'ID del empleado',
  `mod_att_description` varchar(255) DEFAULT NULL COMMENT 'Descripción breve del registro',
  `mod_att_date` date DEFAULT NULL COMMENT 'Fecha del registro de asistencia',
  `mod_att_clock_in` time DEFAULT NULL COMMENT 'Hora de entrada',
  `mod_att_clock_out` time DEFAULT NULL COMMENT 'Hora de salida',
  `mod_att_type` varchar(20) DEFAULT 'normal' COMMENT 'Tipo de asistencia (normal, permiso, falta, etc.)',
  `mod_att_notes` varchar(255) DEFAULT NULL COMMENT 'Observaciones del registro de asistencia',
  `mod_att_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_att_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh attendance';

-- ----------------------------
-- Records of mod_rrhh_attendance
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_attendance` VALUES (1, 1, 'Asistencia regular', '2026-04-13', '08:52:00', '17:05:00', 'normal', NULL, 1);
INSERT INTO `mod_rrhh_attendance` VALUES (2, 2, 'Asistencia regular', '2026-04-13', '09:15:00', '17:33:00', 'normal', NULL, 1);
INSERT INTO `mod_rrhh_attendance` VALUES (3, 3, 'Registro con permiso', '2026-04-13', NULL, NULL, 'permiso', 'Licencia médica', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_baja
-- ----------------------------
CREATE TABLE `mod_rrhh_baja` (
  `mod_baja_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único del proceso de baja',
  `mod_baja_employee_id` int NOT NULL COMMENT 'ID del empleado en proceso de baja',
  `mod_baja_description` varchar(255) DEFAULT NULL COMMENT 'Descripción general del proceso de baja',
  `mod_baja_date` date DEFAULT NULL COMMENT 'Fecha efectiva de la baja',
  `mod_baja_reason` varchar(255) DEFAULT NULL COMMENT 'Motivo de la baja',
  `mod_baja_type` varchar(40) DEFAULT 'voluntary' COMMENT 'Tipo de baja (voluntary, dismissal, etc.)',
  `mod_baja_liquidation_amount` decimal(12,2) DEFAULT '0.00' COMMENT 'Monto de liquidación calculado',
  `mod_baja_step_attendance` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Paso asistencia completado (0=No, 1=Sí)',
  `mod_baja_step_calculations` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Paso cálculos completado (0=No, 1=Sí)',
  `mod_baja_step_liquidation` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Paso liquidación completado (0=No, 1=Sí)',
  `mod_baja_step_access` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Paso cierre de accesos completado (0=No, 1=Sí)',
  `mod_baja_completed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Proceso de baja finalizado (0=No, 1=Sí)',
  `mod_baja_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  `mod_baja_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_baja_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh employee discharge';

-- ----------------------------
-- Records of mod_rrhh_baja
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_bank_details
-- ----------------------------
CREATE TABLE `mod_rrhh_bank_details` (
  `mod_bank_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único del dato bancario',
  `mod_bank_employee_id` int NOT NULL COMMENT 'ID del empleado',
  `mod_bank_description` varchar(255) DEFAULT NULL COMMENT 'Descripción o referencia bancaria',
  `mod_bank_bank_name` varchar(120) DEFAULT NULL COMMENT 'Nombre del banco',
  `mod_bank_account_number` varchar(80) DEFAULT NULL COMMENT 'Número de cuenta bancaria',
  `mod_bank_account_type` varchar(40) DEFAULT 'corriente' COMMENT 'Tipo de cuenta (corriente, ahorro, etc.)',
  `mod_bank_currency` varchar(10) DEFAULT 'USD' COMMENT 'Moneda de la cuenta bancaria',
  `mod_bank_is_main` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Indica si es la cuenta principal (0=No, 1=Sí)',
  `mod_bank_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  `mod_bank_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_bank_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh bank details';

-- ----------------------------
-- Records of mod_rrhh_bank_details
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_bank_details` VALUES (1, 4, NULL, 'Baneco', '34234234', 'ahorro', 'USD', 1, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_contracts
-- ----------------------------
CREATE TABLE `mod_rrhh_contracts` (
  `mod_contract_id` int NOT NULL AUTO_INCREMENT,
  `mod_contract_employee_id` int NOT NULL COMMENT 'ID del empleado asociado al contrato',
  `mod_contract_description` varchar(255) DEFAULT NULL COMMENT 'Descripción o nota del contrato',
  `mod_contract_type` varchar(20) DEFAULT 'indefinido' COMMENT 'Tipo de contrato (indefinido, temporal, etc.)',
  `mod_contract_base_salary` decimal(12,2) DEFAULT NULL COMMENT 'Salario base acordado en el contrato',
  `mod_contract_start_date` date DEFAULT NULL COMMENT 'Fecha de inicio del contrato',
  `mod_contract_end_date` date DEFAULT NULL COMMENT 'Fecha de finalización del contrato',
  `mod_contract_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del contrato (0=Inactivo, 1=Activo)',
  `mod_contract_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  PRIMARY KEY (`mod_contract_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh contracts';

-- ----------------------------
-- Records of mod_rrhh_contracts
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_contracts` VALUES (1, 1, 'Contrato vigente', 'indefinido', 4200.00, '2024-02-15', NULL, 1, 1);
INSERT INTO `mod_rrhh_contracts` VALUES (2, 2, 'Contrato vigente', 'indefinido', 3800.00, '2023-11-09', NULL, 1, 1);
INSERT INTO `mod_rrhh_contracts` VALUES (3, 3, 'Contrato temporal', 'temporal', 3200.00, '2024-01-20', '2024-12-31', 1, 1);
INSERT INTO `mod_rrhh_contracts` VALUES (4, 4, NULL, 'indefinido', 10010.10, '2026-04-24', NULL, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_departments
-- ----------------------------
CREATE TABLE `mod_rrhh_departments` (
  `mod_dep_id` int NOT NULL AUTO_INCREMENT,
  `mod_dep_name` varchar(120) DEFAULT NULL COMMENT 'Nombre del departamento',
  `mod_dep_description` varchar(255) DEFAULT NULL COMMENT 'Descripción del departamento',
  `mod_dep_parent_id` int NOT NULL DEFAULT '0' COMMENT 'ID del departamento padre (0=sin padre)',
  `mod_dep_manager_id` int DEFAULT NULL COMMENT 'ID del empleado responsable del departamento',
  `mod_dep_order` int NOT NULL DEFAULT '0' COMMENT 'Orden de visualización del departamento',
  `mod_dep_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  `mod_dep_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_dep_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh departments';

-- ----------------------------
-- Records of mod_rrhh_departments
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_departments` VALUES (1, 'Dirección General', 'Dirección general de la organización', 0, NULL, 4, 1, 1);
INSERT INTO `mod_rrhh_departments` VALUES (2, 'Administración', 'Gestión administrativa y financiera', 1, NULL, 2, 1, 1);
INSERT INTO `mod_rrhh_departments` VALUES (3, 'Operaciones', 'Gestión operativa y producción', 1, NULL, 1, 1, 1);
INSERT INTO `mod_rrhh_departments` VALUES (4, 'Ingenieria', 'prueba', 1, NULL, 3, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_employees
-- ----------------------------
CREATE TABLE `mod_rrhh_employees` (
  `mod_emp_id` int NOT NULL AUTO_INCREMENT,
  `mod_emp_fullname` varchar(255) DEFAULT NULL COMMENT 'Nombre completo del empleado',
  `mod_emp_description` varchar(255) DEFAULT NULL COMMENT 'Descripción o nota general del empleado',
  `mod_emp_ci` varchar(45) NOT NULL COMMENT 'Documento de identidad del empleado',
  `mod_emp_email` varchar(140) DEFAULT NULL COMMENT 'Correo electrónico del empleado',
  `mod_emp_gender` varchar(10) DEFAULT NULL COMMENT 'Género del empleado',
  `mod_emp_birth_date` date DEFAULT NULL COMMENT 'Fecha de nacimiento del empleado',
  `mod_emp_marital_status` varchar(20) DEFAULT NULL COMMENT 'Estado civil del empleado',
  `mod_emp_nationality` varchar(80) DEFAULT NULL COMMENT 'Nacionalidad del empleado',
  `mod_emp_phone` varchar(45) DEFAULT NULL COMMENT 'Teléfono de contacto del empleado',
  `mod_emp_jobtitle_id` int NOT NULL COMMENT 'ID del cargo asignado al empleado',
  `mod_emp_department_id` int NOT NULL COMMENT 'ID del departamento asignado al empleado',
  `mod_emp_entry_date` date DEFAULT NULL COMMENT 'Fecha de ingreso del empleado',
  `mod_emp_entry_reason` varchar(80) DEFAULT NULL COMMENT 'Motivo o tipo de ingreso del empleado',
  `mod_emp_position_type` varchar(40) DEFAULT 'full-time' COMMENT 'Tipo de puesto (ej: full-time, part-time)',
  `mod_emp_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del empleado (0=Inactivo, 1=Activo)',
  `mod_emp_blocked` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Bloqueo operativo del empleado (0=No, 1=Sí)',
  `mod_emp_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  PRIMARY KEY (`mod_emp_id`) USING BTREE,
  UNIQUE KEY `mod_emp_ci` (`mod_emp_ci`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh employees';

-- ----------------------------
-- Records of mod_rrhh_employees
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_employees` VALUES (1, 'Ana Gómez', 'Empleado activo del área administrativa', '12345678', 'ana.gomez@demo.com', NULL, NULL, NULL, NULL, '555-0101', 2, 2, '2024-02-15', NULL, 'full-time', 1, 0, 1);
INSERT INTO `mod_rrhh_employees` VALUES (2, 'Carlos Pérez', 'Empleado activo del área operativa', '87654321', 'carlos.perez@demo.com', NULL, NULL, NULL, NULL, '555-0202', 4, 3, '2023-11-09', NULL, 'full-time', 1, 0, 1);
INSERT INTO `mod_rrhh_employees` VALUES (3, 'María López', 'Empleado activo de planta', '11223344', 'maria.lopez@demo.com', NULL, NULL, NULL, NULL, '555-0303', 5, 3, '2024-01-20', NULL, 'full-time', 1, 0, 1);
INSERT INTO `mod_rrhh_employees` VALUES (4, 'Miguel Angel Montero Duran', NULL, '234345', 'hterrazas@gmail.com', 'M', '2026-04-26', 'casado', 'Boliviano', '9546811596', 1, 3, '2026-04-30', 'new_hire', 'full-time', 1, 0, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_jobtitles
-- ----------------------------
CREATE TABLE `mod_rrhh_jobtitles` (
  `mod_jbt_id` int NOT NULL AUTO_INCREMENT,
  `mod_jbt_title` varchar(140) DEFAULT NULL COMMENT 'Título o nombre del cargo',
  `mod_jbt_description` varchar(255) DEFAULT NULL COMMENT 'Descripción del cargo',
  `mod_jbt_parent_id` int NOT NULL DEFAULT '0' COMMENT 'ID del cargo superior (0=sin superior)',
  `mod_jbt_level` int NOT NULL DEFAULT '0' COMMENT 'Nivel jerárquico del cargo',
  `mod_jbt_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  `mod_jbt_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_jbt_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh job titles';

-- ----------------------------
-- Records of mod_rrhh_jobtitles
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_jobtitles` VALUES (1, 'Director General', 'Responsable máximo del área', 0, 0, 1, 1);
INSERT INTO `mod_rrhh_jobtitles` VALUES (2, 'Gerente Administrativo', 'Responsable del área administrativa', 1, 1, 1, 1);
INSERT INTO `mod_rrhh_jobtitles` VALUES (3, 'Analista de Nómina', 'Responsable de nómina y pagos', 2, 2, 1, 1);
INSERT INTO `mod_rrhh_jobtitles` VALUES (4, 'Jefe de Operaciones', 'Responsable de operaciones', 1, 1, 1, 1);
INSERT INTO `mod_rrhh_jobtitles` VALUES (5, 'Operador de Planta', 'Operación diaria de planta', 4, 2, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_rrhh_working_time
-- ----------------------------
CREATE TABLE `mod_rrhh_working_time` (
  `mod_wt_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único de la jornada laboral',
  `mod_wt_employee_id` int NOT NULL COMMENT 'ID del empleado',
  `mod_wt_description` varchar(255) DEFAULT NULL COMMENT 'Descripción de la jornada laboral',
  `mod_wt_schedule_type` varchar(40) DEFAULT 'standard' COMMENT 'Tipo de horario (standard, rotativo, etc.)',
  `mod_wt_hours_per_week` decimal(5,2) DEFAULT '40.00' COMMENT 'Horas planificadas por semana',
  `mod_wt_work_days` varchar(80) DEFAULT 'L,M,X,J,V' COMMENT 'Días laborales definidos',
  `mod_wt_start_time` time DEFAULT '08:00:00' COMMENT 'Hora de inicio de jornada',
  `mod_wt_end_time` time DEFAULT '17:00:00' COMMENT 'Hora de fin de jornada',
  `mod_wt_ent_id` int NOT NULL DEFAULT '1' COMMENT 'ID de la entidad/empresa',
  `mod_wt_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro (0=Inactivo, 1=Activo)',
  PRIMARY KEY (`mod_wt_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='rrhh working time';

-- ----------------------------
-- Records of mod_rrhh_working_time
-- ----------------------------
BEGIN;
INSERT INTO `mod_rrhh_working_time` VALUES (1, 4, NULL, 'standard', 40.00, 'L,M,X,J,V', '08:00:00', '17:00:00', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_services
-- ----------------------------
CREATE TABLE `mod_services` (
  `mod_srv_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de srv',
  `mod_srv_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_srv_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Descripción del registro',
  `mod_srv_active` int NOT NULL COMMENT 'Valor de mod srv active',
  `mod_srv_duration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod srv duration',
  `mod_srv_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Tipo de registro',
  `mod_srv_price` decimal(10,2) NOT NULL COMMENT 'Valor de mod srv price',
  `mod_srv_created` datetime NOT NULL COMMENT 'Valor de mod srv created',
  `mod_srv_modified` datetime NOT NULL COMMENT 'Valor de mod srv modified',
  `mod_srv_deleted` datetime DEFAULT NULL COMMENT 'Valor de mod srv deleted',
  `mod_srv_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_srv_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_srv_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_services
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_services_roles
-- ----------------------------
CREATE TABLE `mod_services_roles` (
  `mod_srv_id` int NOT NULL COMMENT 'ID de srv',
  `mod_srv_rol_id` int NOT NULL COMMENT 'ID de srv rol',
  `mod_srv_rol_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_srv_rol_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_srv_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_services_roles
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_sliders
-- ----------------------------
CREATE TABLE `mod_sliders` (
  `mod_sli_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de sli',
  `mod_sli_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_sli_description` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Descripción del registro',
  `mod_sli_cls` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod sli cls',
  `mod_sli_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_sli_date` datetime DEFAULT NULL COMMENT 'Fecha del registro',
  `mod_sli_date_register` datetime DEFAULT NULL COMMENT 'Valor de mod sli date register',
  `mod_sli_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `mod_sli_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_sli_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_sli_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sliders
-- ----------------------------
BEGIN;
INSERT INTO `mod_sliders` VALUES (1, 'titulo 1', '', '', '', '2025-11-30 16:51:00', '2025-11-30 15:51:17', 1, 1, 1);
INSERT INTO `mod_sliders` VALUES (2, 'prueba 2', '', '', '', '2025-11-30 16:53:00', '2025-11-30 15:53:34', 1, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_sliders_categorys
-- ----------------------------
CREATE TABLE `mod_sliders_categorys` (
  `mod_sli_cat_sli_id` int NOT NULL COMMENT 'ID de sli cat sli',
  `mod_sli_cat_cat_id` int NOT NULL COMMENT 'ID de sli cat cat',
  `mod_sli_cat_order` int NOT NULL DEFAULT '0' COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_sli_cat_sli_id`,`mod_sli_cat_cat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sliders_categorys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_sliders_files
-- ----------------------------
CREATE TABLE `mod_sliders_files` (
  `mod_sli_file_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de sli file',
  `mod_sli_file_sli_id` int NOT NULL COMMENT 'ID de sli file sli',
  `mod_sli_file_file_id` int NOT NULL COMMENT 'ID de sli file file',
  `mod_sli_file_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod sli file title',
  `mod_sli_file_btn_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod sli file btn title',
  `mod_sli_file_link` varchar(445) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod sli file link',
  `mod_sli_file_target` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '_self' COMMENT 'Valor de mod sli file target',
  `mod_sli_file_description` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `mod_sli_file_order` int DEFAULT '0' COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_sli_file_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sliders_files
-- ----------------------------
BEGIN;
INSERT INTO `mod_sliders_files` VALUES (7, 2, 1, 'titulo 1', '', '', '_self', '', 0);
INSERT INTO `mod_sliders_files` VALUES (8, 2, 3, 'titulo 2', '', '', '_self', '', 1);
INSERT INTO `mod_sliders_files` VALUES (9, 1, 0, 'prueba 1', '', '', '_self', '', 0);
COMMIT;

-- ----------------------------
-- Table structure for mod_sports
-- ----------------------------
CREATE TABLE `mod_sports` (
  `mod_spt_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de spt',
  `mod_spt_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_sp_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta del recurso',
  `mod_spt_description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `mod_spt_img` int DEFAULT NULL COMMENT 'Valor de mod spt img',
  `mod_spt_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_spt_state` int DEFAULT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_spt_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sports
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_sports_dates
-- ----------------------------
CREATE TABLE `mod_sports_dates` (
  `mod_sp_dt_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de sp dt',
  `mod_sp_dt_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_sp_dt_date` date DEFAULT NULL COMMENT 'Fecha del registro',
  `mod_sp_dt_comp_id` int DEFAULT NULL COMMENT 'competition',
  `mod_sp_dt_div_id` int DEFAULT NULL COMMENT 'ID de sp dt div',
  `mod_sp_dt_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_sp_dt_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_sp_dt_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sports_dates
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_sports_games
-- ----------------------------
CREATE TABLE `mod_sports_games` (
  `mod_sp_gm_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de sp gm',
  `mod_sp_gm_tm_1` int DEFAULT NULL COMMENT 'Valor de mod sp gm tm 1',
  `mod_sp_gm_tm_2` int DEFAULT NULL COMMENT 'Valor de mod sp gm tm 2',
  `mod_sp_gm_place` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod sp gm place',
  `mod_sp_gm_info` int DEFAULT NULL COMMENT 'Valor de mod sp gm info',
  `mod_sp_gm_tm_score_1` int DEFAULT NULL COMMENT 'Valor de mod sp gm tm score 1',
  `mod_sp_gm_tm_score_2` int DEFAULT NULL COMMENT 'Valor de mod sp gm tm score 2',
  `mod_sg_gm_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Estado del proceso',
  `mod_sg_gm_date` datetime DEFAULT NULL COMMENT 'Fecha del registro',
  `mod_sg_gm_link` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod sg gm link',
  `mod_sg_gm_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_sp_gm_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sports_games
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_sports_teams
-- ----------------------------
CREATE TABLE `mod_sports_teams` (
  `mod_sp_tm_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de sp tm',
  `mod_sp_tm_sport` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod sp tm sport',
  `mod_sp_tm_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_sp_tm_pathurl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Ruta URL del recurso',
  `mod_sp_tm_details` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod sp tm details',
  `mod_sp_tm_logo` int DEFAULT NULL COMMENT 'file ID',
  `mod_sp_tm_banner` int DEFAULT NULL COMMENT 'file Id',
  `mod_sp_tm_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mos_sp_tm_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_sp_tm_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_sp_tm_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_sports_teams
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_stock
-- ----------------------------
CREATE TABLE `mod_stock` (
  `mod_stk_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de stk',
  `mod_stk_sku` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod stk sku',
  `mod_stk_prod_id` int NOT NULL COMMENT 'ID de stk prod',
  `mod_stk_quantity` int DEFAULT NULL COMMENT 'Valor de mod stk quantity',
  `mod_stk_register_date` datetime NOT NULL COMMENT 'Fecha de registro',
  `mod_stk_comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod stk comment',
  `mod_stk_inv_id` int DEFAULT NULL COMMENT 'id factura',
  `mod_stk_max` int DEFAULT NULL COMMENT 'Valor de mod stk max',
  `mod_stk_min` int DEFAULT NULL COMMENT 'Valor de mod stk min',
  `mod_stk_alert` int DEFAULT NULL COMMENT 'Valor de mod stk alert',
  `mod_stk_receipt_date` datetime NOT NULL COMMENT 'fecha de recepción',
  `mod_stk_lote` int NOT NULL COMMENT 'Valor de mod stk lote',
  `mod_stk_prv_id` int NOT NULL COMMENT 'id proveedor',
  `mod_stk_net_price` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT 'precio neto',
  `mod_stk_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_stk_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_stk_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_stock
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_stock_receipt
-- ----------------------------
CREATE TABLE `mod_stock_receipt` (
  `mod_str_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de str',
  `mod_str_prod_id` int DEFAULT NULL COMMENT 'ID de str prod',
  `mod_str_quantity` int DEFAULT NULL COMMENT 'Valor de mod str quantity',
  `mod_str_register_date` datetime NOT NULL COMMENT 'Fecha de registro',
  `mod_str_comment` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod str comment',
  `mod_str_inv_id` int DEFAULT NULL COMMENT 'id factura',
  `mod_str_max` int DEFAULT NULL COMMENT 'Valor de mod str max',
  `mod_str_min` int DEFAULT NULL COMMENT 'Valor de mod str min',
  `mod_str_receipt_date` datetime NOT NULL COMMENT 'fecha de recepción',
  `mod_str_lote` int NOT NULL COMMENT 'Valor de mod str lote',
  `mod_str_prv_id` int NOT NULL COMMENT 'id proveedor',
  `mod_str_net_price` decimal(20,2) NOT NULL COMMENT 'Valor de mod str net price',
  `mod_str_cash_discount` decimal(20,2) NOT NULL COMMENT 'Valor de mod str cash discount',
  `mod_str_discount` int NOT NULL COMMENT 'Valor de mod str discount',
  `mod_str_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_str_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_stock_receipt
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_surveys
-- ----------------------------
CREATE TABLE `mod_surveys` (
  `mod_svy_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de svy',
  `mod_svy_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod svy title',
  `mod_svy_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `mod_svy_created_by` int DEFAULT NULL COMMENT 'Valor de mod svy created by',
  `mod_svy_creation_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha del registro',
  `mod_svy_active` tinyint(1) DEFAULT '1' COMMENT 'Valor de mod svy active',
  PRIMARY KEY (`mod_svy_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_surveys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_surveys_options
-- ----------------------------
CREATE TABLE `mod_surveys_options` (
  `mod_svy_so_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de svy so',
  `mod_svy_so_sq_id` int DEFAULT NULL COMMENT 'ID de svy so sq',
  `mod_svy_so_option` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod svy so option',
  `mod_svy_so_order` int DEFAULT '1' COMMENT 'Orden de visualización',
  `mod_svy_so_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_svy_so_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_surveys_options
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_surveys_questions
-- ----------------------------
CREATE TABLE `mod_surveys_questions` (
  `mod_svy_sq_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de svy sq',
  `mod_svy_sq_svy_id` int DEFAULT NULL COMMENT 'ID de svy sq svy',
  `mod_svy_sq_question` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod svy sq question',
  `mod_svy_sq_type` enum('text','multiple_choice','rating') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Tipo de registro',
  `mod_svy_sq_is_required` tinyint(1) DEFAULT '1' COMMENT 'Valor de mod svy sq is required',
  `mod_svy_sq_order` int DEFAULT '1' COMMENT 'Orden de visualización',
  `mod_svy_sq_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_svy_sq_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_surveys_questions
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_surveys_responses
-- ----------------------------
CREATE TABLE `mod_surveys_responses` (
  `mod_svy_svr_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de svy svr',
  `mod_svy_svr_acu_id` int DEFAULT NULL COMMENT 'ID de svy svr acu',
  `mod_svy_svr_survey_id` int DEFAULT NULL COMMENT 'ID de svy svr survey',
  `mod_svy_svr_sq_id` int DEFAULT NULL COMMENT 'ID de svy svr sq',
  `mod_svy_svr_response` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod svy svr response',
  `mod_svy_svr_atk_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Token de autenticación',
  `mod_svy_svr_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha del registro',
  `mod_svy_svr_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_svy_svr_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_surveys_responses
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_syllabus
-- ----------------------------
CREATE TABLE `mod_syllabus` (
  `mod_syl_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de syl',
  `mod_syl_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_syl_summary` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod syl summary',
  `mod_syl_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_syl_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_syl_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_syllabus
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_syllabus_categorys
-- ----------------------------
CREATE TABLE `mod_syllabus_categorys` (
  `mod_syl_cat_syl_id` int NOT NULL COMMENT 'ID de syl cat syl',
  `mod_syl_cat_cat_id` int NOT NULL COMMENT 'ID de syl cat cat',
  `mod_syl_cat_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_syl_cat_syl_id`,`mod_syl_cat_cat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_syllabus_categorys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_syllabus_contents
-- ----------------------------
CREATE TABLE `mod_syllabus_contents` (
  `mod_syl_cont_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de syl cont',
  `mod_syl_cont_title` varchar(445) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod syl cont title',
  `mod_syl_cont_summary` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod syl cont summary',
  `mod_syl_cont_per_id` int DEFAULT NULL COMMENT 'ID de syl cont per',
  `mod_syl_cont_syl_id` int DEFAULT NULL COMMENT 'ID de syl cont syl',
  `mod_syl_cont_order` int DEFAULT NULL COMMENT 'Orden de visualización',
  `mod_syl_cont_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_syl_cont_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_syllabus_contents
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_syllabus_periods
-- ----------------------------
CREATE TABLE `mod_syllabus_periods` (
  `mod_syl_per_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de syl per',
  `mod_syl_per_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_syl_per_summary` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod syl per summary',
  `mod_syl_per_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_syl_per_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_syl_per_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_syllabus_periods
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_syllabus_relations_periods
-- ----------------------------
CREATE TABLE `mod_syllabus_relations_periods` (
  `mod_syl_rel_per_syl_id` int NOT NULL COMMENT 'ID de syl rel per syl',
  `mod_syl_rel_per_per_id` int NOT NULL COMMENT 'ID de syl rel per per',
  `mod_syl_rel_per_order` int DEFAULT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_syl_rel_per_syl_id`,`mod_syl_rel_per_per_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_syllabus_relations_periods
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_contribuyente_form
-- ----------------------------
CREATE TABLE `mod_tributes_contribuyente_form` (
  `mod_tb_cf_typc_id` int NOT NULL COMMENT 'ID de tb cf typc',
  `mod_tb_cf_type_form_id` int NOT NULL COMMENT 'ID de tb cf type form',
  `mod_tb_cf_presentacion` varchar(445) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod tb cf presentacion',
  PRIMARY KEY (`mod_tb_cf_typc_id`,`mod_tb_cf_type_form_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_contribuyente_form
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_facturas_cliente
-- ----------------------------
CREATE TABLE `mod_tributes_facturas_cliente` (
  `mod_tb_fac_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de tb fac',
  `mod_tb_fac_nit` bigint NOT NULL COMMENT 'Valor de mod tb fac nit',
  `mod_tb_fac_file_id` int DEFAULT NULL COMMENT 'ID de tb fac file',
  `mod_tb_fac_type` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'manual' COMMENT 'Tipo de registro',
  `mod_tb_fac_period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod tb fac period',
  `mod_tb_fac_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_tb_fac_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_facturas_cliente
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_facturas_filter
-- ----------------------------
CREATE TABLE `mod_tributes_facturas_filter` (
  `mod_tb_fcf_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de tb fcf',
  `mod_tb_fcf_nombre` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod tb fcf nombre',
  `mod_tb_fcf_fac_id` int DEFAULT NULL COMMENT 'ID de tb fcf fac',
  `mod_tb_fcf_fac_nit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod tb fcf fac nit',
  `mod_tb_fcf_fac_file_id` int DEFAULT NULL COMMENT 'ID de tb fcf fac file',
  `mod_tb_fcf_fac_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod tb fcf fac img',
  `mod_tb_fcf_fac_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'manuales, qr, qr_antiguos, na',
  `mod_tb_fcf_fac_period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ej: 202505',
  `mod_tb_fcf_fac_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'no_analizada,analizada,descartada',
  `mod_tb_fcf_fac_reason_discard` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod tb fcf fac reason discard',
  `mod_tb_fcf_nitProveedor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Mod Tb Fcf NitProveedor',
  `mod_tb_fcf_razonSocialProveedor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Mod Tb Fcf RazonSocialProveedor',
  `mod_tb_fcf_codigoAutorizacion` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Mod Tb Fcf CodigoAutorizacion',
  `mod_tb_fcf_numeroFactura` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Mod Tb Fcf NumeroFactura',
  `mod_tb_fcf_numeroDuiDim` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Mod Tb Fcf NumeroDuiDim',
  `mod_tb_fcf_fechaFacturaDuiDim` date DEFAULT NULL COMMENT 'Mod Tb Fcf FechaFacturaDuiDim',
  `mod_tb_fcf_importeTotalCompra` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImporteTotalCompra',
  `mod_tb_fcf_importeIce` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImporteIce',
  `mod_tb_fcf_importeIehd` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImporteIehd',
  `mod_tb_fcf_importeIpj` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImporteIpj',
  `mod_tb_fcf_tasas` decimal(10,2) DEFAULT NULL COMMENT 'Valor de mod tb fcf tasas',
  `mod_tb_fcf_otroNoSujetoACreditoFiscal` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf OtroNoSujetoACreditoFiscal',
  `mod_tb_fcf_importesExentos` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImportesExentos',
  `mod_tb_fcf_importeComprasGravadasATasaCero` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImporteComprasGravadasATasaCero',
  `mod_tb_fcf_descuentos` decimal(10,2) DEFAULT NULL COMMENT 'Valor de mod tb fcf descuentos',
  `mod_tb_fcf_importeGifCard` decimal(10,2) DEFAULT NULL COMMENT 'Mod Tb Fcf ImporteGifCard',
  `mod_tb_fcf_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `mod_tb_fcf_date_register` date DEFAULT NULL COMMENT 'Valor de mod tb fcf date register',
  `mod_tb_fcf_state` int DEFAULT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_tb_fcf_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_facturas_filter
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_options
-- ----------------------------
CREATE TABLE `mod_tributes_options` (
  `mod_tb_op_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de tb op',
  `mod_tb_op_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_tb_op_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod tb op value',
  `mod_tb_op_autoload` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'yes' COMMENT 'Valor de mod tb op autoload',
  `mod_tb_op_date_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Valor de mod tb op date created',
  `mod_tb_op_date_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Valor de mod tb op date updated',
  PRIMARY KEY (`mod_tb_op_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_options
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_periods
-- ----------------------------
CREATE TABLE `mod_tributes_periods` (
  `mod_tb_pr_id` int NOT NULL AUTO_INCREMENT COMMENT 'ej:202409 se refiere al periodo 2024-09 año/mes siempre seran 6 digitos',
  `mod_tb_pr_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_tb_pr_year_fiscal` year DEFAULT NULL COMMENT 'ej:2024',
  `mod_tb_pr_init_monthly` date DEFAULT NULL COMMENT 'ej:2024-01-01',
  `mod_tb_pr_end_monthly` date DEFAULT NULL COMMENT 'ej:2024-12-31',
  `mod_tb_pr_init_quarterly` date DEFAULT NULL COMMENT 'ej:2024-01-01',
  `mod_tb_pr_end_quarterly` date DEFAULT NULL COMMENT 'ej:2024-12-31',
  `mod_tb_pr_type` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ej: M M,T.. M: mensual, M,T: mensual y trimestral',
  `mod_tb_pr_active_user` int DEFAULT NULL COMMENT 'si este periodo esta activo para el usuario manejado por el cron de sistema para cerrar periodos',
  `mod_tb_pr_active_operator` int DEFAULT NULL COMMENT 'si este periodo esta activo para el operador manejado por el cron de sistema para cerrar periodos',
  `mod_tb_pr_message_register` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'es el campo texto para gestionar mensajes en el registro, es html hecho en markdown',
  `mod_tb_pr_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_tb_pr_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `mod_tb_pr_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_tb_pr_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=202513 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_periods
-- ----------------------------
BEGIN;
INSERT INTO `mod_tributes_periods` VALUES (202412, 'Periodo 12-2024', 2024, '2024-12-01', '2024-12-31', '2024-10-01', '2024-12-31', 'M,T', 1, 1, '- Facturas Mensuales desde el 2024/Dic/01 al 2024/Dic/31\r\n- Facturas Trimestrales desde el 2024/Oct/01 al 2024/Dic/31', NULL, NULL, 1);
INSERT INTO `mod_tributes_periods` VALUES (202501, 'Periodo 01-2025', 2025, '2025-01-01', '2024-01-31', '2025-01-01', '2025-03-31', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Ene/01 al 2025/Ene/31', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202502, 'Periodo 02-2025', 2025, '2025-02-01', '2024-02-28', '2025-01-01', '2025-03-31', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Feb/01 al 2025/Feb/28', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202503, 'Periodo 03-2025', 2025, '2025-03-01', '2024-03-31', '2025-01-01', '2025-03-31', 'M,T', 0, 0, '- Facturas Mensuales desde el 2025/Mar/01 al 2025/Mar/31 - Facturas Trimestrales desde el 2025/Ene/01 al 2025/Mar/31', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202504, 'Periodo 04-2025', 2025, '2025-04-01', '2024-04-30', '2025-04-01', '2025-06-30', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Abr/01 al 2025/Abr/30', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202505, 'Periodo 05-2025', 2025, '2025-05-01', '2024-05-31', '2025-04-01', '2025-06-30', 'M', 0, 0, '- Facturas Mensuales desde el 2025/May/01 al 2025/May/31', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202506, 'Periodo 06-2025', 2025, '2025-06-01', '2024-06-30', '2025-04-01', '2025-06-30', 'M,T', 0, 0, '- Facturas Mensuales desde el 2025/Jun/01 al 2025/Jun/30 - Facturas Trimestrales desde el 2025/Abr/01 al 2025/Jun/30', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202507, 'Periodo 07-2025', 2025, '2025-07-01', '2024-07-31', '2025-07-01', '2025-09-30', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Jul/01 al 2025/Jul/31', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202508, 'Periodo 08-2025', 2025, '2025-08-01', '2024-08-31', '2025-07-01', '2025-09-30', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Ago/01 al 2025/Ago/31', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202509, 'Periodo 09-2025', 2025, '2025-09-01', '2024-09-30', '2025-07-01', '2025-09-30', 'M,T', 0, 0, '- Facturas Mensuales desde el 2025/Sep/01 al 2025/Sep/30 - Facturas Trimestrales desde el 2025/Jul/01 al 2025/Sep/30', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202510, 'Periodo 10-2025', 2025, '2025-10-01', '2024-10-31', '2025-10-01', '2025-12-31', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Oct/01 al 2025/Oct/31', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202511, 'Periodo 11-2025', 2025, '2025-11-01', '2024-11-30', '2025-10-01', '2025-12-31', 'M', 0, 0, '- Facturas Mensuales desde el 2025/Nov/01 al 2025/Nov/30', NULL, NULL, 0);
INSERT INTO `mod_tributes_periods` VALUES (202512, 'Periodo 12-2025', 2025, '2025-12-01', '2024-12-31', '2025-10-01', '2025-12-31', 'M,T', 0, 0, '- Facturas Mensuales desde el 2025/Dic/01 al 2025/Dic/31 - Facturas Trimestrales desde el 2025/Oct/01 al 2025/Dic/31', NULL, NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_plans_periods
-- ----------------------------
CREATE TABLE `mod_tributes_plans_periods` (
  `mod_tb_plpr_cpe_id` int NOT NULL COMMENT 'ID de tb plpr cpe',
  `mod_tb_plpr_pl_id` int NOT NULL COMMENT 'ID de tb plpr pl',
  `mod_tb_plpr_pr_id` int NOT NULL COMMENT 'ID de tb plpr pr',
  `mod_tb_plpr_state` int NOT NULL COMMENT 'Estado del registro',
  `mod_tb_plpr_nit` bigint DEFAULT NULL COMMENT 'Valor de mod tb plpr nit',
  PRIMARY KEY (`mod_tb_plpr_cpe_id`,`mod_tb_plpr_pl_id`,`mod_tb_plpr_pr_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_plans_periods
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_tributes_relations_periods
-- ----------------------------
CREATE TABLE `mod_tributes_relations_periods` (
  `mod_tb_rpd_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de tb rpd',
  `mod_tb_rpd_pr_id` int DEFAULT NULL COMMENT 'ID de tb rpd pr',
  `mod_tb_rpd_group_nit` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'g1,g2',
  `mod_tb_rpd_date_max_reception` date DEFAULT NULL COMMENT 'Valor de mod tb rpd date max reception',
  `mod_tb_rpd_date_max_preliquidation` date DEFAULT NULL COMMENT 'Valor de mod tb rpd date max preliquidation',
  `mod_tb_rpd_date_ok_preliquidation` date DEFAULT NULL COMMENT 'Valor de mod tb rpd date ok preliquidation',
  `mod_tb_rpd_date_declaration` date DEFAULT NULL COMMENT 'Valor de mod tb rpd date declaration',
  PRIMARY KEY (`mod_tb_rpd_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_tributes_relations_periods
-- ----------------------------
BEGIN;
INSERT INTO `mod_tributes_relations_periods` VALUES (1, 202409, 'G1', '2024-10-05', '2024-10-09', '2024-10-11', '2024-10-12');
INSERT INTO `mod_tributes_relations_periods` VALUES (2, 202409, 'G2', '2024-10-05', '2024-10-10', '2024-10-14', '2024-10-17');
INSERT INTO `mod_tributes_relations_periods` VALUES (3, 202410, 'G1', '2024-11-05', '2024-11-09', '2024-11-11', '2024-11-12');
INSERT INTO `mod_tributes_relations_periods` VALUES (4, 202410, 'G2', '2024-11-05', '2024-11-10', '2024-11-14', '2024-11-17');
INSERT INTO `mod_tributes_relations_periods` VALUES (5, 202411, 'G1', '2024-12-05', '2024-12-09', '2024-12-11', '2024-12-12');
INSERT INTO `mod_tributes_relations_periods` VALUES (6, 202411, 'G2', '2024-12-05', '2024-12-10', '2024-12-14', '2024-12-17');
INSERT INTO `mod_tributes_relations_periods` VALUES (7, 202412, 'G1', '2025-01-05', '2025-01-09', '2025-01-11', '2025-01-12');
INSERT INTO `mod_tributes_relations_periods` VALUES (8, 202409, 'G2', '2025-01-05', '2025-01-10', '2025-01-14', '2025-01-17');
COMMIT;

-- ----------------------------
-- Table structure for mod_types_contribuyentes
-- ----------------------------
CREATE TABLE `mod_types_contribuyentes` (
  `mod_typc_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de typc',
  `mod_typc_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_typc_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `mod_typc_system` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod typc system',
  `mod_typc_state` int DEFAULT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_typc_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_types_contribuyentes
-- ----------------------------
BEGIN;
INSERT INTO `mod_types_contribuyentes` VALUES (1, 'Alquiler de Bienes', NULL, 'tributo_v1', 1);
INSERT INTO `mod_types_contribuyentes` VALUES (2, 'Consultor en Linea', NULL, 'tributo_v1', 1);
INSERT INTO `mod_types_contribuyentes` VALUES (3, 'Oficio Independiente', NULL, 'tributo_v1', 1);
INSERT INTO `mod_types_contribuyentes` VALUES (4, 'Profesional Independiente', NULL, 'tributo_v1', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_types_forms
-- ----------------------------
CREATE TABLE `mod_types_forms` (
  `mod_type_form_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de type form',
  `mod_type_form_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_type_form_declaracion` varchar(24) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod type form declaracion',
  `mod_type_form_mode` varchar(44) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de mod type form mode',
  `mod_type_form_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_type_form_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_type_form_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=611 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_types_forms
-- ----------------------------
BEGIN;
INSERT INTO `mod_types_forms` VALUES (110, 'Formulario 110', 'trimestral', 'impuestos', '0', 0);
INSERT INTO `mod_types_forms` VALUES (200, 'Formulario 200', 'mensual', 'impuestos', '0', 1);
INSERT INTO `mod_types_forms` VALUES (400, 'Formulario 400', 'mensual', 'impuestos', '0', 0);
INSERT INTO `mod_types_forms` VALUES (610, 'Formulario 610', 'trimestral', 'impuestos', '0', 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_types_oficios
-- ----------------------------
CREATE TABLE `mod_types_oficios` (
  `mod_tb_tof_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de tb tof',
  `mod_tb_tof_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `mod_tb_tof_descrition` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod tb tof descrition',
  `mod_tb_tof_code` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código interno',
  `mod_tb_tof_state` int NOT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_tb_tof_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_types_oficios
-- ----------------------------
BEGIN;
INSERT INTO `mod_types_oficios` VALUES (1, 'Alquiler de Bienes', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (2, 'Consultor en Linea', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (3, 'Instaladores', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (4, 'Chóferes', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (5, 'Carpiteros', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (6, 'Mecánicos', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (7, 'Consultores Independientes', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (8, 'Arquitectos', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (9, 'Abogados', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (10, 'Médicos', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (11, 'Catedráticos', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (12, 'Ingenieros', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (13, 'Veterinarios', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (14, 'Psicólogos', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (15, 'Bioquimicas', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (16, 'Economistas', '0', NULL, 1);
INSERT INTO `mod_types_oficios` VALUES (17, 'Otros Profesionales Independientes', '0', NULL, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_validme_applicants
-- ----------------------------
CREATE TABLE `mod_validme_applicants` (
  `mod_va_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de va',
  `mod_va_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_va_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Correo electrónico',
  `mod_va_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Número de teléfono',
  `mod_va_type` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'individual' COMMENT 'Tipo de registro',
  `mod_va_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_va_date_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Valor de mod va date created',
  `mod_va_date_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Valor de mod va date updated',
  `mod_va_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_va_status` int DEFAULT '1' COMMENT 'Estado del proceso',
  PRIMARY KEY (`mod_va_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_validme_applicants
-- ----------------------------
BEGIN;
INSERT INTO `mod_validme_applicants` VALUES (1, 'Jess Fido', 'jess.fido@example.com', '+1234567890', 'individual', NULL, '2025-04-19 09:02:15', '2025-04-19 09:02:15', 1, 1);
INSERT INTO `mod_validme_applicants` VALUES (2, 'Sam Blanc', 'sam.blanc@example.com', '+1234567891', 'individual', NULL, '2025-04-19 09:02:15', '2025-04-19 09:02:15', 1, 1);
INSERT INTO `mod_validme_applicants` VALUES (3, 'Kyle Roberts', 'kyle.roberts@example.com', '+1234567892', 'individual', NULL, '2025-04-19 09:02:15', '2025-04-19 09:02:15', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_validme_callback_logs
-- ----------------------------
CREATE TABLE `mod_validme_callback_logs` (
  `mod_vcl_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único del log',
  `mod_vcl_applicant_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ID del solicitante relacionado',
  `mod_vcl_applicant_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Correo electrónico del solicitante',
  `mod_vcl_applicant_phone_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Número de teléfono del solicitante',
  `mod_vcl_organization_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ID de la organización',
  `mod_vcl_webhook_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL del webhook',
  `mod_vcl_request` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos enviados en la solicitud',
  `mod_vcl_files` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Archivos adjuntos',
  `mod_vcl_response` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Respuesta recibida',
  `mod_vcl_verifications_files` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Archivos adjuntos',
  `mod_vcl_text_payload` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Payload',
  `mod_vcl_status_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Código de estado HTTP',
  `mod_vcl_status_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Tipo de estado del callback',
  `mod_vcl_code_verification` int DEFAULT NULL COMMENT 'Código de verificación',
  `mod_vcl_success` tinyint(1) DEFAULT '0' COMMENT 'Indicador de éxito (1=éxito, 0=error)',
  `mod_vcl_attempts` int DEFAULT '1' COMMENT 'Número de intentos realizados',
  `mod_vcl_error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Mensaje de error si lo hay',
  `mod_vcl_date_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_vcl_date_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Última actualización',
  `mod_vcl_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_vcl_state` int DEFAULT '1' COMMENT 'Estado (1=activo, 0=inactivo)',
  PRIMARY KEY (`mod_vcl_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Log de callbacks de respuesta';

-- ----------------------------
-- Records of mod_validme_callback_logs
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_validme_checks
-- ----------------------------
CREATE TABLE `mod_validme_checks` (
  `mod_vc_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de vc',
  `mod_vc_applicant_id` int NOT NULL COMMENT 'ID de vc applicant',
  `mod_vc_type` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'background' COMMENT 'Tipo de registro',
  `mod_vc_progress` enum('PENDING','IN_PROGRESS','COMPLETED') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'PENDING' COMMENT 'Valor de mod vc progress',
  `mod_vc_result` enum('CLEAR','CONSIDER','ALERT') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de mod vc result',
  `mod_vc_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `mod_vc_date_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Valor de mod vc date created',
  `mod_vc_date_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Valor de mod vc date updated',
  `mod_vc_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `mod_vc_status` int DEFAULT '1' COMMENT 'Estado del proceso',
  PRIMARY KEY (`mod_vc_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_validme_checks
-- ----------------------------
BEGIN;
INSERT INTO `mod_validme_checks` VALUES (1, 1, 'background', 'COMPLETED', 'CLEAR', NULL, '2025-04-19 09:02:18', '2025-04-19 09:02:18', 1, 1);
INSERT INTO `mod_validme_checks` VALUES (2, 2, 'background', 'COMPLETED', 'CONSIDER', NULL, '2025-04-19 09:02:18', '2025-04-19 09:02:18', 1, 1);
INSERT INTO `mod_validme_checks` VALUES (3, 3, 'background', 'COMPLETED', 'CLEAR', NULL, '2025-04-19 09:02:18', '2025-04-19 09:02:18', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for mod_validme_data
-- ----------------------------
CREATE TABLE `mod_validme_data` (
  `mod_vd_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único',
  `mod_vd_cen_id` int NOT NULL COMMENT 'ID de cliente/proveedor console',
  `mod_vd_code_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID de cliente/proveedor API',
  `mod_vd_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Correo electrónico administrador',
  `mod_vd_nit` bigint NOT NULL COMMENT 'Nit del cliente/proveedor',
  `mod_vd_business_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Razón social',
  `mod_vd_webhookUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL del webhook',
  `mod_vd_image` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Imagen asociada',
  `mod_vd_token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Token de autenticación',
  `mod_vd_private_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Clave privada',
  `mod_vd_public_key` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Clave pública',
  `mod_vd_mode_save_key` enum('localkey','dbkey') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Modo de guardado',
  `mod_vd_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_vd_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_vd_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha de actualización',
  `mod_vd_status` int DEFAULT '1' COMMENT 'Estado (1=activo, 0=inactivo)',
  PRIMARY KEY (`mod_vd_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_validme_data
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_validme_options
-- ----------------------------
CREATE TABLE `mod_validme_options` (
  `mod_vo_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único de opción',
  `mod_vo_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre de la opción',
  `mod_vo_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de la opción',
  `mod_vo_autoload` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'yes' COMMENT 'Autoload',
  `mod_vo_date_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación',
  `mod_vo_date_updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Última actualización',
  PRIMARY KEY (`mod_vo_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Opciones de Validme';

-- ----------------------------
-- Records of mod_validme_options
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_vms_commission_rules
-- ----------------------------
CREATE TABLE `mod_vms_commission_rules` (
  `mod_vcr_id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único de la regla de comisión',
  `mod_vcr_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre de la regla (Ej: Electronica_Estandar)',
  `mod_vcr_type` enum('FIXED','PERCENTAGE','TIERED') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Tipo de cálculo de comisión',
  `mod_vcr_percentage` decimal(5,4) DEFAULT NULL COMMENT 'Porcentaje a aplicar (si es tipo PERCENTAGE)',
  `mod_vcr_fixed_amount` decimal(10,2) DEFAULT NULL COMMENT 'Monto fijo a aplicar (si es tipo FIXED)',
  `mod_vcr_start_date` date NOT NULL COMMENT 'Fecha de inicio de vigencia',
  `mod_vcr_end_date` date DEFAULT NULL COMMENT 'Fecha de fin de vigencia (NULL si es indefinida)',
  `mod_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación del registro',
  PRIMARY KEY (`mod_vcr_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Reglas maestras para calcular la comisión marketplace-vendor';

-- ----------------------------
-- Records of mod_vms_commission_rules
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_vms_performance
-- ----------------------------
CREATE TABLE `mod_vms_performance` (
  `mod_vp_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único de la métrica',
  `mod_vp_vv_id` int unsigned NOT NULL COMMENT 'Referencia al ID del vendedor (mod_vv_id)',
  `mod_vp_date_recorded` date NOT NULL COMMENT 'Fecha de registro de la métrica',
  `mod_vp_ots_rate` decimal(5,4) DEFAULT NULL COMMENT 'Tasa de envío a tiempo (On-Time Shipping Rate)',
  `mod_vp_cancellation_rate` decimal(5,4) DEFAULT NULL COMMENT 'Tasa de cancelación de pedidos',
  `mod_vp_avg_rating` decimal(3,2) DEFAULT NULL COMMENT 'Promedio de Reseñas (desde CCM)',
  PRIMARY KEY (`mod_vp_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Métricas diarias de rendimiento (alimentadas por BI)';

-- ----------------------------
-- Records of mod_vms_performance
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_vms_vendors
-- ----------------------------
CREATE TABLE `mod_vms_vendors` (
  `mod_vv_id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del vendedor (Vendor)',
  `mod_vv_legal_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre legal o razón social del vendedor',
  `mod_vv_contact_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Correo electrónico de contacto',
  `mod_vv_kyc_status` enum('PENDING','APPROVED','REJECTED') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Estado de verificación (KYC/Compliance)',
  `mod_vv_payout_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Detalles de la cuenta bancaria para liquidación (idealmente encriptados)',
  `mod_vv_onboarding_date` date NOT NULL COMMENT 'Fecha de alta en la plataforma',
  `mod_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación del registro',
  `mod_updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha de última actualización',
  `mod_status` int DEFAULT '1' COMMENT 'Estado (1=activo, 0=inactivo)',
  PRIMARY KEY (`mod_vv_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Registro de Vendedores del Marketplace';

-- ----------------------------
-- Records of mod_vms_vendors
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_warehouses
-- ----------------------------
CREATE TABLE `mod_warehouses` (
  `mod_wrh_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de wrh',
  `mod_wrh_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `mod_wrh_details` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de mod wrh details',
  `mod_wrh_primary` bit(2) DEFAULT b'0' COMMENT 'Valor de mod wrh primary',
  `mod_wrh_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`mod_wrh_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of mod_warehouses
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_wms_movement_log
-- ----------------------------
CREATE TABLE `mod_wms_movement_log` (
  `mod_wm_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del movimiento de inventario',
  `mod_wm_ps_id` bigint unsigned NOT NULL COMMENT 'Referencia al ID del SKU (mod_ps_id)',
  `mod_wm_transaction_ref_id` bigint unsigned DEFAULT NULL COMMENT 'Referencia a Order_Item, Return, or Purchase_Order',
  `mod_wm_type` enum('RECEIVE','PICK','ADJUSTMENT','TRANSFER_IN','TRANSFER_OUT','RETURN_RESTOCK') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Tipo de evento que causó el cambio de stock',
  `mod_wm_from_bin_id` int unsigned DEFAULT NULL COMMENT 'Ubicación (bin) de origen (NULL si es recepción)',
  `mod_wm_to_bin_id` int unsigned DEFAULT NULL COMMENT 'Ubicación (bin) de destino (NULL si es consumo/pick)',
  `mod_wm_qty_change` int NOT NULL COMMENT 'Cantidad neta que afecta a la ubicación de destino (+/-)',
  `mod_wm_he_id` int unsigned DEFAULT NULL COMMENT 'ID del empleado responsable (para auditoría)',
  `mod_wm_timestamp` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'Momento exacto del movimiento',
  PRIMARY KEY (`mod_wm_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Ledger inmutable de movimientos de stock para trazabilidad y auditoría';

-- ----------------------------
-- Records of mod_wms_movement_log
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_wms_stock
-- ----------------------------
CREATE TABLE `mod_wms_stock` (
  `mod_ws_ps_id` bigint unsigned NOT NULL COMMENT 'Referencia al ID del SKU (mod_ps_id)',
  `mod_ws_wb_id` int unsigned NOT NULL COMMENT 'Referencia al ID del bin (mod_wb_id)',
  `mod_ws_qty` int NOT NULL DEFAULT '0' COMMENT 'Cantidad de stock disponible en esta ubicación',
  `mod_ws_last_updated` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Fecha y hora de la última actualización de cantidad',
  PRIMARY KEY (`mod_ws_ps_id`,`mod_ws_wb_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Balance de Stock actual por SKU y Ubicación (Derivado del Ledger)';

-- ----------------------------
-- Records of mod_wms_stock
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_wms_storage_bins
-- ----------------------------
CREATE TABLE `mod_wms_storage_bins` (
  `mod_wb_id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del bin (ubicación granular)',
  `mod_wb_ww_id` int unsigned NOT NULL COMMENT 'Referencia al ID del almacén (mod_ww_id)',
  `mod_wb_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Código de ubicación (Ej: A1-03-B)',
  `mod_wb_zone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Zona o área dentro del almacén',
  `mod_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación del registro',
  PRIMARY KEY (`mod_wb_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Ubicaciones físicas granulares dentro de los almacenes';

-- ----------------------------
-- Records of mod_wms_storage_bins
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for mod_wms_warehouses
-- ----------------------------
CREATE TABLE `mod_wms_warehouses` (
  `mod_ww_id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del almacén',
  `mod_ww_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del almacén o centro de distribución',
  `mod_ww_address_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Detalles de ubicación física (lat/long, dirección)',
  `mod_ww_is_fulfillment` tinyint(1) DEFAULT '1' COMMENT 'Indica si se usa para cumplir órdenes de cliente',
  `mod_created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación del registro',
  PRIMARY KEY (`mod_ww_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Maestro de Almacenes Físicos';

-- ----------------------------
-- Records of mod_wms_warehouses
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for modules
-- ----------------------------
CREATE TABLE `modules` (
  `mod_id` int NOT NULL AUTO_INCREMENT,
  `mod_name` varchar(255) DEFAULT NULL,
  `mod_description` tinytext,
  `mod_pathurl` varchar(255) DEFAULT NULL,
  `mod_path` varchar(500) DEFAULT NULL,
  `mod_code` varchar(11) DEFAULT NULL,
  `mod_icon` varchar(255) DEFAULT NULL,
  `mod_color` varchar(10) DEFAULT NULL,
  `mod_parent_id` int DEFAULT NULL,
  `mod_indexjs` varchar(400) NOT NULL,
  `mod_css` varchar(255) NOT NULL,
  `mod_db` varchar(255) NOT NULL COMMENT 'database',
  `mod_prefix_db` varchar(255) NOT NULL,
  `mod_relations_db` text NOT NULL,
  `mod_state` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`mod_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=4803 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of modules
-- ----------------------------
BEGIN;
INSERT INTO `modules` VALUES (3, 'sites', NULL, 'sites', 'systems/cms/', 'SIT1', 'icon icon-blocks', '#8900ff', 0, 'components/sites.js', 'assets/css/dist/sites.css', 'sites', 'site_', '', 0);
INSERT INTO `modules` VALUES (4, 'Workspaces', NULL, 'workspaces', 'systems/cms/', 'WS1', 'icon icon-worksheets', '#26fff6', 0, 'components/workspaces.js', 'assets/css/dist/worksheets.css', 'mod_cms_workspaces', 'mod_cms_ws_', '', 1);
INSERT INTO `modules` VALUES (5, 'Bloques', NULL, 'blocks', 'systems/cms/', 'BL1', 'icon icon-blocks-web', '#FEBF10', 0, 'components/blocks.js', 'assets/css/dist/blocks.css', 'blocks', 'block_', '', 1);
INSERT INTO `modules` VALUES (6, 'Publicaciones', NULL, 'publications', 'systems/cms/', 'PUB1', 'icon icon-webpart', '#FEBF10', 0, 'components/publications.js', 'assets/css/dist/publications.css', 'publications', 'pub_', '', 1);
INSERT INTO `modules` VALUES (10, 'Dashboard CMS', 'Gestión de sitios web y contenidos', 'cms', 'systems/cms/', 'CMS1', 'icon icon-dashboard', '#99C14C', 0, 'components/cms.js', 'assets/css/dist/cms.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (11, 'Contenidos', NULL, 'contents', 'systems/cms/', 'CON1', 'icon icon-content', '#1ff4ed', 0, 'components/contents.js', 'assets/css/dist/contents.min.css', 'contents', 'cont_', 'contents_categorys:cont_cat_cont_id,contents_files:cont_file_cont_id', 1);
INSERT INTO `modules` VALUES (12, 'Categorias', NULL, 'categorys', 'systems/cms/', 'CAT1', 'icon icon-category', '#dd4b4d', 0, 'components/categorys.js', 'assets/css/dist/categorys.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (13, 'Media', NULL, 'media', 'systems/cms/', 'MED1', 'icon icon-media', '#f04f04', 0, 'components/media.js', 'assets/css/dist/media.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (14, 'Documentos', NULL, 'docs', 'systems/cms/', 'DOC1', 'icon icon-folder', '#FEBF10', 0, 'components/docs.js', 'assets/css/dist/docs.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (15, 'Posts', NULL, 'posts', 'systems/cms/', 'POST1', 'icon icon-news', '#37ff2c', 0, 'components/posts.js', 'assets/css/dist/posts.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (16, 'Sliders', NULL, 'sliders', 'systems/cms/', 'SLD1', 'icon icon-slider', '#8900ff', 0, 'components/sliders.js', 'assets/css/dist/sliders.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (17, 'Menus', NULL, 'menus', 'systems/cms/', 'MENU1', 'icon icon-list', '#26fff6', 0, 'components/menus.js', 'assets/css/dist/menus.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (18, 'Formularios', NULL, 'formularies', 'systems/cms/', 'SLD1', 'icon icon-unchecked', '#8aec49ff', 0, 'components/formularies.js', 'assets/css/dist/formularies.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (19, 'Popups', NULL, 'popups', 'systems/cms/', 'POP1', 'icon icon-copy', '#468de9ff', 0, 'components/popups.js', 'assets/css/dist/popups.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (200, 'Dashboard RRHH', NULL, 'rrhh', 'systems/rrhh/', 'RRHH', 'icon icon-dashboard', '#99C14C', 0, 'components/rrhh.js', 'assets/css/dist/rrhh.css', '', '', '', 1);
INSERT INTO `modules` VALUES (210, 'kardex', NULL, 'kardex', 'systems/rrhh/', 'KDX', 'icon icon-users', '#FEBF10', 0, 'components/kardex.js', '', '', '', '', 0);
INSERT INTO `modules` VALUES (220, 'Organigrama', NULL, 'organizationChart', 'systems/rrhh/', 'KDX', 'icon icon-users', '#FEBF10', 0, 'components/organizationChart.js', 'assets/css/dist/organizationChart', '', '', '', 1);
INSERT INTO `modules` VALUES (221, 'Empleados', 'Gestión de empleados', 'employees', 'systems/rrhh/', 'RRHH-1', 'icon icon-user', '#3a86ff', 0, 'components/employees.js', 'assets/css/dist/employees.css', '', '', '', 1);
INSERT INTO `modules` VALUES (222, 'Departamentos', 'Estructura organizacional', 'departments', 'systems/rrhh/', 'RRHH-2', 'icon icon-blocks', '#0ea5e9', 0, 'components/departments.js', 'assets/css/dist/departments.css', '', '', '', 1);
INSERT INTO `modules` VALUES (223, 'Cargos', 'Cargos y jerarquías', 'jobtitles', 'systems/rrhh/', 'RRHH-3', 'icon icon-circle-point', '#8b5cf6', 0, 'components/jobtitles.js', 'assets/css/dist/jobtitles.css', '', '', '', 1);
INSERT INTO `modules` VALUES (224, 'Contratos', 'Contratos laborales', 'contracts', 'systems/rrhh/', 'RRHH-4', 'icon icon-doc', '#f59e0b', 0, 'components/contracts.js', 'assets/css/dist/contracts.css', '', '', '', 1);
INSERT INTO `modules` VALUES (225, 'Asistencia', 'Control de asistencia', 'attendance', 'systems/rrhh/', 'RRHH-5', 'icon icon-calendar', '#14b8a6', 0, 'components/attendance.js', 'assets/css/dist/attendance.css', '', '', '', 1);
INSERT INTO `modules` VALUES (226, 'Alta', 'Alta de empleados (wizard)', 'alta', 'systems/rrhh/', 'RRHH-6', 'icon icon-circle-arrow-line-up', '#22c55e', 0, 'components/alta.js', 'assets/css/dist/alta.css', '', '', '', 1);
INSERT INTO `modules` VALUES (227, 'Baja', 'Baja y liquidación', 'baja', 'systems/rrhh/', 'RRHH-7', 'icon icon-circle-arrow-line-donw', '#ef4444', 0, 'components/baja.js', 'assets/css/dist/baja.css', '', '', '', 1);
INSERT INTO `modules` VALUES (600, 'Dashboard Consejeria', NULL, 'counseling', 'systems/counseling/', NULL, 'icon icon-dashboard', '#99C14C', 0, 'components/counseling.js', '', '', '', '', 1);
INSERT INTO `modules` VALUES (601, 'Aconsejados', NULL, 'advised', 'systems/counseling/', NULL, 'icon icon-users', '#FEBF10', 0, 'components/advised.js', '', '', '', '', 1);
INSERT INTO `modules` VALUES (602, 'Agenda', NULL, 'calendarAdvised', 'systems/counseling/', NULL, 'icon icon-calendar', '#FEBF10', 0, 'components/calendarAdvised.js', 'assets/css/dist/calendarAdvised.css', '', '', '', 1);
INSERT INTO `modules` VALUES (603, 'Reportes', NULL, 'reportsCounseling', 'systems/counseling/', NULL, 'icon icon-table-check', '#FEBF10', 0, 'components/reportCounseling.js', 'assets/css/dist/reportCounseling.css', '', '', '', 1);
INSERT INTO `modules` VALUES (700, 'Dashboard Ventas', NULL, 'sales', 'systems/sales/', 'PVD', 'icon icon-dashboard', '#fcc54e', 0, 'components/sales.js', 'assets/css/dist/sales.css', '', '', '', 1);
INSERT INTO `modules` VALUES (701, 'Punto de Venta Tickets', NULL, 'salesPointTickets', 'systems/sales/', 'PVT', 'icon icon-cash-register', '#fcc54e', 0, 'components/salesPointTickets.js', 'assets/css/dist/salesPointTickets.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1000, 'Dashboard Suscripciones', NULL, 'suscriptions', 'core/accounts/', 'SC1', 'icon icon-dashboard', '#99C14', 0, 'components/subscriptions.js', 'assets/css/dist/subscriptions.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1001, 'Cuentas de Usuarios', NULL, 'accountsUsers', 'core/accounts/', 'ACC1', 'icon icon-user', '#8900ff', 0, 'components/accountsUsers.js', 'assets/css/dist/subscriptions.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1002, 'Cuentas de Clientes', NULL, 'customers', 'core/accounts/', 'CS1', 'icon icon-folder-open', '#07c472', 0, 'components/customers.js', 'assets/css/dist/customers.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1200, 'Dashboard FLS', NULL, 'fls', 'systems/fls/', 'FLS', 'icon icon-dashboard', '#fcc54e', 0, 'components/fls.js', 'assets/css/dist/fls.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1201, 'Clientes', NULL, 'flsCustomers', 'systems/fls/', 'PV', 'icon icon-users', '#fcc54e', 0, 'components/flsCustomers.js', 'assets/css/dist/flsCustomers.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1300, 'Dashboard Boletería', NULL, 'tickets', 'systems/tickets/', 'TKS', 'icon icon-dashboard', '#fcc54e', 0, 'components/tickets.js', 'assets/css/dist/tickets.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1301, 'Eventos', NULL, 'ticketingEvents', 'systems/tickets/', 'EVTKS', 'icon icon-tag', '#fcc54e', 0, 'components/ticketingEvents.js', 'assets/css/dist/ticketingEvents.min.css', 'mod_events', 'mod_eve_', '', 1);
INSERT INTO `modules` VALUES (1600, 'Dashboard LMS', NULL, 'lms', 'systems/lms/', 'ADS1', 'icon icon-dashboard', '#8900ff', 0, 'components/lms.js', 'assets/css/dist/lms.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1601, 'Plan de Estudios', NULL, 'syllabus', 'systems/lms/', 'SB1', 'icon icon-category-r', '#8900ff', 0, 'components/syllabus.js', 'assets/css/dist/syllabus.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1900, 'Dashboard CRM', NULL, 'crm', 'systems/crm/', 'CRM1', 'icon icon-dashboard', '#8900ff', 0, 'components/crm.js', 'assets/css/dist/crm.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1901, 'Contactos', NULL, 'contacts', 'systems/crm/', 'CNT1', 'icon icon-user-plus', '#3b82f6', 0, 'components/contacts.js', 'assets/css/dist/contacts.min.css', 'mod_contacts', 'mod_con_', '', 1);
INSERT INTO `modules` VALUES (1902, 'Clientes', NULL, 'customersCrm', 'systems/crm/', 'CS1', 'icon icon-folder-open', '#8900ff', 0, 'components/customersCrm.js', 'assets/css/dist/customersCrm.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1903, 'Suscripciones', NULL, 'suscriptionsCrm', 'systems/crm/', 'SC1', 'icon icon-bell', '#99C144', 0, 'components/subscriptionsCrm.js', 'assets/css/dist/suscriptionsCrm.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1904, 'Ventas', 'Gestión de oportunidades y pipeline comercial', 'salesCrm', 'systems/crm/', 'CRM4', 'icon icon-sales', '#ef4444', 0, 'components/salesCrm.js', 'assets/css/dist/salesCrm.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (1905, 'Contratos', 'Gestión y seguimiento de contratos comerciales', 'contractsCrm', 'systems/crm/', 'CRM5', 'icon icon-doc', '#f59e0b', 0, 'components/contractsCrm.js', 'assets/css/dist/contractsCrm.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (2000, 'Dashboard', NULL, 'restaurants', 'systems/restaurants/', 'RST1', 'icon icon-dashboard', '#8900ff', 0, 'components/restaurants.js', 'assets/css/dist/restaurants.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (2001, 'Ordenes', NULL, 'commands', 'systems/restaurants/', 'CS1', 'icon icon-command', '#8900ff', 0, 'components/commands.js', 'assets/css/dist/commands.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (2300, 'Dashboard Deportes', NULL, 'sports', 'systems/sports/', 'GEO-1', 'icon icon-dashboard', '#ff9040', 0, 'components/sports.js', 'assets/css/dist/sports.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (2301, 'Futbol', NULL, 'futbol', 'systems/sports/', 'GEO-2', 'icon icon-futbol', '#E74745', 0, 'components/futbol.js', 'assets/css/dist/futbol.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (2400, 'Dashboard Concursos', NULL, 'competitions', 'systems/competitions/', 'GEO-1', 'icon icon-dashboard', '#ff9040', 0, 'components/competitions.js', 'assets/css/dist/competitions.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3700, 'Dashboard', NULL, 'app_tributo', 'systems/app_tributo/', 'TAPP-1', 'icon icon-dashboard', '#E74745', 0, 'components/app_tributo.js', 'assets/css/dist/app_tributo.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3701, 'Selección', NULL, 'app_tributo_selection', 'systems/app_tributo/', 'TAPP-2', 'icon icon-tag', '#E74745', 0, 'components/app_tributo_selection.js', 'assets/css/dist/app_tributo_selection.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3702, 'Clientes', NULL, 'app_tributo_clients', 'systems/app_tributo/', 'TAPP-3', 'icon icon-users', '#E74745', 0, 'components/app_tributo_clients.js', 'assets/css/dist/app_tributo_clients.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3800, 'Dashboard Finance', 'Panel principal de gestión financiera y contabilidad', 'finance', 'systems/finance/', 'FIN-1', 'icon icon-dashboard', '#10b981', 0, 'components/finance.js', 'assets/css/dist/finance.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3801, 'Cuentas Contables', 'Catálogo de cuentas contables (Chart of Accounts)', 'glAccounts', 'systems/finance/', 'FIN-2', 'icon icon-category', '#10b981', 0, 'components/glAccounts.js', 'assets/css/dist/glAccounts.min.css', 'mod_gl_accounts', 'mod_gl_', '', 1);
INSERT INTO `modules` VALUES (3802, 'Transacciones', 'Registro de transacciones y asientos contables', 'glTransactions', 'systems/finance/', 'FIN-3', 'icon icon-table-check', '#10b981', 0, 'components/glTransactions.js', 'assets/css/dist/glTransactions.min.css', 'mod_gl_transactions', 'mod_gt_', '', 1);
INSERT INTO `modules` VALUES (3803, 'Contabilidad', 'Contabilidad general: asientos contables y reportes financieros', 'glAccounting', 'systems/finance/', 'FIN-4', 'icon icon-doc', '#10b981', 0, 'components/glAccounting.js', 'assets/css/dist/glAccounting.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3900, 'Dashboard', NULL, 'rems', 'systems/rems/', 'RAPP-1', 'icon icon-dashboard', '#E74745', 0, 'components/rems.js', 'assets/css/dist/rems.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3901, 'Proyectos', NULL, 'rems_projects', 'systems/rems/', 'PAPP-2', 'icon icon-operations', '#E74745', 0, 'components/rems_projects.js', 'assets/css/dist/rems_projects.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3902, 'Lotes', NULL, 'rems_lots', 'systems/rems/', 'LAPP-2', 'icon icon-blocks', '#E74745', 0, 'components/rems_lots.js', 'assets/css/dist/rems_lots.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3903, 'Fases', NULL, 'rems_phases', 'systems/rems/', 'FAPP-2', 'icon icon-list', '#E74745', 0, 'components/rems_phases.js', 'assets/css/dist/rems_phases.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3904, 'Contactos', NULL, 'rems_contacts', 'systems/rems/', 'CAPP-3', 'icon icon-users', '#E74745', 0, 'components/rems_contacts.js', 'assets/css/dist/rems_contacts.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3905, 'Documentos', NULL, 'rems_documents', 'systems/rems/', 'DAPP-4', 'icon icon-folder', '#E74745', 0, 'components/rems_documents.js', 'assets/css/dist/rems_documents.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3906, 'Configuración REMS x', 'Gestión de tipos de documentos, categorías y configuración general del módulo REMS', 'remsConfig', 'systems/rems/', 'CONFAPP-6', 'icon icon-conf', '#E74745', 0, 'components/rems_config.js', 'assets/css/dist/rems_config.min.css', 'rems', '', '', 1);
INSERT INTO `modules` VALUES (3907, 'Leads', NULL, 'rems_leads', 'systems/rems/', 'LEAPP-6', 'icon icon-user', '#E74745', 0, 'components/rems_leads.js', 'assets/css/dist/rems_leads.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3908, 'Propiedades', NULL, 'rems_properties', 'systems/rems/', 'PROAPP-7', 'icon icon-fixed-assets', '#E74745', 0, 'components/rems_properties.js', 'assets/css/dist/rems_properties.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3909, 'Unidades', NULL, 'rems_units', 'systems/rems/', 'UNAPP-8', 'icon icon-checked', '#E74745', 0, 'components/rems_units.js', 'assets/css/dist/rems_units.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3910, 'Reservas', NULL, 'rems_reservations', 'systems/rems/', 'RESAPP-9', 'icon icon-tag', '#E74745', 0, 'components/rems_reservations.js', 'assets/css/dist/rems_reservations.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3911, 'Ventas', NULL, 'rems_sales', 'systems/rems/', 'SAAPP-10', 'icon icon-cash-register', '#E74745', 0, 'components/rems_sales.js', 'assets/css/dist/rems_sales.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3912, 'Transferencias', NULL, 'rems_property_transfers', 'systems/rems/', 'TRAPP-11', 'icon icon-sort', '#E74745', 0, 'components/rems_property_transfers.js', 'assets/css/dist/rems_property_transfers.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3913, 'Incidentes', NULL, 'rems_incidents', 'systems/rems/', 'INCAPP-12', 'icon icon-square-minus', '#E74745', 0, 'components/rems_incidents.js', 'assets/css/dist/rems_incidents.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3914, 'Pagos', NULL, 'rems_payments', 'systems/rems/', 'PAYAPP-13', 'icon icon-coin', '#E74745', 0, 'components/rems_payments.js', 'assets/css/dist/rems_payments.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3915, 'Reportes', NULL, 'rems_reports', 'systems/rems/', 'REPAPP-10', 'icon icon-doc', '#E74745', 0, 'components/rems_reports.js', 'assets/css/dist/rems_reports.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3916, 'Configuración', NULL, 'rems_config', 'systems/rems/', 'CONFAPP-11', 'icon icon-settings', '#E74745', 0, 'components/rems_config.js', 'assets/css/dist/rems_config.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (3917, 'Cobranza', 'Control de cobranza: contratos, cuotas, pagos y cuenta corriente', 'rems_cobranza', 'systems/rems/', 'COBAPP-14', 'icon icon-coin', '#E74745', 0, 'components/rems_cobranza.js', 'assets/css/dist/rems_cobranza.min.css', 'mod_rems_cob_contracts', 'mod_rems_cob_', '', 1);
INSERT INTO `modules` VALUES (4000, 'Dashboard PIM', 'Panel de gestión de información de productos', 'pim', 'systems/pim/', 'PIM-1', 'icon icon-dashboard', '#f59e0b', 0, 'components/pim.js', 'assets/css/dist/pim.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4001, 'Productos', 'Catálogo de productos base (entidad lógica)', 'pimProducts', 'systems/pim/', 'PIM-3', 'icon icon-box', '#f59e0b', 0, 'components/pimProducts.js', 'assets/css/dist/pimProducts.min.css', 'mod_pim_products', 'mod_pp_', '', 1);
INSERT INTO `modules` VALUES (4002, 'Colecciones', 'Gestión de colecciones de productos', 'pimCollections', 'systems/pim/', 'PIM-2', 'icon icon-tag', '#f59e0b', 0, 'components/pimCollections.js', 'assets/css/dist/pimCollections.min.css', 'mod_pim_collections', 'mod_pcol_', '', 1);
INSERT INTO `modules` VALUES (4003, 'SKUs', 'Variantes de producto - Unidad transaccional/inventario', 'pimSkus', 'systems/pim/', 'PIM-4', 'icon icon-tag', '#f59e0b', 0, 'components/pimSkus.js', 'assets/css/dist/pimSkus.min.css', 'mod_pim_skus', 'mod_ps_', '', 1);
INSERT INTO `modules` VALUES (4100, 'Dashboard WMS', 'Panel de gestión de almacenes e inventario', 'wms', 'systems/wms/', 'WMS-1', 'icon icon-dashboard', '#06b6d4', 0, 'components/wms.js', 'assets/css/dist/wms.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4101, 'Almacenes', 'Maestro de almacenes y centros de distribución', 'warehouses', 'systems/wms/', 'WMS-2', 'icon icon-warehouse', '#06b6d4', 0, 'components/warehouses.js', 'assets/css/dist/warehouses.min.css', 'mod_wms_warehouses', 'mod_ww_', '', 1);
INSERT INTO `modules` VALUES (4102, 'Stock', 'Balance de inventario por SKU y ubicación', 'wmsStock', 'systems/wms/', 'WMS-3', 'icon icon-box', '#06b6d4', 0, 'components/wmsStock.js', 'assets/css/dist/wmsStock.min.css', 'mod_wms_stock', 'mod_ws_', '', 1);
INSERT INTO `modules` VALUES (4200, 'Dashboard OMS', 'Panel de gestión de órdenes y fulfillment', 'oms', 'systems/oms/', 'OMS-1', 'icon icon-dashboard', '#ef4444', 0, 'components/oms.js', 'assets/css/dist/oms.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4201, 'Órdenes', 'Gestión de órdenes de cliente (cabecera y detalle)', 'orders', 'systems/oms/', 'OMS-2', 'icon icon-sales', '#ef4444', 0, 'components/orders.js', 'assets/css/dist/orders.min.css', 'mod_oms_orders', 'mod_oo_', '', 1);
INSERT INTO `modules` VALUES (4202, 'Fulfillments', 'Unidades de cumplimiento y asignación de almacenes', 'fulfillments', 'systems/oms/', 'OMS-3', 'icon icon-box', '#ef4444', 0, 'components/fulfillments.js', 'assets/css/dist/fulfillments.min.css', 'mod_oms_fulfillments', 'mod_of_', '', 1);
INSERT INTO `modules` VALUES (4203, 'Envíos', 'Tracking de envíos y gestión de paquetería', 'shipments', 'systems/oms/', 'OMS-4', 'icon icon-pointer', '#ef4444', 0, 'components/shipments.js', 'assets/css/dist/shipments.min.css', 'mod_oms_shipments', 'mod_os_', '', 1);
INSERT INTO `modules` VALUES (4204, 'Devoluciones', 'Gestión de devoluciones y reembolsos', 'returns', 'systems/oms/', 'OMS-5', 'icon icon-return', '#ef4444', 0, 'components/returns.js', 'assets/css/dist/returns.min.css', 'mod_oms_returns', 'mod_or_', '', 1);
INSERT INTO `modules` VALUES (4300, 'Dashboard FSS', 'Panel de liquidación financiera a vendedores', 'fss', 'systems/fss/', 'FSS-1', 'icon icon-dashboard', '#14b8a6', 0, 'components/fss.js', 'assets/css/dist/fss.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4301, 'Pagos a Vendors', 'Transferencias y liquidaciones a vendedores', 'payouts', 'systems/fss/', 'FSS-2', 'icon icon-coin', '#14b8a6', 0, 'components/payouts.js', 'assets/css/dist/payouts.min.css', 'mod_fss_payouts', 'mod_fp_', '', 1);
INSERT INTO `modules` VALUES (4400, 'Dashboard CCM', 'Panel de gestión de clientes y comunicación', 'ccm', 'systems/ccm/', 'CCM-1', 'icon icon-dashboard', '#ec4899', 0, 'components/ccm.js', 'assets/css/dist/ccm.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4401, 'Reseñas', 'Reseñas y ratings de productos por clientes', 'reviews', 'systems/ccm/', 'CCM-2', 'icon icon-star', '#ec4899', 0, 'components/reviews.js', 'assets/css/dist/reviews.min.css', 'mod_ccm_reviews', 'mod_cr_', '', 1);
INSERT INTO `modules` VALUES (4402, 'Tickets Soporte', 'Sistema de tickets y atención al cliente', 'supportTickets', 'systems/ccm/', 'CCM-3', 'icon icon-tag', '#ec4899', 0, 'components/supportTickets.js', 'assets/css/dist/supportTickets.min.css', 'mod_ccm_tickets', 'mod_ct_', '', 1);
INSERT INTO `modules` VALUES (4500, 'Dashboard BI', 'Panel de análisis y business intelligence', 'bi', 'systems/bi/', 'BI-1', 'icon icon-dashboard', '#6366f1', 0, 'components/bi.js', 'assets/css/dist/bi.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4501, 'Dimensiones', 'Dimensiones de tiempo, vendedores y clientes', 'biDimensions', 'systems/bi/', 'BI-2', 'icon icon-category', '#6366f1', 0, 'components/biDimensions.js', 'assets/css/dist/biDimensions.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4502, 'Ventas Analytics', 'Análisis de ventas, GMV y métricas del marketplace', 'biSales', 'systems/bi/', 'BI-3', 'icon icon-table-check', '#6366f1', 0, 'components/biSales.js', 'assets/css/dist/biSales.min.css', 'mod_bi_fact_sales', 'mod_bfs_', '', 1);
INSERT INTO `modules` VALUES (4600, 'Dashboard VMS', 'Panel de gestión de vendedores del marketplace', 'vms', 'systems/vms/', 'VMS-1', 'icon icon-dashboard', '#8b5cf6', 0, 'components/vms.js', 'assets/css/dist/vms.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4601, 'Vendedores', 'Registro y gestión de vendedores (Vendors)', 'vendors', 'systems/vms/', 'VMS-2', 'icon icon-users', '#8b5cf6', 0, 'components/vendors.js', 'assets/css/dist/vendors.min.css', 'mod_vms_vendors', 'mod_vv_', '', 1);
INSERT INTO `modules` VALUES (4602, 'Comisiones', 'Reglas y cálculo de comisiones del marketplace', 'commissionRules', 'systems/vms/', 'VMS-3', 'icon icon-coin', '#8b5cf6', 0, 'components/commissionRules.js', 'assets/css/dist/commissionRules.min.css', 'mod_vms_commission_rules', 'mod_vcr_', '', 1);
INSERT INTO `modules` VALUES (4700, 'Dashboard Administración y Finanzas', 'Panel principal administrativo y financiero', 'adminFinance', 'systems/admin_finance/', 'AF-1', 'icon icon-dashboard', '#0ea5e9', 0, 'components/admin_finance.js', 'assets/css/dist/admin_finance.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4701, 'Cobranzas', 'Gestión de cobranza y cuentas por cobrar', 'collections', 'systems/admin_finance/', 'AF-2', 'icon icon-coin', '#0ea5e9', 0, 'components/collections.js', 'assets/css/dist/collections.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4702, 'Pagos', 'Gestión de pagos y movimientos financieros', 'payments', 'systems/admin_finance/', 'AF-3', 'icon icon-cash-register', '#0ea5e9', 0, 'components/payments.js', 'assets/css/dist/payments.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4703, 'Caja', 'Control de caja y arqueos', 'cash', 'systems/admin_finance/', 'AF-4', 'icon icon-wallet', '#0ea5e9', 0, 'components/cash.js', 'assets/css/dist/cash.min.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4800, 'Dashboard PS', 'Panel principal de Project System', 'ps', 'systems/ps/', 'PS-1', 'icon icon-dashboard', '#3b82f6', 0, 'components/ps.js', 'assets/css/dist/ps.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4801, 'Estructura (WBS)', 'Desglose jerárquico del proyecto', 'psWbs', 'systems/ps/', 'PS-2', 'icon icon-category', '#3b82f6', 0, 'components/ps_wbs.js', 'assets/css/dist/ps_wbs.css', '', '', '', 1);
INSERT INTO `modules` VALUES (4802, 'Actividades (Kanban)', 'Tablero de actividades y seguimiento', 'psKanban', 'systems/ps/', 'PS-3', 'icon icon-kanban', '#3b82f6', 0, 'components/ps_kanban.js', 'assets/css/dist/ps_kanban.css', '', '', '', 1);
COMMIT;

-- ----------------------------
-- Table structure for modules_categorys
-- ----------------------------
CREATE TABLE `modules_categorys` (
  `mod_cat_mod_id` int NOT NULL COMMENT 'ID de cat mod',
  `mod_cat_cat_id` int NOT NULL COMMENT 'ID de cat cat',
  `mod_cat_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `mod_cat_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`mod_cat_mod_id`,`mod_cat_cat_id`,`mod_cat_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of modules_categorys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notifications
-- ----------------------------
CREATE TABLE `notifications` (
  `ntf_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del registro',
  `ntf_recipient_id` int NOT NULL COMMENT 'Id del destinatario',
  `ntf_recipient_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Tipo de destinatario (customer,provider)',
  `ntf_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de ntf message',
  `ntf_sent_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Valor de ntf sent at',
  `ntf_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'pending,send,delivered' COMMENT 'Estado del proceso',
  `ntf_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `ntf_custom_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de ntf custom data',
  `ntf_class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de ntf class',
  `ntf_custom_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ID de custom',
  `ntf_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`ntf_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of notifications
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for options
-- ----------------------------
CREATE TABLE `options` (
  `option_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del registro',
  `option_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Nombre del registro',
  `option_value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de option value',
  `autoload` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'yes' COMMENT 'Valor de autoload',
  PRIMARY KEY (`option_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of options
-- ----------------------------
BEGIN;
INSERT INTO `options` VALUES (1, 'site_title', 'Ion', 'yes');
INSERT INTO `options` VALUES (2, 'site_favicon', 'ion/assets/img/favicon.png', 'yes');
INSERT INTO `options` VALUES (3, 'site_img', 'ion/assets/img/logo.svg', 'yes');
INSERT INTO `options` VALUES (4, 'site_version', '54278', 'yes');
INSERT INTO `options` VALUES (5, 'user_id_default', '3', 'yes');
INSERT INTO `options` VALUES (6, 'bearer_token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI3MjM0OTIzODczNDkiLCJuYW1lIjoibnVjbGVvIiwiaWF0Ijo5MzI0MjQzNDl9.jIsiHIdOGa-KHCJ2mUhLLKqlvTYVLolUyrp1HM6E7Cs-gedeon', 'yes');
INSERT INTO `options` VALUES (7, 'client_id', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9-gedeon', 'yes');
INSERT INTO `options` VALUES (8, 'client_secret', 'eyJzdWIiOiI3MjM0OTIzODczNDkiLCJuYW1lIjoibnVjbGVvIiwiaWF0Ijo5MzI0MjQzNDl9-gedeon', 'yes');
INSERT INTO `options` VALUES (9, 'locale', 'es_ES', 'yes');
INSERT INTO `options` VALUES (10, 'timezone', 'America/La_Paz', 'yes');
INSERT INTO `options` VALUES (12, 'site-meta', 'sites/default/controllers/pub/meta.pub.php', 'yes');
INSERT INTO `options` VALUES (13, 'entitie_id_default', '1', 'yes');
INSERT INTO `options` VALUES (14, 'dashboard_img', 'assets/img/logo.svg', 'yes');
INSERT INTO `options` VALUES (15, 'dashboard_favicon', 'assets/img/favicon.png', 'yes');
INSERT INTO `options` VALUES (16, 'dashboard_brand', 'assets/img/logo.svg', 'yes');
INSERT INTO `options` VALUES (17, 'path_icons_pub', 'ion/assets/img/pubs', 'yes');
INSERT INTO `options` VALUES (18, 'dial_code_default', '+591', 'yes');
INSERT INTO `options` VALUES (19, 'country', 'bo', 'yes');
INSERT INTO `options` VALUES (20, 'cron', '', 'yes');
INSERT INTO `options` VALUES (21, 'path_activation', '{{_PATH_WEB}}activation', 'yes');
INSERT INTO `options` VALUES (22, 'callback', '', 'yes');
INSERT INTO `options` VALUES (23, 'footer', 'Nucleo v1.0', 'yes');
INSERT INTO `options` VALUES (24, 'path_resetpw', '{{_PATH_WEB}}pages/reserpassword.php', 'yes');
INSERT INTO `options` VALUES (26, 'path_logo', '{{_PATH_WEB_NUCLEO}}assets/img/logo.png', 'yes');
INSERT INTO `options` VALUES (27, 'currencies', '[{\"code\":\"USD\",\"name\":\"Dólar\"},{\"code\":\"PYG\",\"name\":\"Guaraní\"},{\"code\":\"BOB\",\"name\":\"Boliviano\"},{\"code\":\"ARS\",\"name\":\"Peso Argentino\"},{\"code\":\"BRL\",\"name\":\"Real Brasileño\"}]', 'yes');
INSERT INTO `options` VALUES (28, 'currency_default', 'USD', 'yes');
COMMIT;

-- ----------------------------
-- Table structure for posts
-- ----------------------------
CREATE TABLE `posts` (
  `post_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del registro',
  `post_title` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post title',
  `post_pathurl` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta URL del recurso',
  `post_shortlink` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post shortlink',
  `post_tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post tags',
  `post_review` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de post review',
  `post_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT 'Valor de post img',
  `post_img_ref` varchar(445) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post img ref',
  `post_embed` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de post embed',
  `post_preview_embed` int DEFAULT '0' COMMENT 'Valor de post preview embed',
  `post_intern_embed` int DEFAULT '0' COMMENT 'Valor de post intern embed',
  `post_video` int DEFAULT '0' COMMENT 'Valor de post video',
  `post_preview_video` int DEFAULT '0' COMMENT 'Valor de post preview video',
  `post_intern_video` int DEFAULT '0' COMMENT 'Valor de post intern video',
  `post_body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de post body',
  `post_place` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de post place',
  `post_author` int DEFAULT NULL COMMENT 'Valor de post author',
  `post_cls` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post cls',
  `post_top_relations` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post top relations',
  `post_middle_relations` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post middle relations',
  `post_last_relations` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de post last relations',
  `post_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `post_date` datetime DEFAULT NULL COMMENT 'Fecha del registro',
  `post_register_date` datetime NOT NULL COMMENT 'Fecha de registro',
  `post_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `post_user_id` int DEFAULT NULL COMMENT 'ID del usuario',
  `post_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`post_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of posts
-- ----------------------------
BEGIN;
INSERT INTO `posts` VALUES (1, 'Ci Hermany 2', 'ci-hermany-2', NULL, 'tag', 'resumen', '18', '', '', 0, 0, 0, 0, 0, '<p>contenido</p>', '', 0, '', '', '', '', '', '2026-01-09 10:00:28', '2026-01-09 10:02:01', 1, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for posts_authors
-- ----------------------------
CREATE TABLE `posts_authors` (
  `post_au_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de au',
  `post_au_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `post_au_summary` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de post au summary',
  `post_au_img` int DEFAULT '0' COMMENT 'Valor de post au img',
  `post_au_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `post_au_contact` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de post au contact',
  `post_au_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta del recurso',
  `post_au_state` int NOT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`post_au_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of posts_authors
-- ----------------------------
BEGIN;
INSERT INTO `posts_authors` VALUES (1, '', '', 0, 1, '', '', 1);
COMMIT;

-- ----------------------------
-- Table structure for posts_categorys
-- ----------------------------
CREATE TABLE `posts_categorys` (
  `post_cat_post_id` int NOT NULL COMMENT 'ID de cat post',
  `post_cat_cat_id` int NOT NULL COMMENT 'ID de cat cat',
  `post_cat_ent_id` int DEFAULT NULL COMMENT 'ID de la entidad',
  `post_cat_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`post_cat_post_id`,`post_cat_cat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of posts_categorys
-- ----------------------------
BEGIN;
INSERT INTO `posts_categorys` VALUES (1, 5, 1, 0);
COMMIT;

-- ----------------------------
-- Table structure for posts_files
-- ----------------------------
CREATE TABLE `posts_files` (
  `post_file_post_id` int NOT NULL COMMENT 'ID de file post',
  `post_file_file_id` int NOT NULL COMMENT 'ID de file file',
  `post_file_order` int DEFAULT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`post_file_post_id`,`post_file_file_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of posts_files
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for publications
-- ----------------------------
CREATE TABLE `publications` (
  `pub_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del registro',
  `pub_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `pub_description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Descripción del registro',
  `pub_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de pub title',
  `pub_summary` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de pub summary',
  `pub_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta del recurso',
  `pub_path_ui` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de pub path ui',
  `pub_path_icon` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de pub path icon',
  `pub_icon` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de pub icon',
  `pub_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Tipo de registro',
  `pub_class` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de pub class',
  `pub_attr_id` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'ID de attr',
  `pub_attr` varchar(445) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Valor de pub attr',
  `pub_count` int DEFAULT NULL COMMENT 'Valor de pub count',
  `pub_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `pub_html` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Valor de pub html',
  `pub_state` int DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`pub_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of publications
-- ----------------------------
BEGIN;
INSERT INTO `publications` VALUES (7, 'Nav', 'Barra de Navegación de la página', '', '', 'sites/default/controllers/pub/nav.pub.php', '', 'sites/default/assets/img/pubs/nav.pub.svg', '', 'host', 'pub-nav', '', '', 1, '', '', 1);
INSERT INTO `publications` VALUES (8, 'home', '', '', '', 'sites/default/controllers/pub/home.pub.php', '', '', '', 'host', 'pub-home', '', '', 1, '', '', 1);
INSERT INTO `publications` VALUES (9, 'map', '', '', '', 'sites/default/controllers/pub/map.pub.php', '', '', '', 'host', 'pub-map', '', '', 1, '', '', 1);
COMMIT;

-- ----------------------------
-- Table structure for publications_pattern
-- ----------------------------
CREATE TABLE `publications_pattern` (
  `pub_pat_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de pat',
  `pub_pat_name` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del registro',
  `pub_pat_description` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Descripción del registro',
  `pub_pat_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Datos adicionales en formato JSON',
  `pub_pat_ent_id` int DEFAULT '0' COMMENT 'ID de la entidad',
  `pub_pat_order` int DEFAULT '0' COMMENT 'Orden de visualización',
  `pub_pat_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`pub_pat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of publications_pattern
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for publications_relations
-- ----------------------------
CREATE TABLE `publications_relations` (
  `pub_rel_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de rel',
  `pub_rel_cat_id` int DEFAULT NULL COMMENT 'ID de rel cat',
  `pub_rel_ws_id` int DEFAULT NULL COMMENT 'ID de rel ws',
  `pub_rel_block_id` int DEFAULT NULL COMMENT 'ID de rel block',
  `pub_rel_pub_id` int DEFAULT NULL COMMENT 'ID de rel pub',
  `pub_rel_state` int NOT NULL DEFAULT '1' COMMENT 'Estado del registro',
  `pub_rel_order` int NOT NULL DEFAULT '0' COMMENT 'Orden de visualización',
  PRIMARY KEY (`pub_rel_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of publications_relations
-- ----------------------------
BEGIN;
INSERT INTO `publications_relations` VALUES (1, 1, 1, 1, 7, 1, 1);
INSERT INTO `publications_relations` VALUES (2, 1, 1, 2, 8, 1, 1);
INSERT INTO `publications_relations` VALUES (3, 6, 1, 2, 9, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for roles
-- ----------------------------
CREATE TABLE `roles` (
  `rol_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del registro',
  `rol_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `rol_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Descripción del registro',
  `rol_parent_id` int DEFAULT NULL COMMENT 'ID de parent',
  `rol_redirection_url` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ruta URL del recurso',
  `rol_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `rol_state` int DEFAULT '0' COMMENT 'Estado del registro',
  `rol_is_system` tinyint NOT NULL DEFAULT '0' COMMENT '1 = rol built-in, no puede ser eliminado por UI',
  `rol_config_sections` int NOT NULL DEFAULT '0' COMMENT 'Bitmask de secciones del config admin accesibles. Ver tabla de bits abajo.',
  PRIMARY KEY (`rol_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of roles
-- ----------------------------
BEGIN;
INSERT INTO `roles` VALUES (1, 'Super Administrador', NULL, 0, '{_PATH_WEB}dashboard', NULL, 1, 1, 127);
INSERT INTO `roles` VALUES (2, 'Administrador', NULL, 1, '{_PATH_WEB}dashboard', NULL, 1, 1, 41);
INSERT INTO `roles` VALUES (3, 'Administrador de Entidad', NULL, 2, '{_PATH_WEB}dashboard', NULL, 1, 1, 40);
INSERT INTO `roles` VALUES (4, 'Administrador RRHH', NULL, 2, '{_PATH_WEB}dashboard', NULL, 1, 0, 0);
INSERT INTO `roles` VALUES (10, 'Encargado de Contabilidad', NULL, 2, '{_PATH_WEB}dashboard', NULL, 1, 0, 0);
INSERT INTO `roles` VALUES (5, 'Jefe de Inventario', NULL, 2, '{_PATH_WEB}dashboard', NULL, 1, 0, 0);
INSERT INTO `roles` VALUES (6, 'Digitador', NULL, 2, '{_PATH_WEB}dashboard', NULL, 1, 0, 0);
INSERT INTO `roles` VALUES (11, 'Encargado de Ventas', NULL, 2, '{_PATH_WEB}dashboard', NULL, 0, 0, 0);
INSERT INTO `roles` VALUES (12, 'Encargado de Mantenimiento\r\n', NULL, 2, '{_PATH_WEB}dashboard', NULL, 0, 0, 0);
COMMIT;

-- ----------------------------
-- Table structure for roles_categorys
-- ----------------------------
CREATE TABLE `roles_categorys` (
  `rol_cat_rol_id` int NOT NULL COMMENT 'ID de cat rol',
  `rol_cat_cat_id` int NOT NULL COMMENT 'ID de cat cat',
  `rol_cat_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`rol_cat_rol_id`,`rol_cat_cat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of roles_categorys
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for roles_entities
-- ----------------------------
CREATE TABLE `roles_entities` (
  `rol_ent_rol_id` int NOT NULL COMMENT 'ID de ent rol',
  `rol_ent_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `rol_ent_state` int DEFAULT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`rol_ent_rol_id`,`rol_ent_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of roles_entities
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for roles_modules
-- ----------------------------
CREATE TABLE `roles_modules` (
  `rol_mod_rol_id` int NOT NULL COMMENT 'ID de mod rol',
  `rol_mod_mod_id` int NOT NULL COMMENT 'ID de mod mod',
  `rol_mod_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `rol_mod_order` int NOT NULL COMMENT 'Orden de visualización',
  `rol_mod_permits` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0,0,0,0,0,0,0' COMMENT 'Ver,Agregar,Editar,Eliminar,Aprobar,Exportar,Configurar (7 bits ERP) — o Ver,Publicar,Agregar,Editar,Eliminar (5 bits CMS)',
  `rol_mod_permits_schema` enum('cms','erp') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'cms' COMMENT 'Esquema de etiquetas para los bits de permisos: cms=5bits, erp=7bits',
  PRIMARY KEY (`rol_mod_mod_id`,`rol_mod_rol_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of roles_modules
-- ----------------------------
BEGIN;
INSERT INTO `roles_modules` VALUES (5, 500, 1, 1, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (6, 500, 1, 0, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (7, 500, 1, 0, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (5, 501, 1, 1, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (6, 501, 1, 0, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (7, 501, 1, 1, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (10, 1000, 1, 1, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (10, 1001, 1, 1, '0,0,0,0,0', 'cms');
INSERT INTO `roles_modules` VALUES (1, 3906, 1, 99, '1,1,1,1,0,0,1', 'cms');
INSERT INTO `roles_modules` VALUES (2, 3906, 1, 99, '1,1,1,0,0,0,1', 'cms');
INSERT INTO `roles_modules` VALUES (3, 3906, 1, 99, '1,0,0,0,0,0,1', 'cms');
COMMIT;

-- ----------------------------
-- Table structure for roles_sites
-- ----------------------------
CREATE TABLE `roles_sites` (
  `rol_site_rol_id` int NOT NULL COMMENT 'ID del rol',
  `rol_site_site_id` int NOT NULL COMMENT 'ID del sitio',
  `rol_site_order` int NOT NULL COMMENT 'Orden del rol en el sitio',
  PRIMARY KEY (`rol_site_rol_id`,`rol_site_site_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of roles_sites
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for roles_systems
-- ----------------------------
CREATE TABLE `roles_systems` (
  `rol_sys_rol_id` int NOT NULL COMMENT 'ID de sys rol',
  `rol_sys_sys_id` int NOT NULL COMMENT 'ID de sys sys',
  `rol_sys_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `rol_sys_order` int DEFAULT '0' COMMENT 'Orden de visualización',
  PRIMARY KEY (`rol_sys_rol_id`,`rol_sys_sys_id`,`rol_sys_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of roles_systems
-- ----------------------------
BEGIN;
INSERT INTO `roles_systems` VALUES (2, 6, 1, 0);
INSERT INTO `roles_systems` VALUES (5, 6, 1, 1);
INSERT INTO `roles_systems` VALUES (6, 6, 1, 2);
INSERT INTO `roles_systems` VALUES (7, 6, 1, 0);
INSERT INTO `roles_systems` VALUES (10, 5, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for sites
-- ----------------------------
CREATE TABLE `sites` (
  `site_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID único del sitio',
  `site_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre descriptivo del sitio',
  `site_path_web` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL completa del sitio (ej: https://example.com/)',
  `site_path_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Ruta física del servidor (ej: /var/www/html/)',
  `site_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Título del sitio para SEO y navegador',
  `site_head` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Código HTML personalizado para la sección <head>',
  `site_head_path_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL del archivo head externo',
  `site_default` int NOT NULL DEFAULT '0' COMMENT 'Indica si es el sitio por defecto (0=No, 1=Sí)',
  `site_created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha de creación del sitio',
  `site_updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Última actualización del sitio',
  `site_ent_id` int NOT NULL DEFAULT '0' COMMENT 'ID de la entidad propietaria del sitio',
  `site_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del sitio (0=Inactivo, 1=Activo, 2=Mantenimiento, 3=Suspendido)',
  PRIMARY KEY (`site_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of sites
-- ----------------------------
BEGIN;
INSERT INTO `sites` VALUES (1, 'Sitio 1', 'https://dev.wappcom.com/home/site/', '/var/html/', 'Sitio 1', '', '', 0, '2025-12-10 00:24:23', '2025-12-10 00:24:23', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for sites_entities
-- ----------------------------
CREATE TABLE `sites_entities` (
  `site_ent_site_id` int NOT NULL COMMENT 'ID del sitio',
  `site_ent_ent_id` int NOT NULL COMMENT 'ID de la entidad asociada',
  `site_ent_order` int NOT NULL COMMENT 'Orden de la entidad en el sitio',
  PRIMARY KEY (`site_ent_site_id`,`site_ent_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of sites_entities
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for sites_users
-- ----------------------------
CREATE TABLE `sites_users` (
  `site_user_site_id` int NOT NULL COMMENT 'ID del sitio',
  `site_user_user_id` int NOT NULL COMMENT 'ID del usuario',
  `site_user_rol_id` int NOT NULL COMMENT 'ID del rol asignado al usuario en el sitio',
  `site_user_order` int NOT NULL COMMENT 'Orden del usuario en el sitio',
  PRIMARY KEY (`site_user_site_id`,`site_user_user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of sites_users
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for systems
-- ----------------------------
CREATE TABLE `systems` (
  `sys_id` int NOT NULL AUTO_INCREMENT,
  `sys_name` varchar(255) DEFAULT NULL,
  `sys_description` tinytext,
  `sys_pathurl` varchar(500) DEFAULT NULL,
  `sys_path` varchar(500) DEFAULT NULL,
  `sys_mod_default` int NOT NULL DEFAULT '0',
  `sys_code` varchar(11) NOT NULL,
  `sys_icon` varchar(240) DEFAULT NULL,
  `sys_color` varchar(10) DEFAULT NULL,
  `sys_parent_id` int DEFAULT NULL,
  `sys_indexjs` varchar(255) NOT NULL,
  `sys_css` varchar(255) NOT NULL,
  `sys_order` int NOT NULL,
  `sys_state` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`sys_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of systems
-- ----------------------------
BEGIN;
INSERT INTO `systems` VALUES (1, 'CMS', 'Content Management System para sitios web', 'cms', 'systems/cms/', 10, '', 'icon icon-code', '#6F91E9', 0, 'components/cms.js', 'assets/css/dist/cms.css', 1, 1);
INSERT INTO `systems` VALUES (2, 'RRHH', 'Sistema de Recursos Humanos', 'rrhh', 'systems/rrhh/', 200, '', 'icon icon-category', '#6F91E9', 0, 'components/rrhh.js', 'assets/css/dist/rrhh.css', 5, 1);
INSERT INTO `systems` VALUES (6, 'Consejeria', NULL, 'counseling', 'systems/counseling/', 600, '', 'icon icon-users', '#27d27c', 0, 'components/counseling.js', 'assets/css/dist/counseling.css', 4, 1);
INSERT INTO `systems` VALUES (7, 'Ventas', NULL, 'sales', 'systems/sales/', 700, '', 'icon icon-sales', '#fc9835', 0, 'components/sales.js', 'assets/css/dist/sales.css', 22, 0);
INSERT INTO `systems` VALUES (10, 'Suscriptiones', NULL, 'suscriptions', 'core/accounts/', 1000, '', 'icon icon-tag', '#1be5fc', 0, 'components/subscriptions.js', 'assets/css/dist/subscriptions.css', 20, 0);
INSERT INTO `systems` VALUES (12, 'Finalcial Services Leeds', NULL, 'fls', 'systems/fls/', 1200, '', 'icon icon-circle', '#27d27c', 0, 'components/fls.js', 'assets/css/dist/fls.css', 14, 0);
INSERT INTO `systems` VALUES (13, 'Boletería', NULL, 'tickets', 'systems/tickets/', 1300, '', 'icon icon-tag', '#27d27c', 0, 'components/tickets.js', 'assets/css/dist/tickets.min.css', 10, 0);
INSERT INTO `systems` VALUES (16, 'LMS', NULL, 'lms', 'systems/lms/', 1600, '', 'icon icon-graduation', '#FEBF10', 0, 'components/lms.js', 'assets/css/dist/lms.min.css', 17, 0);
INSERT INTO `systems` VALUES (19, 'CRM', 'Customer Relationship Management - Gestión de Relaciones con Clientes', 'crm', 'systems/crm/', 1900, '', 'icon icon-crm', '#ef4848', 0, 'components/crm.js', 'assets/css/dist/crm.min.css', 2, 1);
INSERT INTO `systems` VALUES (20, 'Restaurant', NULL, 'restaurants', 'systems/restaurants/', 2000, '', 'icon icon-restaurant', '#6b6fa9', 0, 'components/restaurants.js', 'assets/css/dist/restaurants.min.css', 19, 0);
INSERT INTO `systems` VALUES (23, 'Deportes', NULL, 'sports', 'systems/sports/', 2200, '', 'icon icon-sport', '#ff7629', 0, 'components/sports.js', 'assets/css/dist/sports.min.css', 13, 0);
INSERT INTO `systems` VALUES (24, 'Concursos', NULL, 'competitions', 'systems/competitions/', 2400, '', 'icon icon-copy', '#ff3333', 0, 'components/competitions.js', 'assets/css/dist/competitions.min.css', 12, 0);
INSERT INTO `systems` VALUES (37, 'Tributo App', NULL, 'app_tributo', 'systems/app_tributo/', 3700, '', 'icon icon-coin', '#003767', 0, 'components/app_tributo.js', 'assets/css/dist/app_tributo.min.css', 21, 1);
INSERT INTO `systems` VALUES (38, 'Finanzas', 'Gestión Financiera y Contabilidad General', 'finance', 'systems/finance/', 3800, '', 'icon icon-coin', '#10b981', 0, 'components/finance.js', 'assets/css/dist/finance.min.css', 15, 0);
INSERT INTO `systems` VALUES (39, 'REMS', 'Real Estate Management System - Gestión de Inmobiliarias y Propiedades', 'rems', 'systems/rems/', 3900, '', 'icon icon-home', '#003900', 0, 'components/rems.js', 'assets/css/dist/rems.min.css', 7, 1);
INSERT INTO `systems` VALUES (40, 'PIM', 'Product Information Management - Gestión de Información de Productos', 'pim', 'systems/pim/', 4000, '', 'icon icon-box', '#f59e0b', 0, 'components/pim.js', 'assets/css/dist/pim.min.css', 3, 1);
INSERT INTO `systems` VALUES (41, 'WMS', 'Warehouse Management System - Gestión de Almacenes e Inventario', 'wms', 'systems/wms/', 4100, '', 'icon icon-checked', '#06b6d4', 0, 'components/wms.js', 'assets/css/dist/wms.min.css', 24, 1);
INSERT INTO `systems` VALUES (42, 'OMS', 'Order Management System - Gestión de Órdenes y Fulfillment', 'oms', 'systems/oms/', 4200, '', 'icon icon-sales', '#ef4444', 0, 'components/oms.js', 'assets/css/dist/oms.min.css', 18, 0);
INSERT INTO `systems` VALUES (43, 'FSS', 'Financial Settlement System - Sistema de Liquidación Financiera', 'fss', 'systems/fss/', 4300, '', 'icon icon-coin', '#14b8a6', 0, 'components/fss.js', 'assets/css/dist/fss.min.css', 16, 0);
INSERT INTO `systems` VALUES (44, 'CCM', 'Customer & Communication Management - Gestión de Clientes y Comunicación', 'ccm', 'systems/ccm/', 4400, '', 'icon icon-users', '#ec4899', 0, 'components/ccm.js', 'assets/css/dist/ccm.min.css', 11, 0);
INSERT INTO `systems` VALUES (45, 'BI Analytics', 'Business Intelligence - Análisis y Reportes', 'bi', 'systems/bi/', 4500, '', 'icon icon-table-check', '#6366f1', 0, 'components/bi.js', 'assets/css/dist/bi.min.css', 9, 0);
INSERT INTO `systems` VALUES (46, 'VMS', 'Vendor Management System - Gestión de Vendedores', 'vms', 'systems/vms/', 4600, '', 'icon icon-users', '#8b5cf6', 0, 'components/vms.js', 'assets/css/dist/vms.min.css', 23, 1);
INSERT INTO `systems` VALUES (47, 'Administración y Finanzas', 'Gestión administrativa y financiera', 'admin-finance', 'systems/admin_finance/', 4700, '', 'icon icon-coin', '#0ea5e9', 0, 'components/admin_finance.js', 'assets/css/dist/admin_finance.min.css', 8, 0);
INSERT INTO `systems` VALUES (48, 'Proyectos', '(PS) Proyect System Gestión estructurada de proyectos', 'ps', 'systems/ps/', 4800, '', 'icon icon-operations', '#3b82f6', 0, 'components/ps.js', 'assets/css/dist/ps.css', 6, 1);
COMMIT;

-- ----------------------------
-- Table structure for systems_modules
-- ----------------------------
CREATE TABLE `systems_modules` (
  `sys_mod_sys_id` int NOT NULL,
  `sys_mod_mod_id` int NOT NULL,
  `sys_mod_ent_id` int NOT NULL,
  `sys_mod_order` int NOT NULL,
  PRIMARY KEY (`sys_mod_sys_id`,`sys_mod_mod_id`,`sys_mod_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of systems_modules
-- ----------------------------
BEGIN;
INSERT INTO `systems_modules` VALUES (1, 10, 1, 1);
INSERT INTO `systems_modules` VALUES (1, 11, 1, 2);
INSERT INTO `systems_modules` VALUES (1, 12, 1, 3);
INSERT INTO `systems_modules` VALUES (1, 13, 1, 4);
INSERT INTO `systems_modules` VALUES (1, 14, 1, 5);
INSERT INTO `systems_modules` VALUES (1, 15, 1, 6);
INSERT INTO `systems_modules` VALUES (1, 16, 1, 7);
INSERT INTO `systems_modules` VALUES (1, 17, 1, 8);
INSERT INTO `systems_modules` VALUES (1, 18, 1, 9);
INSERT INTO `systems_modules` VALUES (1, 19, 1, 10);
INSERT INTO `systems_modules` VALUES (2, 200, 1, 1);
INSERT INTO `systems_modules` VALUES (2, 210, 1, 2);
INSERT INTO `systems_modules` VALUES (2, 220, 1, 3);
INSERT INTO `systems_modules` VALUES (2, 221, 1, 4);
INSERT INTO `systems_modules` VALUES (2, 222, 1, 5);
INSERT INTO `systems_modules` VALUES (2, 223, 1, 6);
INSERT INTO `systems_modules` VALUES (2, 224, 1, 7);
INSERT INTO `systems_modules` VALUES (2, 225, 1, 8);
INSERT INTO `systems_modules` VALUES (2, 226, 1, 9);
INSERT INTO `systems_modules` VALUES (2, 227, 1, 10);
INSERT INTO `systems_modules` VALUES (6, 600, 1, 1);
INSERT INTO `systems_modules` VALUES (6, 601, 1, 2);
INSERT INTO `systems_modules` VALUES (6, 602, 1, 3);
INSERT INTO `systems_modules` VALUES (6, 603, 1, 4);
INSERT INTO `systems_modules` VALUES (7, 700, 1, 1);
INSERT INTO `systems_modules` VALUES (7, 701, 1, 2);
INSERT INTO `systems_modules` VALUES (10, 1000, 1, 1);
INSERT INTO `systems_modules` VALUES (10, 1001, 1, 2);
INSERT INTO `systems_modules` VALUES (10, 1002, 1, 3);
INSERT INTO `systems_modules` VALUES (12, 1200, 1, 1);
INSERT INTO `systems_modules` VALUES (12, 1201, 1, 2);
INSERT INTO `systems_modules` VALUES (13, 1300, 1, 1);
INSERT INTO `systems_modules` VALUES (13, 1301, 1, 2);
INSERT INTO `systems_modules` VALUES (16, 1600, 1, 1);
INSERT INTO `systems_modules` VALUES (16, 1601, 1, 2);
INSERT INTO `systems_modules` VALUES (19, 1900, 1, 1);
INSERT INTO `systems_modules` VALUES (19, 1901, 1, 2);
INSERT INTO `systems_modules` VALUES (19, 1902, 1, 3);
INSERT INTO `systems_modules` VALUES (19, 1903, 1, 4);
INSERT INTO `systems_modules` VALUES (19, 1904, 1, 5);
INSERT INTO `systems_modules` VALUES (19, 1905, 1, 6);
INSERT INTO `systems_modules` VALUES (20, 2000, 1, 1);
INSERT INTO `systems_modules` VALUES (20, 2001, 1, 2);
INSERT INTO `systems_modules` VALUES (23, 2300, 1, 1);
INSERT INTO `systems_modules` VALUES (23, 2301, 1, 2);
INSERT INTO `systems_modules` VALUES (24, 2400, 1, 1);
INSERT INTO `systems_modules` VALUES (37, 3700, 1, 1);
INSERT INTO `systems_modules` VALUES (37, 3701, 1, 2);
INSERT INTO `systems_modules` VALUES (37, 3702, 1, 3);
INSERT INTO `systems_modules` VALUES (37, 3703, 1, 4);
INSERT INTO `systems_modules` VALUES (38, 3800, 1, 1);
INSERT INTO `systems_modules` VALUES (38, 3801, 1, 2);
INSERT INTO `systems_modules` VALUES (38, 3802, 1, 3);
INSERT INTO `systems_modules` VALUES (38, 3803, 1, 4);
INSERT INTO `systems_modules` VALUES (39, 3900, 1, 1);
INSERT INTO `systems_modules` VALUES (39, 3901, 1, 2);
INSERT INTO `systems_modules` VALUES (39, 3902, 1, 3);
INSERT INTO `systems_modules` VALUES (39, 3903, 1, 4);
INSERT INTO `systems_modules` VALUES (39, 3904, 1, 5);
INSERT INTO `systems_modules` VALUES (39, 3905, 1, 6);
INSERT INTO `systems_modules` VALUES (39, 3907, 1, 8);
INSERT INTO `systems_modules` VALUES (39, 3908, 1, 9);
INSERT INTO `systems_modules` VALUES (39, 3909, 1, 10);
INSERT INTO `systems_modules` VALUES (39, 3910, 1, 11);
INSERT INTO `systems_modules` VALUES (39, 3911, 1, 12);
INSERT INTO `systems_modules` VALUES (39, 3912, 1, 13);
INSERT INTO `systems_modules` VALUES (39, 3913, 1, 14);
INSERT INTO `systems_modules` VALUES (39, 3914, 1, 15);
INSERT INTO `systems_modules` VALUES (39, 3915, 1, 16);
INSERT INTO `systems_modules` VALUES (39, 3917, 1, 17);
INSERT INTO `systems_modules` VALUES (40, 4000, 1, 1);
INSERT INTO `systems_modules` VALUES (40, 4001, 1, 2);
INSERT INTO `systems_modules` VALUES (40, 4002, 1, 3);
INSERT INTO `systems_modules` VALUES (40, 4003, 1, 4);
INSERT INTO `systems_modules` VALUES (41, 4100, 1, 1);
INSERT INTO `systems_modules` VALUES (41, 4101, 1, 2);
INSERT INTO `systems_modules` VALUES (41, 4102, 1, 3);
INSERT INTO `systems_modules` VALUES (42, 4200, 1, 1);
INSERT INTO `systems_modules` VALUES (42, 4201, 1, 2);
INSERT INTO `systems_modules` VALUES (42, 4202, 1, 3);
INSERT INTO `systems_modules` VALUES (42, 4203, 1, 4);
INSERT INTO `systems_modules` VALUES (42, 4204, 1, 5);
INSERT INTO `systems_modules` VALUES (43, 4300, 1, 1);
INSERT INTO `systems_modules` VALUES (43, 4301, 1, 2);
INSERT INTO `systems_modules` VALUES (44, 4400, 1, 1);
INSERT INTO `systems_modules` VALUES (44, 4401, 1, 2);
INSERT INTO `systems_modules` VALUES (44, 4402, 1, 3);
INSERT INTO `systems_modules` VALUES (45, 4500, 1, 1);
INSERT INTO `systems_modules` VALUES (45, 4501, 1, 2);
INSERT INTO `systems_modules` VALUES (45, 4502, 1, 3);
INSERT INTO `systems_modules` VALUES (46, 4600, 1, 1);
INSERT INTO `systems_modules` VALUES (46, 4601, 1, 2);
INSERT INTO `systems_modules` VALUES (46, 4602, 1, 3);
INSERT INTO `systems_modules` VALUES (47, 4700, 1, 1);
INSERT INTO `systems_modules` VALUES (47, 4701, 1, 2);
INSERT INTO `systems_modules` VALUES (47, 4702, 1, 3);
INSERT INTO `systems_modules` VALUES (47, 4703, 1, 4);
INSERT INTO `systems_modules` VALUES (48, 4800, 1, 1);
INSERT INTO `systems_modules` VALUES (48, 4801, 1, 2);
INSERT INTO `systems_modules` VALUES (48, 4802, 1, 3);
COMMIT;

-- ----------------------------
-- Table structure for task_permissions_map
-- ----------------------------
CREATE TABLE `task_permissions_map` (
  `tpm_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único',
  `tpm_task` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Nombre del task PHP, e.g. createRol',
  `tpm_context` enum('module','config') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'module' COMMENT 'module = verificar bits en roles_modules | config = verificar rol_config_sections',
  `tpm_mod_id` int DEFAULT NULL COMMENT 'ID del módulo (solo cuando tpm_context=module)',
  `tpm_config_bit` int DEFAULT NULL COMMENT 'Valor del bit en rol_config_sections (solo cuando tpm_context=config)',
  `tpm_permit_bit` tinyint DEFAULT NULL COMMENT '0=Ver,1=Agregar,2=Editar,3=Eliminar,4=Aprobar,5=Exportar,6=Configurar',
  `tpm_state` tinyint NOT NULL DEFAULT '1' COMMENT '1=activo, 0=inactivo',
  PRIMARY KEY (`tpm_id`),
  UNIQUE KEY `uq_task` (`tpm_task`),
  KEY `idx_mod` (`tpm_mod_id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Mapeo de tasks de API a permisos requeridos';

-- ----------------------------
-- Records of task_permissions_map
-- ----------------------------
BEGIN;
INSERT INTO `task_permissions_map` VALUES (1, 'createSystem', 'config', NULL, 2, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (2, 'updateSystem', 'config', NULL, 2, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (3, 'changeStateSystem', 'config', NULL, 2, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (4, 'createSite', 'config', NULL, 4, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (5, 'updateSite', 'config', NULL, 4, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (6, 'changeStateSite', 'config', NULL, 4, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (7, 'createUser', 'config', NULL, 8, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (8, 'updateUser', 'config', NULL, 8, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (9, 'changeStateUser', 'config', NULL, 8, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (10, 'deleteUser', 'config', NULL, 8, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (11, 'getUserFormData', 'config', NULL, 8, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (12, 'createRol', 'config', NULL, 16, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (13, 'updateRol', 'config', NULL, 16, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (14, 'deleteRol', 'config', NULL, 16, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (15, 'changeStateRol', 'config', NULL, 16, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (16, 'getRoleFormData', 'config', NULL, 16, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (17, 'createGroup', 'config', NULL, 32, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (18, 'updateGroup', 'config', NULL, 32, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (19, 'deleteGroup', 'config', NULL, 32, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (20, 'changeStateGroup', 'config', NULL, 32, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (21, 'createDocumentType', 'config', NULL, 64, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (22, 'updateDocumentType', 'config', NULL, 64, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (23, 'deleteDocumentType', 'config', NULL, 64, NULL, 1);
INSERT INTO `task_permissions_map` VALUES (24, 'changeStateDocumentType', 'config', NULL, 64, NULL, 1);
COMMIT;

-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for users_firms
-- ----------------------------
CREATE TABLE `users_firms` (
  `user_firm_id` int NOT NULL AUTO_INCREMENT COMMENT 'ID de firm',
  `user_firm_user_id` int NOT NULL COMMENT 'ID del usuario',
  `user_firm_img` varchar(455) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de user firm img',
  `user_firm_reference` int DEFAULT NULL COMMENT 'Valor de user firm reference',
  `user_firm_md5` int DEFAULT NULL COMMENT 'Valor de user firm md5',
  `user_firm_state` int NOT NULL DEFAULT '0' COMMENT 'Estado del registro',
  PRIMARY KEY (`user_firm_id`,`user_firm_user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of users_firms
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for users_groups
-- ----------------------------
CREATE TABLE `users_groups` (
  `user_group_user_id` int NOT NULL COMMENT 'ID del usuario',
  `user_group_group_id` int NOT NULL COMMENT 'ID de group group',
  `user_group_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `user_group_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`user_group_user_id`,`user_group_group_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of users_groups
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for users_path
-- ----------------------------
CREATE TABLE `users_path` (
  `user_path_user_id` int NOT NULL COMMENT 'ID del usuario',
  `user_path_mod_id` int NOT NULL COMMENT 'ID de path mod',
  `user_path_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Ruta del recurso',
  `user_path_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`user_path_user_id`,`user_path_mod_id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of users_path
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for users_roles
-- ----------------------------
CREATE TABLE `users_roles` (
  `user_rol_user_id` int NOT NULL COMMENT 'ID del usuario',
  `user_rol_rol_id` int NOT NULL COMMENT 'ID de rol rol',
  `user_rol_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `user_rol_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`user_rol_user_id`,`user_rol_rol_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of users_roles
-- ----------------------------
BEGIN;
INSERT INTO `users_roles` VALUES (1, 1, 1, 0);
INSERT INTO `users_roles` VALUES (3, 10, 1, 1);
INSERT INTO `users_roles` VALUES (4, 10, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for users_tabs
-- ----------------------------
CREATE TABLE `users_tabs` (
  `user_tab_user_id` int NOT NULL COMMENT 'ID del usuario',
  `user_tab_sys_id` int NOT NULL COMMENT 'ID de tab sys',
  `user_tab_ent_id` int NOT NULL COMMENT 'ID de la entidad',
  `user_tab_sys_active` int NOT NULL COMMENT 'Valor de user tab sys active',
  `user_tab_start_mod_id` int DEFAULT '0' COMMENT 'ID de tab start mod',
  `user_tab_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Datos adicionales en formato JSON',
  `user_tab_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`user_tab_user_id`,`user_tab_sys_id`,`user_tab_ent_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of users_tabs
-- ----------------------------
BEGIN;
INSERT INTO `users_tabs` VALUES (1, 1, 1, 0, 10, NULL, 7);
INSERT INTO `users_tabs` VALUES (1, 2, 1, 0, 221, NULL, 0);
INSERT INTO `users_tabs` VALUES (1, 6, 1, 0, 601, NULL, 5);
INSERT INTO `users_tabs` VALUES (1, 19, 1, 1, 1901, NULL, 1);
INSERT INTO `users_tabs` VALUES (1, 39, 1, 0, 3905, NULL, 3);
INSERT INTO `users_tabs` VALUES (1, 40, 1, 0, 4001, NULL, 2);
INSERT INTO `users_tabs` VALUES (1, 48, 1, 0, 4801, NULL, 4);
COMMIT;

-- ----------------------------
-- Records of users_tokens
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for worksheets
-- ----------------------------
CREATE TABLE `worksheets` (
  `ws_id` int NOT NULL AUTO_INCREMENT COMMENT 'Identificador único del registro',
  `ws_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Nombre del registro',
  `ws_level` int DEFAULT NULL COMMENT 'Valor de ws level',
  `ws_class` varchar(44) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Valor de ws class',
  `ws_ent_id` int NOT NULL DEFAULT '0' COMMENT 'ID de la entidad',
  `ws_state` int DEFAULT NULL COMMENT 'Estado del registro',
  PRIMARY KEY (`ws_id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of worksheets
-- ----------------------------
BEGIN;
INSERT INTO `worksheets` VALUES (1, 'planilla 1', 1, 'ws1', 1, 1);
INSERT INTO `worksheets` VALUES (2, 'planilla 2', 2, 'ws2', 1, 1);
INSERT INTO `worksheets` VALUES (3, 'planilla 3', 3, 'ws3', 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for worksheets_blocks
-- ----------------------------
CREATE TABLE `worksheets_blocks` (
  `ws_block_ws_id` int NOT NULL COMMENT 'ID de block ws',
  `ws_block_block_id` int NOT NULL COMMENT 'ID de block block',
  `ws_block_order` int NOT NULL COMMENT 'Orden de visualización',
  PRIMARY KEY (`ws_block_ws_id`,`ws_block_block_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of worksheets_blocks
-- ----------------------------
BEGIN;
INSERT INTO `worksheets_blocks` VALUES (1, 1, 1);
INSERT INTO `worksheets_blocks` VALUES (1, 2, 2);
INSERT INTO `worksheets_blocks` VALUES (1, 3, 3);
COMMIT;

