/*M!999999\- enable the sandbox mode */ 
-- MariaDB dump 10.19-11.4.5-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: panel_tarot
-- ------------------------------------------------------
-- Server version	11.4.5-MariaDB-0ubuntu0.24.10.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*M!100616 SET @OLD_NOTE_VERBOSITY=@@NOTE_VERBOSITY, NOTE_VERBOSITY=0 */;

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

DROP TABLE IF EXISTS `tarotistas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `tarotistas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `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;
/*!40101 SET character_set_client = @saved_cs_client */;

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

LOCK TABLES `tarotistas` WRITE;
/*!40000 ALTER TABLE `tarotistas` DISABLE KEYS */;
INSERT INTO `tarotistas` VALUES
(1,'1001',NULL,'Esperanza','Vidente','Test con CSRF','offline','2025-07-30 12:37:02',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,'1002',NULL,'Carmen','Rueda',NULL,'offline','2025-07-30 12:37:02',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',NULL,'Pilar','Místika','','offline','2025-07-30 12:37:02',1,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,'1004',NULL,'Auroraa','Lunaa',NULL,'offline','2025-07-30 12:37:02',1,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,'1005',NULL,'Remedios','Cristal','Sanadora energética con cristales y péndulo','disponible','2025-07-30 12:15:21',0,0,'2025-06-25 22:50:18',NULL,0,0,1,NULL,0,0,1,1,NULL,1,NULL),
(6,'1106',NULL,'bueno',NULL,NULL,'offline','2025-07-30 12:37:02',1,0,'2025-07-03 19:30:19',NULL,0,0,2,NULL,0,0,1,1,NULL,1,NULL),
(8,'11111',NULL,'manuel',NULL,NULL,'offline','2025-07-04 08:50:18',1,0,'2025-07-03 22:39:46',NULL,0,0,2,NULL,0,0,1,1,NULL,1,NULL),
(9,'222',NULL,'test',NULL,NULL,'offline','2025-07-30 09:54:54',1,0,'2025-07-30 09:54:54',NULL,0,0,NULL,NULL,0,0,1,1,NULL,1,NULL);
/*!40000 ALTER TABLE `tarotistas` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */;

-- Dump completed on 2025-07-30 15:42:13
