--
-- Host: localhost    Database: panel_tarot
-- ------------------------------------------------------


--
-- Table structure for table `api_logs`
--

CREATE TABLE `api_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `action` varchar(100) NOT NULL,
  `user_id` int(11) NOT NULL,
  `details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`details`)),
  `ip_address` varchar(45) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_action` (`action`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `api_logs`
--

INSERT INTO `api_logs` VALUES
(1,'inicio_impersonacion',1002,'{\"admin_id\":1002,\"admin_username\":\"deselpa\",\"target_user_id\":1000,\"target_username\":\"admin\",\"target_nombre\":\"Administrador Tarot\"}','91.116.118.31','2025-07-03 14:36:18'),
(2,'inicio_impersonacion',1002,'{\"admin_id\":1002,\"admin_username\":\"deselpa\",\"target_user_id\":1003,\"target_username\":\"hispatel\",\"target_nombre\":\"Call Center Hispatel\"}','91.116.118.31','2025-07-03 14:49:21'),
(3,'inicio_impersonacion',1002,'{\"admin_id\":1002,\"admin_username\":\"deselpa\",\"target_user_id\":1003,\"target_username\":\"hispatel\",\"target_nombre\":\"Call Center Hispatel\"}','91.116.118.31','2025-07-03 15:26:18'),
(4,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-03 16:49:52'),
(5,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-03 16:51:38'),
(6,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-03 16:53:48'),
(7,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-03 16:54:41'),
(8,'impersonacion',1002,'{\"target_user_id\":1004,\"target_username\":\"david\"}','91.116.118.31','2025-07-03 17:07:50'),
(9,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-03 19:11:44'),
(10,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-03 19:32:32'),
(11,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','85.51.33.204','2025-07-04 08:56:49'),
(12,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','91.116.118.31','2025-07-04 08:56:49'),
(13,'impersonacion',1002,'{\"target_user_id\":1002,\"target_username\":\"deselpa\"}','85.51.33.204','2025-07-04 09:21:14'),
(14,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','85.51.33.204','2025-07-04 09:21:53'),
(15,'impersonacion',1002,'{\"target_user_id\":1003,\"target_username\":\"hispatel\"}','85.51.33.204','2025-07-05 09:19:34');

--
-- Table structure for table `colaborador_tarotistas`
--

CREATE TABLE `colaborador_tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `colaborador_id` int(11) NOT NULL,
  `tarotista_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_asignacion` (`colaborador_id`,`tarotista_id`),
  KEY `tarotista_id` (`tarotista_id`),
  CONSTRAINT `colaborador_tarotistas_ibfk_1` FOREIGN KEY (`colaborador_id`) REFERENCES `revendedores` (`id`) ON DELETE CASCADE,
  CONSTRAINT `colaborador_tarotistas_ibfk_2` FOREIGN KEY (`tarotista_id`) REFERENCES `tarotistas` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `colaborador_tarotistas`
--

INSERT INTO `colaborador_tarotistas` VALUES
(5,2,3,'2025-07-02 16:40:37'),
(6,1,1,'2025-07-02 16:40:44'),
(7,1,3,'2025-07-02 16:40:45'),
(9,1,2,'2025-07-03 19:11:21'),
(10,2,4,'2025-07-04 08:48:49'),
(11,2,2,'2025-07-04 08:48:56'),
(12,2,1,'2025-07-04 09:17:13');

--
-- Table structure for table `configuracion_valoracion`
--

CREATE TABLE `configuracion_valoracion` (
  `id` int(11) NOT NULL DEFAULT 1,
  `norma` longtext DEFAULT NULL,
  `comentario` longtext DEFAULT NULL,
  `valoracion1` varchar(7) DEFAULT '#FF0000',
  `valoracion2` varchar(7) DEFAULT '#FFA500',
  `valoracion3` varchar(7) DEFAULT '#FFFF00',
  `valoracion4` varchar(7) DEFAULT '#90EE90',
  `valoracion5` varchar(7) DEFAULT '#00FF00',
  `valoracion_visa1` varchar(7) DEFAULT '#FF0000',
  `valoracion_visa2` varchar(7) DEFAULT '#FFA500',
  `valoracion_visa3` varchar(7) DEFAULT '#FFFF00',
  `valoracion_visa4` varchar(7) DEFAULT '#90EE90',
  `valoracion_visa5` varchar(7) DEFAULT '#00FF00',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `valoracion_nueva` varchar(7) DEFAULT '#007bff',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `configuracion_valoracion`
--

INSERT INTO `configuracion_valoracion` VALUES
(1,'<ul>\n<li><font style=\"color: rgb(181, 165, 214); vertical-align: inherit;\">Orden Prioridad&nbsp;</font><span style=\"color: rgb(181, 165, 214); background-color: rgb(140, 123, 198);\"><font style=\"vertical-align: inherit;\">MORADO</font></span><font style=\"color: rgb(181, 165, 214); vertical-align: inherit;\">&nbsp;-&nbsp;</font><span style=\"color: rgb(181, 165, 214); background-color: rgb(0, 255, 0);\"><font style=\"vertical-align: inherit;\">VERDE</font></span><font style=\"color: rgb(181, 165, 214); vertical-align: inherit;\">&nbsp;-&nbsp;</font><span style=\"color: rgb(181, 165, 214); background-color: rgb(255, 255, 0);\"><font style=\"vertical-align: inherit;\">AMARILLO</font></span><font style=\"color: rgb(181, 165, 214); vertical-align: inherit;\">&nbsp;-&nbsp;</font><span style=\"color: rgb(181, 165, 214); background-color: rgb(255, 0, 0);\"><font style=\"vertical-align: inherit;\">ROJO</font></span><br></li><li><span style=\"color: rgb(181, 165, 214);\">Color AZUL nos indica nueva tarotista en el panel.</span></li><li><span style=\"background-color: rgb(214, 214, 231);\">&nbsp;realizar reservas con&nbsp; de 3 horas de antelacion</span></li><li><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit; background-color: rgb(214, 214, 231);\">Selecciona tarotistas antes de pasar la llamada.</font></font></font></font></font></font></font></font></font></font></li><li><span style=\"color: rgb(181, 165, 214);\">En el caso de repetir, marque para tener preferencia.</span></li><li><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit; background-color: rgb(214, 214, 231);\">Indicar el tiempo contratado en el panel.</font></font></font></font></font></font></font></font></font></font></li><li><span style=\"color: rgb(181, 165, 214);\">Desmarcar el tarotista en caso de no ser utilizado.</span></li><li><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit; background-color: rgb(214, 214, 231);\">Eliminar reservas de clientes que no llaman en 3 minutos.</font></font></font></font></font></font></font></font></font></font></li><li><span style=\"color: rgb(181, 165, 214);\">Respetar los 3 minutos de cortesia entre consultas.</span></li><li><span style=\"color: rgb(181, 165, 214);\">Respetar las reservas.</span></li><li><span style=\"color: rgb(181, 165, 214);\">Respetar a los tarotistas</span></li>\n</ul>','<ul>\n<li class=\"pre\"><b style=\"font-family: Verdana;\"><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><span style=\"background-color: rgb(255, 255, 0);\">Angeles.</span><span style=\"background-color: rgb(247, 247, 247);\">&nbsp;03*07 descansa</span></font></font></font></font></font></font></font></font></font></font></span></b></li><li class=\"pre\"><b style=\"font-family: Verdana;\"><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><span style=\"background-color: rgb(255, 255, 0);\">Candela.&nbsp;</span><span style=\"background-color: rgb(247, 247, 247);\">El</span></font></font></font></font></font></font></font></font></font></font></span><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><span style=\"background-color: rgb(247, 247, 247);\">&nbsp;</span>primer lunes de cada mes tiene que faltar de 18*19 // 02/07 no trabaja</font></font></font></font></font></font></font></font></font></font></span></b></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Emperatriz</span>. Baja por ahora hasta el 16*07</span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Eva</span>&nbsp;incorpora 04/07</span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><span style=\"background-color: rgb(255, 255, 0);\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\">Gladis.&nbsp;</font></font></font></font></span><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\">Baja de tres meses / se pondra los viernes de 11 a 19</font></font></font></font></font></font></font></font></font></font></span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Itziar.</span>&nbsp;05*07 no conecta</span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Julia</span>&nbsp;de baja; incorpora 04/07</span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Macarena</span>&nbsp; 03*07 conecta 11 am// 04*07 se va a las 11 am// 07*07 y 08*07 no conecta // vacaciones 14/07 al 19/07,incorpora 20/07; vacaciones 18/08 al 29/08 incorpora 30/08</span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Malu.</span>05*07 no conecta</span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Marisol.</span>&nbsp;A partir de 14*06 y hasta agosto no conecta sabado y domingo</span></b></span></li><li class=\"pre\"><font face=\"Arial Black\"><b><span style=\"background-color: rgb(0, 255, 0);\">Marian.</span>&nbsp;</b></font><b style=\"font-family: Verdana;\"><span style=\"font-family: &quot;Arial Black&quot;;\">RETIRO ESPIRITUAL</span></b></li><li class=\"pre\"><font face=\"Arial Black\"><b><span style=\"background-color: rgb(255, 255, 0);\">Mimi</span>&nbsp; enferma; incorpora 04/07</b></font></li><li class=\"pre\"><font face=\"Arial Black\"><b><span style=\"background-color: rgb(255, 255, 0);\">Miranda.</span>&nbsp;09/07 y 10/07 conecta tarde</b></font></li><li class=\"pre\"><font face=\"Arial Black\"><b><span style=\"background-color: rgb(255, 255, 0);\">Mencia.</span>&nbsp;Baja medica hasta 04*07</b></font></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><span style=\"background-color: rgb(255, 255, 0);\">Nerea</span>&nbsp;&nbsp;</font></font></font></font></span><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\">viernes hasta nueva orden no conecta</font></font></font></font></span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;; background-color: rgb(0, 255, 0);\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\">Nix.&nbsp;</font></font></font></font></span><span style=\"font-family: &quot;Arial Black&quot;;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\"><font style=\"vertical-align: inherit;\">&nbsp;RETIRO ESPIRITUAL</font></font></font></font></span></b></span></li><li class=\"pre\"><span style=\"font-family: Verdana;\"><b><span style=\"font-family: &quot;Arial Black&quot;;\"><span style=\"background-color: rgb(255, 255, 0);\">Pilar</span>&nbsp;averia en la linea</span></b></span></li><li class=\"pre\"><font face=\"Arial Black\"><b><span style=\"background-color: rgb(0, 255, 0);\">Valeria.</span><span style=\"background-color: rgb(255, 255, 0);\">&nbsp;</span></b></font><b style=\"font-family: Verdana;\"><span style=\"font-family: &quot;Arial Black&quot;;\">RETIRO ESPIRITUAL</span></b></li>\n</ul>','#fc1d1d','#fff45c','#b9f924','#b973d3','#00ffff','#fc1d1d','#fff45c','#b3ff00','#b973d3','#00ffff','2025-07-03 09:48:06','2025-07-05 09:23:55','#007bff');

--
-- Table structure for table `configuraciones`
--

CREATE TABLE `configuraciones` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `clave` varchar(100) NOT NULL,
  `valor` text DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `tipo` enum('string','number','boolean','json') DEFAULT 'string',
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `clave` (`clave`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `configuraciones`
--

INSERT INTO `configuraciones` VALUES
(1,'tiempo_cortesia_minutos','3','Tiempo de cortesía en minutos para las llamadas','number','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(2,'auto_refresh_segundos','5','Intervalo de auto-refresh en segundos','number','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(3,'max_llamadas_concurrentes','10','Máximo número de llamadas concurrentes permitidas','number','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(4,'sistema_roles_activo','1','Activar sistema de roles y permisos','boolean','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(5,'asignacion_tarotistas_activa','1','Permitir asignación de tarotistas por colaborador','boolean','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(6,'impersonacion_solo_admins','1','Restringir impersonación solo a administradores','boolean','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(7,'duracion_token_horas','24','Duración de tokens de sesión en horas','number','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(8,'notificaciones_email','0','Enviar notificaciones por email','boolean','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(9,'modo_mantenimiento','0','Activar modo mantenimiento','boolean','2025-07-02 14:22:01','2025-07-02 14:22:16'),
(10,'logging_detallado','1','Activar logging detallado de acciones','boolean','2025-07-02 14:22:01','2025-07-02 14:22:16');

--
-- Table structure for table `falta_personal`
--

CREATE TABLE `falta_personal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario_id` int(11) NOT NULL,
  `tipo` enum('general','tarotista_especifica','problema_tecnico','otro') DEFAULT 'general',
  `tarotista_id` int(11) DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `fecha_registro` timestamp NULL DEFAULT current_timestamp(),
  `fecha_inicio` datetime DEFAULT NULL,
  `fecha_fin` datetime DEFAULT NULL,
  `estado` enum('activo','resuelto','cancelado') DEFAULT 'activo',
  `prioridad` enum('baja','media','alta','critica') DEFAULT 'media',
  `registrado_por` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_usuario` (`usuario_id`),
  KEY `idx_tarotista` (`tarotista_id`),
  KEY `idx_fecha` (`fecha_registro`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `falta_personal`
--

INSERT INTO `falta_personal` VALUES
(2,1,'general',NULL,'Falta general de personal en turno de noche','2025-01-02 09:30:00','2025-01-02 10:30:00',NULL,'activo','media','Admin Test'),
(3,1,'problema_tecnico',NULL,'Servidor caído, no pueden trabajar','2025-01-01 14:45:00','2025-01-01 15:45:00','2025-01-01 17:30:00','resuelto','media','Admin Test'),
(4,1,'tarotista_especifica',5,'Tarotista María no disponible por enfermedad','2024-12-30 08:15:00','2024-12-30 09:15:00',NULL,'activo','media','Coordinador Test'),
(5,1,'general',NULL,'Falta general de personal en turno de noche','2025-01-02 09:30:00','2025-01-02 10:30:00',NULL,'activo','media','Admin Test'),
(6,1,'problema_tecnico',NULL,'Servidor caído, no pueden trabajar','2025-01-01 14:45:00','2025-01-01 15:45:00','2025-01-01 17:30:00','resuelto','media','Admin Test'),
(7,1,'tarotista_especifica',5,'Tarotista María no disponible por enfermedad','2024-12-30 08:15:00','2024-12-30 09:15:00',NULL,'activo','media','Coordinador Test'),
(8,1,'otro',NULL,'Personal con gripe, varios ausentes','2024-12-28 07:00:00','2024-12-28 08:00:00','2024-12-29 18:00:00','resuelto','media','Admin Test'),
(9,1,'otro',NULL,'Motivos familiares urgentes','2024-12-25 13:20:00','2024-12-25 14:20:00',NULL,'cancelado','media','Usuario Test'),
(10,1,'otro',NULL,'Corte de luz en la zona','2024-12-20 10:30:00','2024-12-20 11:30:00','2024-12-20 16:45:00','resuelto','media','Técnico Test'),
(11,1002,'general',NULL,'Falta de personal reportada desde panel principal','2025-07-03 18:50:54',NULL,NULL,'activo','media','Administrador Deselpa'),
(18,1,'tarotista_especifica',7,'Luna ausente - motivos personales','2025-06-25 11:40:00','2025-06-25 13:40:00','2025-06-26 08:00:00','resuelto','media','RH Dept'),
(19,1,'general',NULL,'Huelga transporte público','2025-06-20 04:30:00','2025-06-20 06:30:00','2025-06-20 20:00:00','resuelto','media','Gerencia'),
(20,1,'otro',NULL,'Festividad local no planificada','2025-06-15 08:00:00','2025-06-15 10:00:00','2025-06-15 18:00:00','resuelto','media','Admin Local'),
(21,1,'problema_tecnico',NULL,'Fallo red internet proveedor','2025-06-10 07:15:00','2025-06-10 09:15:00',NULL,'activo','media','ISP Support'),
(22,1,'tarotista_especifica',2,'Violeta - problema familiar urgente','2025-06-05 13:30:00','2025-06-05 15:30:00',NULL,'activo','media','Supervisor Turno'),
(23,1,'general',NULL,'Capacitación masiva programada','2025-05-30 06:00:00','2025-05-30 08:00:00','2025-05-30 17:00:00','resuelto','media','Formación'),
(24,1,'otro',NULL,'Renovación oficinas - mudanza temporal','2025-05-25 05:00:00','2025-05-25 07:00:00',NULL,'cancelado','media','Facilities'),
(25,1,'problema_tecnico',NULL,'Actualización crítica sistema','2025-05-20 21:00:00','2025-05-20 23:00:00','2025-05-21 01:30:00','resuelto','media','DevOps Team'),
(26,1,'general',NULL,'Baja temporal por epidemia gripe','2025-05-15 10:20:00','2025-05-15 12:20:00','2025-05-18 08:00:00','resuelto','media','Médico Empresa'),
(27,1002,'general',NULL,'Falta de personal reportada desde panel principal','2025-07-03 19:10:07',NULL,NULL,'activo','media','Administrador Deselpa'),
(28,1002,'general',NULL,'Falta de personal reportada desde panel principal','2025-07-04 08:52:34',NULL,NULL,'activo','media','Administrador Deselpa'),
(29,1002,'general',NULL,'Falta de personal reportada desde panel principal','2025-07-05 09:19:57',NULL,NULL,'activo','media','Administrador Deselpa');

--
-- Table structure for table `horarios_tarotistas`
--

CREATE TABLE `horarios_tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tarotista_id` int(11) NOT NULL,
  `dia_semana` tinyint(4) NOT NULL COMMENT '0=Domingo, 1=Lunes, 2=Martes, 3=Miércoles, 4=Jueves, 5=Viernes, 6=Sábado',
  `hora_inicio` time DEFAULT NULL,
  `hora_fin` time DEFAULT NULL,
  `activo` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_tarotista_dia` (`tarotista_id`,`dia_semana`),
  KEY `idx_tarotista_activo` (`tarotista_id`,`activo`),
  KEY `idx_dia_activo` (`dia_semana`,`activo`)
) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `horarios_tarotistas`
--

INSERT INTO `horarios_tarotistas` VALUES
(3,3,0,NULL,NULL,0,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(7,3,1,'09:00:00','18:00:00',1,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(11,3,2,'09:00:00','18:00:00',1,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(15,3,3,'09:00:00','18:00:00',1,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(19,3,4,'09:00:00','18:00:00',1,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(23,3,5,'09:00:00','18:00:00',1,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(27,3,6,'10:00:00','14:00:00',1,'2025-07-02 20:45:18','2025-07-02 20:45:18'),
(95,6,0,NULL,NULL,0,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(96,6,1,'09:00:00','17:00:00',1,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(97,6,2,'09:00:00','17:00:00',1,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(98,6,3,'09:00:00','17:00:00',1,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(99,6,4,'09:00:00','18:00:00',1,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(100,6,5,'09:00:00','18:00:00',1,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(101,6,6,'10:00:00','14:00:00',1,'2025-07-03 20:25:02','2025-07-03 20:25:02'),
(109,2,0,NULL,NULL,0,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(110,2,1,'09:00:00','13:00:00',1,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(111,2,2,'09:00:00','18:00:00',1,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(112,2,3,'09:00:00','18:00:00',1,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(113,2,4,'09:00:00','18:00:00',1,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(114,2,5,'10:00:00','15:00:00',1,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(115,2,6,'09:00:00','15:00:00',1,'2025-07-03 20:25:41','2025-07-03 20:25:41'),
(116,1,0,NULL,NULL,0,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(117,1,1,'09:00:00','18:00:00',1,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(118,1,2,'09:00:00','18:00:00',1,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(119,1,3,'09:00:00','14:00:00',1,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(120,1,4,'09:00:00','18:00:00',1,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(121,1,5,'10:00:00','18:00:00',1,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(122,1,6,'10:00:00','14:00:00',1,'2025-07-04 08:45:51','2025-07-04 08:45:51'),
(123,4,0,NULL,NULL,0,'2025-07-04 08:52:14','2025-07-04 08:52:14'),
(124,4,1,'09:00:00','18:00:00',1,'2025-07-04 08:52:14','2025-07-04 08:52:14'),
(125,4,2,'09:00:00','18:00:00',1,'2025-07-04 08:52:14','2025-07-04 08:52:14'),
(126,4,3,'09:00:00','15:00:00',1,'2025-07-04 08:52:14','2025-07-04 08:52:14'),
(127,4,4,'09:00:00','18:00:00',1,'2025-07-04 08:52:14','2025-07-04 08:52:14'),
(128,4,5,'10:00:00','18:00:00',1,'2025-07-04 08:52:14','2025-07-04 08:52:14'),
(129,4,6,'10:00:00','14:00:00',1,'2025-07-04 08:52:14','2025-07-04 08:52:14');

--
-- Table structure for table `llamadas`
--

CREATE TABLE `llamadas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `revendedor_id` int(11) NOT NULL,
  `tarotista_id` int(11) DEFAULT NULL,
  `cliente_telefono` varchar(20) DEFAULT NULL,
  `uniqueid` varchar(50) DEFAULT NULL,
  `channel` varchar(100) DEFAULT NULL,
  `fecha_inicio` datetime DEFAULT NULL,
  `fecha_fin` datetime DEFAULT NULL,
  `duracion_segundos` int(11) DEFAULT 0,
  `estado` enum('iniciando','conectando','en_curso','finalizada','fallida','no_respuesta') DEFAULT 'iniciando',
  `motivo_fin` varchar(100) DEFAULT NULL,
  `notas` text DEFAULT NULL,
  `ip_origen` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `tarotista_id` (`tarotista_id`),
  KEY `idx_fecha` (`fecha_inicio`),
  KEY `idx_revendedor` (`revendedor_id`),
  KEY `idx_estado` (`estado`),
  KEY `idx_uniqueid` (`uniqueid`),
  CONSTRAINT `llamadas_ibfk_1` FOREIGN KEY (`revendedor_id`) REFERENCES `revendedores` (`id`) ON DELETE CASCADE,
  CONSTRAINT `llamadas_ibfk_2` FOREIGN KEY (`tarotista_id`) REFERENCES `tarotistas` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `llamadas`
--


--
-- Table structure for table `mancias`
--

CREATE TABLE `mancias` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(100) NOT NULL,
  `nombre_display` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `emoji` varchar(10) DEFAULT '',
  `imagen` varchar(100) DEFAULT '',
  `descripcion` text DEFAULT NULL,
  `activo` tinyint(1) DEFAULT 1,
  `orden_display` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `nombre` (`nombre`),
  UNIQUE KEY `slug` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mancias`
--

INSERT INTO `mancias` VALUES
(1,'tarot','Tarot','tarot','','imagen6.png',NULL,1,1,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(2,'videncia','Videncia','videncia','','imagen9.png',NULL,1,2,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(3,'medium','Medium','medium','','imagen1.png',NULL,1,3,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(4,'vidente','Vidente','vidente','','imagen9.png',NULL,1,4,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(5,'astrologia','Astrología','astrologia','','imagen3.png',NULL,1,5,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(6,'astrologo','Astrólogo','astrologo','','imagen3.png',NULL,1,6,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(7,'carta_natal','Carta Natal','carta_natal','','imagen3.png',NULL,1,7,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(8,'numerologia','Numerología','numerologia','','imagen7.png',NULL,1,8,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(9,'numerologo','Numerólogo','numerologo','','imagen7.png',NULL,1,9,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(10,'pendulo','Péndulo','pendulo','','imagen4.png',NULL,1,10,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(11,'runas','Runas','runas','','imagen5.png',NULL,1,11,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(12,'chaman','Chamán','chaman','','imagen2.png',NULL,1,12,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(13,'cartomante','Cartomante','cartomante','','imagen6.png',NULL,1,13,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(14,'cartas_espanolas','Cartas Españolas','cartas_espanolas','','imagen6.png',NULL,1,14,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(15,'santero','Santero','santero','','imagen8.png',NULL,1,15,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(16,'interpreta_suenos','Interpreta Sueños','interpreta_suenos','','imagen10.png',NULL,1,16,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(17,'suenos','Sueños','suenos','','imagen10.png',NULL,1,17,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(18,'rituales','Rituales','rituales','','imagen8.png',NULL,1,18,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(19,'amor','Especialista en Amor','amor','','imagen9.png',NULL,1,19,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(20,'feng_shui','Feng Shui','feng_shui','','imagen3.png',NULL,1,20,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(21,'cristales','Cristales','cristales','','imagen11.png',NULL,1,21,'2025-07-03 21:24:42','2025-07-03 21:24:42'),
(22,'cartas','Cartas','cartas','','imagen6.png',NULL,1,22,'2025-07-03 21:24:42','2025-07-03 21:24:42');

--
-- Table structure for table `orden_cajas_reservas`
--

CREATE TABLE `orden_cajas_reservas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tarotista_id` int(11) NOT NULL,
  `orden_posicion` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_tarotista` (`tarotista_id`)
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `orden_cajas_reservas`
--

INSERT INTO `orden_cajas_reservas` VALUES
(1,1,1,'2025-07-02 14:21:03','2025-07-03 13:40:18'),
(2,2,1,'2025-07-02 14:21:03','2025-07-03 09:44:34'),
(5,3,1,'2025-07-02 21:23:25','2025-07-04 08:47:57'),
(34,6,0,'2025-07-04 08:47:26','2025-07-04 08:47:57');

--
-- Table structure for table `proveedores_tarotistas`
--

CREATE TABLE `proveedores_tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(100) NOT NULL,
  `telefono` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `activo` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `proveedores_tarotistas`
--

INSERT INTO `proveedores_tarotistas` VALUES
(1,'Mystic Vision Partners','+34 91 234 5678','contacto@mysticvision.es','Proveedor especializado en tarotistas de alta calidad y retención',1,'2025-07-02 12:22:25','2025-07-02 12:22:25'),
(2,'Astral Network','+34 93 876 5432','info@astralnetwork.com','Red de tarotistas profesionales con experiencia en videncia',1,'2025-07-02 12:22:25','2025-07-02 12:22:25'),
(3,'peoe','','','',1,'2025-07-03 17:20:36','2025-07-03 17:20:36'),
(4,'dadfa','','','',1,'2025-07-03 18:23:52','2025-07-03 18:23:52');

--
-- Table structure for table `reservas`
--

CREATE TABLE `reservas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operadora_id` int(11) NOT NULL,
  `nombre_operadora` varchar(255) DEFAULT NULL,
  `usuario_id` int(11) NOT NULL,
  `idCliente` int(11) DEFAULT NULL,
  `admin` tinyint(1) DEFAULT 0,
  `nombre` varchar(255) DEFAULT NULL,
  `telefono` varchar(20) DEFAULT NULL,
  `linea` varchar(50) DEFAULT NULL,
  `comentario` text DEFAULT NULL,
  `fecha` datetime DEFAULT NULL,
  `marcado` tinyint(1) DEFAULT 0,
  `eliminado` tinyint(1) DEFAULT 0,
  `fecha_reserva` datetime NOT NULL,
  `notas` text DEFAULT NULL,
  `estado` enum('pendiente','activa','finalizada','cancelada') DEFAULT 'pendiente',
  `activa` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `usuario_id` (`usuario_id`),
  KEY `idx_reservas_activas` (`eliminado`,`fecha` DESC,`id` DESC),
  KEY `idx_reservas_operadora` (`operadora_id`,`eliminado`),
  KEY `idx_reservas_usuario` (`idCliente`,`admin`,`eliminado`),
  CONSTRAINT `reservas_ibfk_1` FOREIGN KEY (`operadora_id`) REFERENCES `tarotistas` (`id`),
  CONSTRAINT `reservas_ibfk_2` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `reservas`
--

INSERT INTO `reservas` VALUES
(15,1,'Esperanza',1000,1000,0,'David','201','22','33','2025-06-26 13:56:46',0,0,'2025-06-26 13:56:46','33','pendiente',1,'2025-06-26 11:56:46','2025-06-26 11:56:46'),
(16,3,'Pilar',1000,1000,0,'lui','649956099','912222222','hola','2025-06-26 18:35:22',0,0,'2025-06-26 18:35:22','hola','cancelada',0,'2025-06-26 16:35:22','2025-07-02 15:42:22'),
(17,1,'Esperanza Vidente',1002,NULL,0,'Cliente Test 1','+34 666 123 456','DDI_001','Reserva de prueba admin',NULL,1,0,'2025-07-02 16:00:00',NULL,'finalizada',0,'2025-07-02 11:13:47','2025-07-02 11:26:15'),
(18,2,'Carmen Rueda',1003,NULL,0,'Cliente Test 2','+34 677 987 654','DDI_002','Reserva de prueba colaborador',NULL,1,0,'2025-07-02 17:30:00',NULL,'finalizada',0,'2025-07-02 11:13:47','2025-07-02 11:39:13'),
(19,3,'Pilar Místika',1002,NULL,0,'Cliente Test 3','+34 688 555 777','DDI_0033','Otra reserva admin',NULL,0,1,'2025-07-02 18:00:00',NULL,'pendiente',1,'2025-07-02 11:13:47','2025-07-02 11:39:27'),
(20,1,'Esperanza',1002,NULL,0,'ddd','343434433','333334','Administrador Deselpa',NULL,1,0,'2025-07-02 13:35:00',NULL,'finalizada',0,'2025-07-02 11:39:39','2025-07-02 14:21:21'),
(21,1,'Esperanza',1002,NULL,0,'Test Cliente','','','Test reserva',NULL,1,0,'2025-07-02 19:00:00',NULL,'finalizada',0,'2025-07-02 11:44:16','2025-07-02 14:21:24'),
(22,2,'Carmen',1002,NULL,0,'afdasda','33433','','Administrador Deselpa',NULL,0,1,'2025-07-02 13:46:00',NULL,'pendiente',1,'2025-07-02 11:46:42','2025-07-02 14:21:13'),
(23,2,'Carmen',1002,NULL,0,'jfgjhfh','','jdjd','Administrador Deselpa',NULL,0,1,'2025-07-02 16:05:00',NULL,'pendiente',1,'2025-07-02 14:06:00','2025-07-02 14:21:16'),
(24,2,'Carmen',1002,NULL,0,'dafsdf','asdfasd','safdasfda','Administrador Deselpa',NULL,0,1,'2025-07-02 16:33:00',NULL,'pendiente',1,'2025-07-02 14:33:51','2025-07-02 15:04:16'),
(25,3,'Pilar',1002,NULL,0,'s','','','Administrador Deselpa',NULL,1,0,'2025-07-02 17:03:00',NULL,'finalizada',0,'2025-07-02 15:04:26','2025-07-02 15:20:42'),
(26,1,'Esperanza',1002,NULL,0,'adfasdf','','','Administrador Deselpa',NULL,0,1,'2025-07-02 17:08:00',NULL,'pendiente',1,'2025-07-02 15:08:54','2025-07-02 15:11:32'),
(27,1,'Esperanza',1002,NULL,0,'j','','','Administrador Deselpa',NULL,1,0,'2025-07-02 17:36:00',NULL,'finalizada',0,'2025-07-02 15:36:40','2025-07-02 15:37:03'),
(28,2,'Carmen',1002,NULL,0,'21','','','Administrador Deselpa',NULL,0,1,'2025-07-02 17:40:00',NULL,'pendiente',1,'2025-07-02 15:40:16','2025-07-02 15:40:27'),
(30,1,NULL,1000,NULL,0,'Cliente Reserva Test','687654321',NULL,NULL,NULL,0,0,'2025-07-02 20:07:41',NULL,'cancelada',0,'2025-07-02 18:12:41','2025-07-02 21:16:34'),
(31,1,'Esperanza',1002,NULL,0,'111','','','Administrador Deselpa',NULL,0,0,'2025-07-02 23:01:00',NULL,'pendiente',1,'2025-07-02 21:16:42','2025-07-03 10:50:25'),
(32,1,'Esperanza',1002,NULL,0,'oo','','','Administrador Deselpa',NULL,0,0,'2025-07-02 23:44:00',NULL,'cancelada',0,'2025-07-02 21:16:57','2025-07-03 09:48:38'),
(33,2,'Carmen',1002,NULL,0,'52','','','Administrador Deselpa',NULL,0,0,'2025-07-02 23:22:00',NULL,'cancelada',0,'2025-07-02 21:22:58','2025-07-03 09:48:34'),
(34,3,'Pilar',1002,NULL,0,'65914','','','Administrador Deselpa',NULL,0,0,'2025-07-02 23:22:00',NULL,'pendiente',1,'2025-07-02 21:23:04','2025-07-03 15:07:05'),
(35,3,'Pilar',1002,NULL,0,'65464665','','','Administrador Deselpa',NULL,1,0,'2025-07-03 12:59:00',NULL,'finalizada',0,'2025-07-03 11:00:00','2025-07-04 08:53:39'),
(36,6,'bueno',1002,NULL,0,'11','','','Administrador Deselpa',NULL,0,0,'2025-07-04 10:42:00',NULL,'pendiente',1,'2025-07-04 08:42:32','2025-07-04 08:42:32'),
(37,3,'Pilar',1002,NULL,0,'paloma','605731697','visas paloma','Administrador Deselpa cliente no ha llamado',NULL,1,0,'2025-07-04 10:43:00',NULL,'finalizada',0,'2025-07-04 08:46:49','2025-07-04 08:54:03'),
(38,6,'bueno',1002,NULL,0,'paloma','56465456','kldjfaks','Administrador Deselpa',NULL,0,0,'2025-07-04 11:03:00',NULL,'pendiente',1,'2025-07-04 09:08:25','2025-07-04 09:08:25'),
(39,3,'Pilar',1002,NULL,0,'132','','','Administrador Deselpa',NULL,0,0,'2025-07-04 11:08:00',NULL,'pendiente',1,'2025-07-04 09:08:51','2025-07-04 09:08:51'),
(40,1,'Esperanza',1002,NULL,0,'paloma','56a4sf6as56fd','','Call Center Hispatel',NULL,0,0,'2025-07-04 11:21:00',NULL,'cancelada',0,'2025-07-04 09:22:20','2025-07-05 09:13:49'),
(41,6,'bueno',1002,NULL,0,'PALOMA','6785522645465','VISAS PALOMA','Administrador Deselpa N/C 10.22',NULL,1,0,'2025-07-05 11:02:00',NULL,'finalizada',0,'2025-07-05 09:05:25','2025-07-05 09:06:20'),
(42,1,'Esperanza',1002,NULL,0,'TATI','54556','HISPATEL','Administrador Deselpa',NULL,0,0,'2025-07-05 11:12:00',NULL,'cancelada',0,'2025-07-05 09:13:32','2025-07-05 09:13:53'),
(43,2,'Carmen',1002,NULL,0,'PALOMA','LKSDJLFA','VISA','Administrador Deselpa',NULL,0,0,'2025-07-05 11:12:00',NULL,'pendiente',1,'2025-07-05 09:14:16','2025-07-05 09:14:16'),
(44,2,'Carmen',1002,NULL,0,'TATI','LAÑSJDF','806','Administrador Deselpa',NULL,0,0,'2025-07-05 11:45:00',NULL,'pendiente',1,'2025-07-05 09:14:46','2025-07-05 09:14:46'),
(45,8,'manuel',1002,NULL,0,'NAILEN','LKAJFD','806','Administrador Deselpa',NULL,0,0,'2025-07-05 11:45:00',NULL,'pendiente',1,'2025-07-05 09:15:03','2025-07-05 09:15:03');

--
-- Table structure for table `reservas_tarotistas`
--

CREATE TABLE `reservas_tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tarotista_id` int(11) NOT NULL,
  `cliente_telefono` varchar(20) NOT NULL,
  `cliente_nombre` varchar(100) DEFAULT NULL,
  `fecha_reserva` timestamp NULL DEFAULT current_timestamp(),
  `fecha_expiracion` timestamp NULL DEFAULT NULL,
  `activa` tinyint(1) DEFAULT 1,
  `notas` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_tarotista_activa` (`tarotista_id`,`activa`),
  KEY `idx_expiracion` (`fecha_expiracion`),
  CONSTRAINT `reservas_tarotistas_ibfk_1` FOREIGN KEY (`tarotista_id`) REFERENCES `tarotistas` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `reservas_tarotistas`
--

INSERT INTO `reservas_tarotistas` VALUES
(1,1,'34600111222','Cliente A','2025-06-25 23:17:41','2025-06-26 01:17:41',1,'Consulta sobre amor','2025-06-25 23:17:41'),
(2,3,'34600333444','Cliente B','2025-06-25 23:17:41','2025-06-26 00:17:41',1,'Lectura de cartas','2025-06-25 23:17:41');

--
-- Table structure for table `revendedores`
--

CREATE TABLE `revendedores` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre_empresa` varchar(100) NOT NULL,
  `codigo_acceso` varchar(50) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `telefono` varchar(20) DEFAULT NULL,
  `contacto_principal` varchar(100) DEFAULT NULL,
  `limite_llamadas_concurrentes` int(11) DEFAULT 5,
  `activo` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `codigo_acceso` (`codigo_acceso`),
  KEY `idx_codigo` (`codigo_acceso`),
  KEY `idx_activo` (`activo`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `revendedores`
--

INSERT INTO `revendedores` VALUES
(1,'Gabinete Demo','DEMO001','demo@gabinete.com',NULL,'Administrador Demo',5,1,'2025-06-25 07:43:10','2025-06-25 07:43:10'),
(2,'Mystical Center','MYST001','admin@mystical.com',NULL,'María García',5,1,'2025-06-25 07:43:10','2025-06-25 07:43:10');

--
-- Table structure for table `sesiones_activas`
--

CREATE TABLE `sesiones_activas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario_id` int(11) NOT NULL,
  `token_sesion` varchar(255) NOT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `fecha_creacion` datetime DEFAULT current_timestamp(),
  `fecha_ultima_actividad` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `fecha_expiracion` datetime DEFAULT NULL,
  `activa` tinyint(1) DEFAULT 1,
  `admin_impersonate` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `token_sesion` (`token_sesion`),
  KEY `idx_token_sesion` (`token_sesion`),
  KEY `idx_expiracion` (`fecha_expiracion`),
  KEY `idx_usuario` (`usuario_id`),
  KEY `idx_activa` (`activa`),
  CONSTRAINT `sesiones_activas_ibfk_1` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sesiones_activas`
--

INSERT INTO `sesiones_activas` VALUES
(1,1000,'4e333a11648b5b8ddcaf1b11258087bd33eddc7d63ce0a83311eea148633cd8f46e9ab387e76d75d5fa0029c2854f0dc626f4f0ee7dd9a4a9bd054dc5e3a7cd0','79.148.13.37','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36','2025-06-26 11:46:22','2025-07-03 18:21:32','2025-07-26 11:46:22',0,0),
(2,1002,'5dfa987654815596bf9153f140c2a2b35455921378867cd61d09ef4ce075eecde7e2a55f05f32138462443bc1191f788e82924e2d335f18e15d00b4457992f6c','::1','curl/8.9.1','2025-07-02 13:11:53','2025-07-09 13:13:32','2025-08-01 13:11:53',0,0),
(3,1002,'403467ca9f1600729dfcaa2a24b4e39e94a05d3dae53e75761d2d9bd794daac5be71e181ae0b0924330803bbc7c866fcde2acbd7941e671ce989e8ba631d1b76','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-02 13:35:54','2025-07-11 19:48:32','2025-08-01 13:35:54',0,0),
(4,1003,'ADMIN_IMPERSONATE_f511144bde09317f35d6e6cc854534d6bb05c70b3a7deab5ad5a63141105b453','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36','2025-07-02 15:40:19','2025-07-02 16:50:32','2025-07-02 16:40:19',0,1),
(5,1002,'283fd05348197b594ebc236e6a22a1ae565dd0e26924b26c18b21a43a67ebf0a5d4b720c479fe449e3cf2448c49d85561bf53945f3d8d89d369e6e9650bbbfd3','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-02 18:26:01','2025-07-02 18:49:20','2025-08-01 18:26:01',0,0),
(6,1003,'c9ccded8e987b69403c3cd9cc3a08f3f2d4a756e93443d7abe60144effd0ab408d2ba60a87736a509317e33fa0708f59019cb3422451ef597776b0313ba67294','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-02 18:49:27','2025-07-02 19:45:23','2025-08-01 18:49:27',0,0),
(7,1002,'436c4a993ee2ebfe59bd3adad704058ed3bd944ffce0b278559d644971c800e8d51e20f948b718b128e7087237f9b8b720ea45bcfd1ff34369d71f2f34557599','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-02 19:45:30','2025-07-09 19:50:02','2025-08-01 19:45:30',0,0),
(8,1003,'ADMIN_IMPERSONATE_197b1a57724aa85bb7ab547317807dcd05fd1037f286730de61ae9510f405d7f','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-03 15:59:16','2025-07-03 16:59:32','2025-07-03 16:59:16',0,1),
(9,1003,'ADMIN_IMPERSONATE_dd2c6e6611a233eee18fbb6cb0a5a68e2716753b46a73b2a107d737dbc1fc550','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-03 16:05:53','2025-07-03 17:07:02','2025-07-03 17:05:53',0,1),
(10,1003,'ADMIN_IMPERSONATE_331fe372a7f23910b91706b199586c1ad8ccca093b95f9e96896410a394c0015','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-03 16:06:10','2025-07-03 17:07:02','2025-07-03 17:06:10',0,1),
(11,1002,'9d245960b2faefa562fc2c8849b0bb73de57b32f72782c79a71a36f77af4fef78c9173a3a48a4c598bd52a9750ef91765ccb4c0f81fd42f22901d60fd863565e','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-03 16:32:33','2025-07-03 16:37:57','2025-08-02 16:32:33',0,0),
(12,1002,'d0cb29722ab3fbbee1c7ea1ed882415c015f3c6e35e3c6e5c6a8ee0c743f74c7a94d761a25ab585ee4ae44ffb90ed229fe91454acf2fb1e85b555d76156e7430','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-03 16:40:05','2025-07-03 17:01:21','2025-08-02 16:40:05',0,0),
(13,1002,'afa19405ce778a4e1cf7bde1d2ac875ed0c2be5f8f7b91701e5fef2bd5cf42a2016b43f59041d552107989f4bc5f632818599acf62f6b925f4083dc9f0cacb08','91.116.118.31','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0','2025-07-03 17:01:32','2025-07-10 17:16:32','2025-08-02 17:01:32',0,0);

--
-- Table structure for table `solicitudes_operadoras`
--

CREATE TABLE `solicitudes_operadoras` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operadora_id` int(11) NOT NULL,
  `usuario_id` int(11) NOT NULL,
  `tiempo_solicitado` varchar(50) DEFAULT NULL,
  `tipo_solicitud` enum('solicitud','tiempo') DEFAULT 'solicitud',
  `es_repetir` tinyint(1) DEFAULT 0,
  `completada` tinyint(1) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `operadora_id` (`operadora_id`),
  KEY `usuario_id` (`usuario_id`),
  CONSTRAINT `solicitudes_operadoras_ibfk_1` FOREIGN KEY (`operadora_id`) REFERENCES `tarotistas` (`id`),
  CONSTRAINT `solicitudes_operadoras_ibfk_2` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `solicitudes_operadoras`
--

INSERT INTO `solicitudes_operadoras` VALUES
(7,3,1000,'indefinido','solicitud',0,0,'2025-06-26 09:47:36','2025-06-26 09:47:36'),
(8,1,1002,NULL,'solicitud',0,0,'2025-07-03 09:57:16','2025-07-03 09:57:16'),
(10,1,1000,NULL,'solicitud',0,0,'2025-07-03 09:59:30','2025-07-03 09:59:30'),
(11,3,1002,NULL,'solicitud',0,0,'2025-07-03 10:01:35','2025-07-03 10:01:35'),
(12,1,1002,NULL,'solicitud',0,0,'2025-07-04 08:46:02','2025-07-04 08:46:02'),
(13,2,1002,NULL,'solicitud',0,0,'2025-07-04 09:22:49','2025-07-04 09:22:49'),
(14,2,1002,NULL,'solicitud',0,0,'2025-07-04 09:25:49','2025-07-04 09:25:49'),
(15,6,1002,NULL,'solicitud',0,0,'2025-07-05 09:04:42','2025-07-05 09:04:42');

--
-- Table structure for table `solicitudes_tarotistas`
--

CREATE TABLE `solicitudes_tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tarotista_id` int(11) NOT NULL,
  `cliente_telefono` varchar(20) NOT NULL,
  `cliente_nombre` varchar(100) DEFAULT NULL,
  `fecha_solicitud` timestamp NULL DEFAULT current_timestamp(),
  `fecha_expiracion` timestamp NOT NULL,
  `activa` tinyint(1) DEFAULT 1,
  `tipo_solicitud` enum('consulta','lectura','especial') DEFAULT 'consulta',
  `notas` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `opcion` varchar(20) DEFAULT NULL COMMENT 'Tiempo solicitado (5,15,20,30,45,60,abi,806,otros)',
  `marcado` tinyint(1) DEFAULT 0 COMMENT 'Si la solicitud fue procesada',
  `repetir` tinyint(1) DEFAULT 0 COMMENT 'Si es una solicitud repetida',
  `admin` tinyint(1) DEFAULT 0 COMMENT 'Si viene de admin',
  `usuario_id` int(11) DEFAULT NULL COMMENT 'ID del usuario que solicita',
  `fecha_marca` timestamp NULL DEFAULT NULL COMMENT 'Cuando se marcó como procesada',
  PRIMARY KEY (`id`),
  KEY `idx_tarotista_activa` (`tarotista_id`,`activa`),
  KEY `idx_expiracion` (`fecha_expiracion`),
  CONSTRAINT `solicitudes_tarotistas_ibfk_1` FOREIGN KEY (`tarotista_id`) REFERENCES `tarotistas` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `solicitudes_tarotistas`
--

INSERT INTO `solicitudes_tarotistas` VALUES
(1,4,'34600555666','Cliente C','2025-06-25 23:17:43','2025-06-25 23:20:43',1,'consulta','Solicitud urgente','2025-06-25 23:17:43',NULL,0,0,0,NULL,NULL),
(4,2,'612345678','Cliente Test Solicitud','2025-07-02 18:12:41','2025-07-02 18:22:41',1,'consulta',NULL,'2025-07-02 18:12:41',NULL,0,0,0,NULL,NULL),
(5,2,'N/A','deselpa','2025-07-03 09:46:07','2025-07-03 09:49:07',1,'consulta',NULL,'2025-07-03 09:46:07','30',0,0,1,1002,NULL),
(6,1,'N/A','deselpa','2025-07-03 09:47:22','2025-07-03 09:50:22',1,'consulta',NULL,'2025-07-03 09:47:22','806',0,0,1,1002,NULL),
(7,4,'N/A','deselpa','2025-07-05 09:10:34','2025-07-05 09:13:34',1,'consulta',NULL,'2025-07-05 09:10:34','15',0,0,1,1002,NULL),
(8,6,'N/A','deselpa','2025-07-05 09:11:57','2025-07-05 09:14:57',1,'consulta',NULL,'2025-07-05 09:11:57','15',0,0,1,1002,NULL);

--
-- Table structure for table `tarotista_mancias`
--

CREATE TABLE `tarotista_mancias` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tarotista_id` int(11) NOT NULL,
  `mancia_id` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_tarotista_mancia` (`tarotista_id`,`mancia_id`),
  KEY `mancia_id` (`mancia_id`),
  CONSTRAINT `tarotista_mancias_ibfk_1` FOREIGN KEY (`tarotista_id`) REFERENCES `tarotistas` (`id`) ON DELETE CASCADE,
  CONSTRAINT `tarotista_mancias_ibfk_2` FOREIGN KEY (`mancia_id`) REFERENCES `mancias` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tarotista_mancias`
--

INSERT INTO `tarotista_mancias` VALUES
(6,3,14,'2025-07-03 21:25:30'),
(7,3,18,'2025-07-03 21:25:30'),
(10,5,10,'2025-07-03 21:25:30'),
(11,5,21,'2025-07-03 21:25:30'),
(20,1,1,'2025-07-03 22:16:00'),
(21,1,2,'2025-07-03 22:16:00'),
(22,1,3,'2025-07-03 22:16:00'),
(34,8,1,'2025-07-03 22:41:50'),
(35,8,8,'2025-07-03 22:41:50'),
(36,8,11,'2025-07-03 22:41:50'),
(37,8,14,'2025-07-03 22:41:50'),
(38,8,17,'2025-07-03 22:41:50'),
(39,6,14,'2025-07-03 22:42:06'),
(40,6,17,'2025-07-03 22:42:06'),
(41,6,20,'2025-07-03 22:42:06'),
(59,2,22,'2025-07-04 09:03:19'),
(66,4,1,'2025-07-05 09:25:24'),
(67,4,2,'2025-07-05 09:25:24'),
(68,4,3,'2025-07-05 09:25:24'),
(69,4,4,'2025-07-05 09:25:24'),
(70,4,16,'2025-07-05 09:25:24'),
(71,4,20,'2025-07-05 09:25:24');

--
-- Table structure for table `tarotistas`
--

CREATE TABLE `tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigo_agente` varchar(20) DEFAULT NULL,
  `extension` varchar(20) NOT NULL,
  `agente_usuario` varchar(20) DEFAULT NULL,
  `nombre` varchar(100) NOT NULL,
  `apellidos` varchar(100) DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `estado_actual` enum('offline','disponible','ocupado','pausa','esperando','bloqueado','reservado','solicitado','sonando') DEFAULT 'offline',
  `ultima_actualizacion` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `activo` tinyint(1) DEFAULT 1,
  `orden_display` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `ultima_hora_colgada` timestamp NULL DEFAULT NULL,
  `bloqueado` tinyint(1) DEFAULT 0,
  `estado_pbx_actual` int(11) DEFAULT 0 COMMENT 'Estado PBX: 0=no auth, 1=colgada, 2=descolgada, 4=sonando, 5=interna, 7=entrante, 8=saliente',
  `proveedor_id` int(11) DEFAULT NULL,
  `telefono_contacto` varchar(50) DEFAULT NULL,
  `valoracion` int(1) DEFAULT 0 COMMENT 'Valoración Tarot (1-5 estrellas)',
  `valoracion_visa` int(1) DEFAULT 0 COMMENT 'Valoración Visa/Repetición (1-5 estrellas)',
  `valoracion_automatica` tinyint(1) DEFAULT 1 COMMENT 'Si la valoración es automática (1) o manual (0)',
  `valoracion_visa_automatica` tinyint(1) DEFAULT 1 COMMENT 'Si la valoración visa es automática (1) o manual (0)',
  `fecha_ultima_sync_valoracion` timestamp NULL DEFAULT NULL COMMENT 'Última sincronización de valoraciones desde Asterisk',
  `sync_with_asterisk` tinyint(1) DEFAULT 1 COMMENT 'Si debe sincronizarse con asterisk',
  `last_sync_from_asterisk` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `extension` (`extension`),
  KEY `idx_estado` (`estado_actual`),
  KEY `idx_extension` (`extension`),
  KEY `idx_activo` (`activo`),
  KEY `idx_orden` (`orden_display`),
  KEY `proveedor_id` (`proveedor_id`),
  CONSTRAINT `tarotistas_ibfk_1` FOREIGN KEY (`proveedor_id`) REFERENCES `proveedores_tarotistas` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tarotistas`
--

INSERT INTO `tarotistas` VALUES
(1,'324','1001',NULL,'Cristina Tarot','Vidente','Tarotista de prueba - Cristina','offline','2025-07-30 13:43:14',1,0,'2025-06-25 22:50:18','2025-06-25 23:29:51',0,0,2,NULL,3,2,1,1,'2025-07-02 17:46:21',1,NULL),
(2,'350','1002',NULL,'David Esotérico','Medium','Tarotista de prueba - David','offline','2025-07-30 13:43:14',1,0,'2025-06-25 22:50:18','2025-06-26 11:58:32',0,0,NULL,NULL,2,2,1,1,'2025-07-02 17:46:21',1,NULL),
(3,'1003','1003',NULL,'Pilar','Místika','','offline','2025-07-30 13:43:14',0,0,'2025-06-25 22:50:18','2025-07-09 17:19:32',0,0,1,NULL,4,4,1,1,'2025-07-02 17:46:21',1,NULL),
(4,'324','1004',NULL,'Auroraa','Lunaa',NULL,'offline','2025-07-30 13:43:14',0,0,'2025-06-25 22:50:18',NULL,0,0,NULL,NULL,5,5,1,1,'2025-07-02 17:46:21',1,NULL),
(5,'350','1005',NULL,'Remedios','Cristal','Sanadora energética con cristales y péndulo','disponible','2025-07-30 13:42:53',0,0,'2025-06-25 22:50:18',NULL,0,0,1,NULL,0,0,1,1,NULL,1,NULL),
(6,NULL,'1106',NULL,'bueno',NULL,NULL,'offline','2025-07-30 13:43:14',0,0,'2025-07-03 19:30:19',NULL,0,0,2,NULL,0,0,1,1,NULL,1,NULL),
(8,NULL,'11111',NULL,'manuel',NULL,NULL,'offline','2025-07-30 13:43:14',0,0,'2025-07-03 22:39:46',NULL,0,0,2,NULL,0,0,1,1,NULL,1,NULL),
(9,NULL,'222',NULL,'test',NULL,NULL,'offline','2025-07-30 13:43:14',0,0,'2025-07-30 09:54:54',NULL,0,0,NULL,NULL,0,0,1,1,NULL,1,NULL);

--
-- Table structure for table `tarotistas_backup`
--

CREATE TABLE `tarotistas_backup` (
  `id` int(11) NOT NULL DEFAULT 0,
  `extension` varchar(20) NOT NULL,
  `nombre` varchar(100) NOT NULL,
  `apellidos` varchar(100) DEFAULT NULL,
  `especialidades` text DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `estado_actual` enum('disponible','ocupado','pausa','offline') DEFAULT 'offline',
  `ultima_actualizacion` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `activo` tinyint(1) DEFAULT 1,
  `orden_display` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tarotistas_backup`
--

INSERT INTO `tarotistas_backup` VALUES
(1,'201','María','González','Tarot Marsella, Numerología','Especialista en amor y trabajo','disponible','2025-06-25 22:46:02',1,1,'2025-06-25 07:43:10'),
(2,'202','Carmen','López','Tarot Rider, Runas','Más de 20 años de experiencia','ocupado','2025-06-25 22:46:02',1,2,'2025-06-25 07:43:10'),
(3,'203','Ana','Martín','Videncia, Cartas Españolas','Lecturas directas y precisas','offline','2025-06-25 22:45:02',1,3,'2025-06-25 07:43:10');

--
-- Table structure for table `usuarios`
--

CREATE TABLE `usuarios` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `revendedor_id` int(11) NOT NULL,
  `rol` enum('admin','colaborador') DEFAULT 'colaborador',
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `nombre_completo` varchar(100) DEFAULT NULL,
  `remember_token` varchar(255) DEFAULT NULL,
  `ultimo_acceso` datetime DEFAULT NULL,
  `activo` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  KEY `idx_username` (`username`),
  KEY `idx_token` (`remember_token`),
  KEY `idx_revendedor` (`revendedor_id`),
  CONSTRAINT `usuarios_ibfk_1` FOREIGN KEY (`revendedor_id`) REFERENCES `revendedores` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1005 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `usuarios`
--

INSERT INTO `usuarios` VALUES
(1000,1,'colaborador','admin','$2y$10$FGhfjM8.GMemUbG18ubFouzARRjUgRcE//y/hQOzN9RsnOLRhWnSe','admin@tarotcentral.com','Administrador Tarot','4e333a11648b5b8ddcaf1b11258087bd33eddc7d63ce0a83311eea148633cd8f46e9ab387e76d75d5fa0029c2854f0dc626f4f0ee7dd9a4a9bd054dc5e3a7cd0','2025-07-03 16:36:18',1,'2025-06-25 22:51:00','2025-07-03 14:36:18'),
(1002,1,'admin','deselpa','$2y$10$Go/hHe8CEJudHQ32LgSXE.kB1GUCv/1z1rq209NT73aXO0PVFacqu','admin@deselpa.com','Administrador Deselpa','afa19405ce778a4e1cf7bde1d2ac875ed0c2be5f8f7b91701e5fef2bd5cf42a2016b43f59041d552107989f4bc5f632818599acf62f6b925f4083dc9f0cacb08','2025-07-30 22:06:11',1,'2025-07-02 10:34:03','2025-07-30 20:06:11'),
(1003,2,'colaborador','hispatel','$2y$10$ZYnUD/gekLNG2cgdJL./iO0mQfbZsAEf4Jy5kWChXvBxNv2W4URsa','callcenter@hispatel.com','Call Center Hispatel','c9ccded8e987b69403c3cd9cc3a08f3f2d4a756e93443d7abe60144effd0ab408d2ba60a87736a509317e33fa0708f59019cb3422451ef597776b0313ba67294','2025-07-05 11:19:34',1,'2025-07-02 10:34:03','2025-07-05 09:19:34');

--
-- Table structure for table `usuarios_backup`
--

CREATE TABLE `usuarios_backup` (
  `id` int(11) NOT NULL DEFAULT 0,
  `revendedor_id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `nombre_completo` varchar(100) DEFAULT NULL,
  `remember_token` varchar(255) DEFAULT NULL,
  `ultimo_acceso` datetime DEFAULT NULL,
  `activo` tinyint(1) DEFAULT 1,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `usuarios_backup`
--

INSERT INTO `usuarios_backup` VALUES
(1,1,'admin','$2y$10$JWDonVGJAq/P2941HxUZueDNa2Lt9Bc2atSIVEDLl9lgJwgakwILu','admin@demo.com','Administrador Demo',NULL,'2025-06-25 20:27:18',1,'2025-06-25 07:43:10','2025-06-25 18:27:18'),
(2,2,'maria','$2y$10$JWDonVGJAq/P2941HxUZueDNa2Lt9Bc2atSIVEDLl9lgJwgakwILu','maria@mystical.com','María García',NULL,NULL,1,'2025-06-25 07:53:55','2025-06-25 07:53:55'),
(3,1,'demo','$2y$10$JWDonVGJAq/P2941HxUZueDNa2Lt9Bc2atSIVEDLl9lgJwgakwILu','demo@gabinete.com','Usuario Demo',NULL,NULL,1,'2025-06-25 07:53:55','2025-06-25 07:53:55'),
(999,1,'test_user','test_hash',NULL,'Usuario Test',NULL,NULL,1,'2025-06-25 09:54:29','2025-06-25 09:54:29');

--
-- Table structure for table `valoraciones`
--

CREATE TABLE `valoraciones` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `operadora_id` int(11) NOT NULL,
  `usuario_id` int(11) NOT NULL,
  `valoracion_tarop` int(11) DEFAULT NULL CHECK (`valoracion_tarop` between 1 and 5),
  `comentario_tarop` text DEFAULT NULL,
  `fecha_valoracion_tarop` timestamp NULL DEFAULT NULL,
  `valoracion_visa` int(11) DEFAULT NULL CHECK (`valoracion_visa` between 1 and 5),
  `comentario_visa` text DEFAULT NULL,
  `fecha_valoracion_visa` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_valoracion` (`operadora_id`,`usuario_id`),
  KEY `usuario_id` (`usuario_id`),
  CONSTRAINT `valoraciones_ibfk_1` FOREIGN KEY (`operadora_id`) REFERENCES `tarotistas` (`id`),
  CONSTRAINT `valoraciones_ibfk_2` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `valoraciones`
--

INSERT INTO `valoraciones` VALUES
(5,4,1000,5,'','2025-07-02 11:17:23',NULL,NULL,NULL,'2025-07-02 11:17:23','2025-07-02 11:17:23'),
(6,1,1003,5,'','2025-07-02 17:03:31',NULL,NULL,NULL,'2025-07-02 17:03:31','2025-07-02 17:03:31'),
(7,2,1002,5,'','2025-07-02 18:25:57',NULL,NULL,NULL,'2025-07-02 18:25:57','2025-07-02 18:25:57');


