
--
-- Table structure for table `ci_revision_lazos`
--

CREATE TABLE `ci_revision_lazos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `id_central` bigint(20) unsigned NOT NULL,
  `numero` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_lazo_per_central` (`id_central`,`numero`),
  CONSTRAINT `ci_revision_lazos_id_central_foreign` FOREIGN KEY (`id_central`) REFERENCES `ci_revision_centrales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ci_revision_lazos`
--

INSERT INTO `ci_revision_lazos` VALUES (1,1,1,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(2,1,2,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(3,1,3,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(4,1,4,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(5,1,5,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(6,1,6,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(7,1,7,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(8,1,8,'2025-09-24 05:03:45','2025-09-24 05:03:45'),(9,2,1,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(10,2,2,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(11,2,3,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(12,2,4,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(13,2,6,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(14,2,7,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(15,2,8,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(16,2,5,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(17,3,1,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(18,3,2,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(19,3,3,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(20,3,4,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(21,3,5,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(22,3,6,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(23,4,1,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(24,4,2,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(25,4,3,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(26,4,4,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(27,4,5,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(28,4,6,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(29,4,7,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(30,5,1,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(31,5,2,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(32,5,3,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(33,5,4,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(34,5,5,'2025-10-03 06:35:44','2025-10-03 06:35:44');

--
-- Table structure for table `ci_revision_tipo_elementos`
--

CREATE TABLE `ci_revision_tipo_elementos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tipo` int(11) NOT NULL,
  `abreviatura` varchar(255) NOT NULL,
  `nombre` varchar(255) NOT NULL,
  `nombre_largo` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ci_revision_tipo_elementos`
--

INSERT INTO `ci_revision_tipo_elementos` VALUES (1,1,'OPTI','Óptico','S. Óptico'),(2,1,'TER','Térmico','S. Térmico'),(3,1,'MULT','Multi','S. Multi'),(4,1,'SMART 4','Smart 4','Smart 4 S.'),(5,2,'PUL','Pulsador','PUL de Ala'),(6,2,'SIRE','Sirena','SIRENA'),(7,2,'MON','Monitor','M. Monitor'),(8,2,'CON','Controlador','M. de Cont'),(9,2,'AUX','Auxiliar','M. Entr. A'),(10,2,'ASPR','Sprinkler Int','M. int. Si'),(11,2,'SPRK','Sprinkler','M. Sprinkl'),(12,2,'ZMX','Zona','M. Zona'),(13,2,'CDI','CDI','CDI'),(14,2,'BOOSTER','Booster','BOOSTER');

--
-- Table structure for table `ci_revision_zonas`
--

CREATE TABLE `ci_revision_zonas` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `central_id` bigint(20) unsigned NOT NULL,
  `nombre` varchar(255) NOT NULL,
  `numero` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ci_revision_zonas_central_id_numero_unique` (`central_id`,`numero`),
  KEY `ci_revision_zonas_central_id_index` (`central_id`),
  KEY `ci_revision_zonas_central_id_numero_index` (`central_id`,`numero`),
  CONSTRAINT `ci_revision_zonas_central_id_foreign` FOREIGN KEY (`central_id`) REFERENCES `ci_revision_centrales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `ci_revision_zonas`
--

INSERT INTO `ci_revision_zonas` VALUES (1,1,'Bloque grande planta 7',2,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(2,1,'Bloque grande planta 6',3,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(3,1,'Bloque grande planta 5',4,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(4,1,'Bloque grande planta 4',5,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(5,1,'Bloque grande planta 3',6,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(6,1,'Bloque grande planta 2',7,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(7,1,'Bloque grande planta 1',8,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(8,1,'Bloque pequeño azotea',9,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(9,1,'Bloque pequeño planta 6',10,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(10,1,'Bloque pequeño planta 5',11,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(11,1,'Bloque pequeño planta 4',12,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(12,1,'Bloque pequeño planta 3',13,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(13,1,'Bloque pequeño planta 2',14,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(14,1,'Bloque pequeño planta 1',15,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(15,1,'Recepción',16,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(16,1,'Comedor de clientes',17,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(17,1,'Cocina',18,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(18,1,'Bar salón',19,'2025-09-24 05:03:44','2025-09-24 05:03:44'),(19,1,'Piscina Exterior',20,'2025-09-24 05:03:45','2025-09-24 05:03:45'),(20,1,'Spa',21,'2025-09-24 05:03:45','2025-09-24 05:03:45'),(21,1,'Sótano',22,'2025-09-24 05:03:45','2025-09-24 05:03:45'),(22,1,'Parking golf',23,'2025-09-24 05:03:45','2025-09-24 05:03:45'),(23,1,'Puertas RF',24,'2025-09-24 05:03:45','2025-09-24 05:03:45'),(24,2,'Azotea Bloque Verano',1,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(25,2,'Planta 7 Verano',2,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(26,2,'Planta 6 Verano',3,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(27,2,'Planta 5 Verano',4,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(28,2,'Planta 4 Verano',5,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(29,2,'Planta 3 Verano',6,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(30,2,'Planta 2 Verano',7,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(31,2,'Planta 1 Verano',8,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(32,2,'Azotea Bloque Invierno',9,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(33,2,'Planta 6 Invierno',10,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(34,2,'Planta 5 Invierno',11,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(35,2,'Planta 4 Invierno',12,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(36,2,'Planta 3 Invierno',13,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(37,2,'Planta 2 Invierno',14,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(38,2,'Planta 1 Invierno',15,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(39,2,'Comedor Clientes',17,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(40,2,'Bar Salón',18,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(41,2,'Recepción',19,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(42,2,'Cocina',20,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(43,2,'Sótano',21,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(44,2,'Guarderías',22,'2025-09-24 13:20:00','2025-09-24 13:20:00'),(45,2,'Piscina Climatizada',23,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(46,2,'Control Puertas',24,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(47,2,'Planta Baja Personal',26,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(48,2,'Planta Técnica',28,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(49,2,'Hall Ascensores Planta 7',29,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(50,2,'Hall Ascensores Planta 6',30,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(51,2,'Hall Ascensores Planta 5',31,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(52,2,'Hall Ascensores Planta 4',32,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(53,2,'Hall Ascensores Planta 3',33,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(54,2,'Hall Ascensores Planta 2',34,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(55,2,'Hall Planta 1',35,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(56,2,'Sótano Pizzería',36,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(57,2,'Pizzería',37,'2025-09-24 13:20:01','2025-09-24 13:20:01'),(58,3,'Sala de Máquinas Azotea',1,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(59,3,'Planta 6',2,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(60,3,'Planta 5',3,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(61,3,'Planta 4',4,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(62,3,'Planta 3',5,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(63,3,'Planta 2',6,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(64,3,'Planta 1',7,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(65,3,'Recepción',8,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(66,3,'Bar Salón',9,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(67,3,'Salón Polivalente',10,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(68,3,'Piscina Exterior',11,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(69,3,'Sótano Zona de Personal',12,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(70,3,'Cocina',13,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(71,3,'Spa',14,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(72,3,'Comedor Clientes',15,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(73,3,'Piscina Interior',16,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(74,3,'Distribuidor Comedor y SPA',17,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(75,3,'Escalera Servicio Pisos',18,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(76,3,'Oficce Recepción',19,'2025-09-25 10:51:15','2025-09-25 10:51:15'),(77,4,'Actvación Sirenas Mimosa 1',1,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(78,4,'Actvación Sirenas Mimosa 2',2,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(79,4,'Actvación Sirenas Jazmines',3,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(80,4,'Actvación Sirenas Buganvilla',4,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(81,4,'Actvación Sirenas Anexo',5,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(82,4,'Actvación Sirenas Conferencias',6,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(83,4,'Buganvilla Planta 3 Izquierda',7,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(84,4,'Buganvilla Planta 2 Izquierda',8,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(85,4,'Buganvilla Planta 3 Derecha',9,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(86,4,'Buganvilla Azotea',10,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(87,4,'Buganvilla Planta 2 Derecha',11,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(88,4,'Buganvilla Planta 1 Izquierda',12,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(89,4,'Buganvilla Planta Baja Izquierda',13,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(90,4,'Buganvilla Oficinas',14,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(91,4,'Buganvilla Planta 1 Derecha',15,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(92,4,'Buganvilla Recepción',16,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(93,4,'Buganvilla Planta Noble',17,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(94,4,'Buganvilla Cocina',18,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(95,4,'Buganvilla Animación',19,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(96,4,'Buganvilla Sótano',20,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(97,4,'Buganvilla SPA',21,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(98,4,'Anexo Planta Baja',22,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(99,4,'Anexo Planta 1',23,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(100,4,'Anexo Planta 2',24,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(101,4,'Anexo Planta 3',25,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(102,4,'Anexo Azotea',26,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(103,4,'Pool Bar',27,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(104,4,'Miniland',28,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(105,4,'Gimnasio y fitness',29,'2025-10-02 08:06:22','2025-10-02 08:06:22'),(106,5,'Mimosa 1 Planta 2',2,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(107,5,'Mimosa 1 Planta 1',3,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(108,5,'Mimosa 1 Planta Baja',4,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(109,5,'Mimosa Sótano',5,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(110,5,'Mimosa 1 Tasca',6,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(111,5,'Mimosa 2 Planta 2',7,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(112,5,'Mimosa 2 Planta 1',8,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(113,5,'Mimosa 2 Planta Baja',9,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(114,5,'Jazmín 1 Azotea',10,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(115,5,'Jazmín 1 Planta 2',11,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(116,5,'Jazmín 1 Planta 1',12,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(117,5,'Jazmín 1 Planta Baja',13,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(118,5,'Mimosa 1 Puertas RF',17,'2025-10-03 06:35:44','2025-10-03 06:35:44'),(119,5,'Mimosa 2 Puertas RF',18,'2025-10-03 06:35:44','2025-10-03 06:35:44');

--
-- Table structure for table `dispositivos`
--

CREATE TABLE `dispositivos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(255) NOT NULL,
  `mac` varchar(255) NOT NULL,
  `lugar_id` bigint(20) unsigned NOT NULL,
  `identificador` varchar(255) NOT NULL,
  `estado` tinyint(1) NOT NULL DEFAULT 0,
  `ultima_vez` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `dispositivos_mac_unique` (`mac`),
  UNIQUE KEY `dispositivos_identificador_unique` (`identificador`),
  KEY `dispositivos_lugar_id_foreign` (`lugar_id`),
  CONSTRAINT `dispositivos_lugar_id_foreign` FOREIGN KEY (`lugar_id`) REFERENCES `lugares` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dispositivos`
--


--
-- Table structure for table `lugares`
--

CREATE TABLE `lugares` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(255) NOT NULL,
  `direccion` varchar(255) NOT NULL,
  `poblacion` varchar(255) NOT NULL,
  `codigo_postal` varchar(255) NOT NULL,
  `provincia` varchar(255) NOT NULL,
  `tipo` varchar(255) NOT NULL,
  `latitud` decimal(10,8) NOT NULL,
  `longitud` decimal(11,8) NOT NULL,
  `horario` varchar(255) DEFAULT NULL,
  `telefono` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `sitio_web` varchar(255) DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `estado` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `lugares`
--

INSERT INTO `lugares` VALUES (1,'Flamenco','Avda. Sa Coma, 13','Cala Millor','07560','9','33',39.59241657,3.38362008,'','971585312','flamenco@hipotels.com','https://www.hipotels.com/hoteles/flamenco/','',1,NULL,NULL),(2,'Hipotels Gran Playa de Palma','Carrer de la Granja, 6','Playa de Palma','07610','9','33',39.52963600,3.05849800,'Abierto las 24 horas','971261041','granplaya@hipotels.com','https://www.hipotels.com/hoteles/gran-playa-de-palma/','Un hotel de lujo frente a la playa con instalaciones de primera clase.',1,NULL,NULL),(3,'Hipotels Bahia Cala Millor','Carrer des Pinar, 21','Cala Millor','07560','9','33',39.59191500,3.39874200,'Abierto todo el año','971585820','bahia@hipotels.com','https://www.hipotels.com/hoteles/bahia-cala-millor/','Un hotel familiar con vistas al mar y una amplia oferta de actividades para todos los gustos.',1,NULL,NULL),(4,'Hipotels Said','Carrer de Costa i Llobera, 3','Puerto de Alcudia','07400','9','33',39.83985300,3.12175800,'De 08:00 a 22:00','971892029','said@hipotels.com','https://www.hipotels.com/hoteles/said/','Situado en el norte de Mallorca, este hotel está diseñado para parejas y viajeros que buscan relax.',1,NULL,NULL),(5,'Hipotels Dunas','Avinguda de la Playa, 12','Son Servera','07550','9','33',39.58041200,3.38827400,'De 09:00 a 21:00','971583327','dunas@hipotels.com','https://www.hipotels.com/hoteles/dunas/','Un lugar ideal para disfrutar de la tranquilidad en un entorno natural cerca del mar.',1,NULL,NULL),(6,'Hipotels Bahía Grande','C/ Castell, 1','Cala Millor','07560','9','33',39.58772531,3.38386953,NULL,'971586411',NULL,'https://www.hipotels.com/hoteles/bahiagrande/',NULL,1,'2025-09-24 05:01:08','2025-09-24 05:01:08'),(7,'Hipotels Coma Gran','Cards, s/n','Sa Coma','07560','9','33',39.57699988,3.37517204,NULL,'971810179',NULL,'https://www.hipotels.com/hoteles/comagran/',NULL,1,'2025-09-24 13:18:04','2025-09-24 13:18:04'),(8,'Hipotels Hipocampo Playa','Avda. Sa Coma, 45','Cala Millor','07560','9','33',39.58936989,3.38438451,NULL,'971585262',NULL,'https://www.hipotels.com/hoteles/hipocampoplaya/',NULL,1,'2025-09-25 10:49:26','2025-09-25 10:49:26'),(9,'Sunwing Bouganvilla','Carretera Costa de los Pinos s/n','Cala Bona','07559','9','33',39.61984128,3.39113816,NULL,'971814099',NULL,'hipotels.com',NULL,1,'2025-10-02 08:04:56','2025-10-02 08:04:56'),(10,'Sunwing Mimosa-Jazmin','Carretera Costa de los Pinos s/n','Cala Bona','07559','9','33',39.61785781,3.39098811,NULL,'971814099',NULL,'hipotels.com',NULL,1,'2025-10-03 06:33:32','2025-10-03 06:33:32'),(11,'Hotel Mediterraneo','Avenida Ses Savines, s/n','Sa Coma','07560','9','33',39.57150952,3.37408483,NULL,'971 810 105',NULL,'https://www.hipotels.com/hoteles/mediterraneo/',NULL,1,'2025-10-08 05:37:58','2025-10-08 05:37:58');

--
-- Table structure for table `materiales`
--

CREATE TABLE `materiales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(255) NOT NULL,
  `descripcion` text DEFAULT NULL,
  `categoria_id` bigint(20) unsigned NOT NULL,
  `codigo_sku` varchar(255) NOT NULL,
  `unidad_medida` varchar(255) NOT NULL,
  `cantidad_stock` int(11) NOT NULL DEFAULT 0,
  `cantidad_minima` int(11) NOT NULL DEFAULT 0,
  `precio_compra` decimal(8,2) NOT NULL,
  `precio_venta` decimal(8,2) DEFAULT NULL,
  `proveedor_id` bigint(20) unsigned DEFAULT NULL,
  `ubicacion_almacen` varchar(255) DEFAULT NULL,
  `fecha_entrada` date NOT NULL,
  `estado` enum('disponible','pendiente','agotado') NOT NULL DEFAULT 'disponible',
  `fecha_vencimiento` date DEFAULT NULL,
  `observaciones` text DEFAULT NULL,
  `imagen` varchar(255) DEFAULT NULL,
  `numero_lote` varchar(255) DEFAULT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `materiales_codigo_sku_unique` (`codigo_sku`),
  KEY `materiales_categoria_id_foreign` (`categoria_id`),
  KEY `materiales_proveedor_id_foreign` (`proveedor_id`),
  KEY `materiales_user_id_foreign` (`user_id`),
  CONSTRAINT `materiales_categoria_id_foreign` FOREIGN KEY (`categoria_id`) REFERENCES `categorias` (`id`) ON DELETE CASCADE,
  CONSTRAINT `materiales_proveedor_id_foreign` FOREIGN KEY (`proveedor_id`) REFERENCES `proveedores` (`id`) ON DELETE SET NULL,
  CONSTRAINT `materiales_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `materiales`
--


--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES (1,'0000_01_01_000000_create_users_table',1),(2,'2024_01_01_000001_create_templates_table',1),(3,'2024_01_01_000002_create_template_variables_table',1),(4,'2024_01_01_000003_create_template_responses_table',1),(5,'2024_10_29_185618_create_materiales_proveedores_categorias_table',1),(6,'2024_10_30_201046_create_role_user_table',1),(7,'2024_11_01_160641_create_ci_revision_central_tables',1),(8,'2024_11_02_151151_create_lugares_table',1),(9,'2024_11_07_203325_create_fichajes_table',1),(10,'2024_11_11_170312_create_dispositivos_table',1),(11,'2024_11_22_172237_create_trabajo_horas_trabajador_table',1),(12,'2024_12_16_180534_create_trabajo_registro_table',1),(13,'2025_08_26_185218_create_trabajo_registros_diarios_table',1),(14,'2025_08_26_185224_create_trabajo_registros_materiales_table',1),(15,'2025_08_26_202452_create_trabajo_partes_table',1),(16,'2025_08_30_171317_create_ci_elementos_revisados_table',1),(17,'2025_08_30_175020_create_ci_eventos_central_table',1),(18,'2025_08_30_201842_create_cache_table',1);

--
-- Table structure for table `proveedores`
--

CREATE TABLE `proveedores` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(255) NOT NULL,
  `direccion` varchar(255) DEFAULT NULL,
  `telefono` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `tipo_documento` varchar(255) NOT NULL,
  `numero_documento` varchar(255) NOT NULL,
  `descripcion` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `proveedores_numero_documento_unique` (`numero_documento`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `proveedores`
--


--
-- Table structure for table `role_user`
--

CREATE TABLE `role_user` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `role_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `role_user_user_id_foreign` (`user_id`),
  KEY `role_user_role_id_foreign` (`role_id`),
  CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_user`
--

INSERT INTO `role_user` VALUES (1,1,1,'2025-09-23 19:53:43','2025-09-23 19:53:43');

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` VALUES (1,'admin','2025-09-23 19:53:43','2025-09-23 19:53:43'),(2,'user','2025-09-23 19:53:43','2025-09-23 19:53:43'),(3,'verificador','2025-09-23 19:53:43','2025-09-23 19:53:43'),(4,'trabajador','2025-09-23 19:53:43','2025-09-23 19:53:43'),(5,'contra-incendios','2025-09-23 19:53:43','2025-09-23 19:53:43');

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` VALUES ('0odZkCc4L4kpVVoxPND2gUZaV9vWPDGciiEitFDj',NULL,'93.123.109.214','l9tcpid/v1.1.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiZWpsMVNwSUdURnJuTTBTY1loejI0MzRtNVNqMDNYZEdtRDMyZFRydyI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759841488),('5DAxgm2aBxjPdtS9TcDvTPlpaRfHUIYLCDQi33XP',NULL,'170.64.237.55','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36','YTo0OntzOjY6Il90b2tlbiI7czo0MDoib3RqRUJyWG5FTVpCTEJaeDQ1aGNyeWt5N1FvRldmOHFEdWhWS1R1ayI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759839790),('8TvXrxd192pD2k2xE6eHE5entBhyv2MN72NhJbol',NULL,'167.94.138.201','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTozOntzOjY6Il90b2tlbiI7czo0MDoieTF1SEV4WTA4VTJnSVkxUTBYOGVmajRFVGllVkVzb3Y0czlTcFByTiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzY6Imh0dHBzOi8vODguMjEuMjI5LjI0NC9pbmljaWFyLXNlc2lvbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=',1759845091),('B9BwHKu1EoZaQq7uOkhmzlQKJ77ECCtQgu6r76k7',NULL,'167.94.138.201','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiTW9iN3c5U1R1czJ0ODkzRXlrVTdQOHZJNlZoUEJWcE9GOHh2NkJadiI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMToiaHR0cHM6Ly84OC4yMS4yMjkuMjQ0Ijt9czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHBzOi8vODguMjEuMjI5LjI0NCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=',1759844972),('Bi9f9FsEZKKB9A7ebmPsTkQCzNKsETasKalTtBj1',NULL,'162.142.125.45','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiOFBQSUxhT3RxNGhjQ1lpV2dSWkJaYVNjelIyVUJKbEJuRnNyb0p0ZSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzU6Imh0dHA6Ly84OC4yMS4yMjkuMjQ0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759862990),('C6Ny6RyDzQNm6IEKonjxumT9olosObzKedISE31Y',NULL,'167.94.138.165','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiNE5tek1PbzVmTzBHWTJHdTk2aUE0YkZaUGRiS2xyVWdWSXpxanRYTSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMToiaHR0cHM6Ly84OC4yMS4yMjkuMjQ0Ijt9czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MjE6Imh0dHBzOi8vODguMjEuMjI5LjI0NCI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=',1759844954),('cCu8jxQZyAQDKRaGiUI2zuog9yQB1uet4dIE1rQc',NULL,'66.249.93.2','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiR3hrdnpXNG9UN1RuTEwyakQ0S0xTakh0WkZuOEhueVJZSmFIdkZhMiI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo3NjoiaHR0cHM6Ly9pc3JhY29sb3IuZGRucy5uZXQvcmV2aXNpb24vNC9jZW50cmFsZXMvNC9lbGVtZW50b3M/dmlzdGE9cGVuZGllbnRlcyI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjc2OiJodHRwczovL2lzcmFjb2xvci5kZG5zLm5ldC9yZXZpc2lvbi80L2NlbnRyYWxlcy80L2VsZW1lbnRvcz92aXN0YT1wZW5kaWVudGVzIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830215),('cvurJeHjNnAXKpFhyYJ26uV94Su7ZNfSmtQDzAj7',NULL,'66.249.93.2','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoid2RMMXFsRkNBaEVDS1E5TGpFY01udUxjRmdDV3Y5SXNLT0tjU1VDdCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830216),('DDkIpmMV4MdKs0Lo4l3O30F0HgGSxDrPZHdCvBP6',NULL,'66.249.93.1','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiaUZ2bkw4UkwxU09veWh3Zk0xMHdONFNwMjljSEJKbXNLN213b0JWWCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759827187),('DEqrFheST8Ra5eJzhSFt9GhdnWicpABCYFKrBHUP',NULL,'66.249.93.3','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiMDlCbXJVSnJ6R1YxTkdidTROUld4aktUcXJ1V1BaemZBYjVhVmJaayI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830216),('DhyAVh4658QcbvDeSZ2YdFqcMIhAbeXtlQTvpTUc',NULL,'162.142.125.45','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoicnNnaTJvUnI0RzJjTkY2MWhCYWgzZnhmcWE0OENVS2FoOTkxRk5yVyI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759862973),('E97P1Rci80pjWvfSrsjQ82ApiBBZCFREAUZkL5FD',NULL,'66.249.93.3','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiam1nTVNEUHo3d2NQdU1kYndpUkxJYWZaOWo2NVMxeVJiR0RTR29tTSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo3MDoiaHR0cHM6Ly9pc3JhY29sb3IuZGRucy5uZXQvcmV2aXNpb24vNC9jZW50cmFsZXMvNC9lbGVtZW50b3M/dmlzdGE9bGF6byI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjcwOiJodHRwczovL2lzcmFjb2xvci5kZG5zLm5ldC9yZXZpc2lvbi80L2NlbnRyYWxlcy80L2VsZW1lbnRvcz92aXN0YT1sYXpvIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830284),('EG1SUYI35mL8Rfxk0wA511mLC2FyFEm2zM85YkEW',NULL,'66.249.93.2','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiZEZXWmI3RlZGZXdEaGx3dXpGdEVQZ1J0cjhNV3NQRGdmeHE3bkpqaCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759827188),('eT222p0cHkeQwoEh5ftnM3NRXgJ9gqeg2E5VG646',1,'194.56.239.84','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36','YTo1OntzOjY6Il90b2tlbiI7czo0MDoidTdhc1N6MDZreHNLNkZlcWM1czR2cTVUaHNrdEFjckcxYjlZaDZTUyI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjUzOiJodHRwczovL2lzcmFjb2xvci5kZG5zLm5ldC9yZXZpc2lvbi82L2NlbnRyYWxlcy9jcmVhciI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==',1759902448),('FXFKJtEj11BP1LB27j0my4MWHtlLJrxL5yJ5AeX7',NULL,'205.210.31.108','Hello from Palo Alto Networks, find out more about our scans in https://docs-cortex.paloaltonetworks.com/r/1/Cortex-Xpanse/Scanning-activity','YTo0OntzOjY6Il90b2tlbiI7czo0MDoianl6eFJmb1lncXpmMlhQZDVWbzl2SDV6NFNaSVBVbFFveW5GWDVTYyI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyNToiaHR0cDovL2lzcmFjb2xvci5kZG5zLm5ldCI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjI1OiJodHRwOi8vaXNyYWNvbG9yLmRkbnMubmV0Ijt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759867108),('ImWHfXbafYFoanf79saQk2evbmNh59FAmv4PGBMD',NULL,'167.94.138.165','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiazk5amg1V3RuMDc0dVNub3pqdEl1VWVPNW1ISDZDRW4xcEx6Um5TMyI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzY6Imh0dHBzOi8vODguMjEuMjI5LjI0NC9pbmljaWFyLXNlc2lvbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=',1759845172),('llIb39sijPrHxi2V5f1UoG966yx5GjR6vD4eXQe3',1,'37.152.84.174','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36','YTo1OntzOjY6Il90b2tlbiI7czo0MDoic05ON3pMU1QzbFdYRFZ4UjFPd3U3WFU0RGxQcExjOXlsSjZvM21sWiI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjU0OiJodHRwczovL2lzcmFjb2xvci5kZG5zLm5ldC9hcGkvcmV2aXNpb24vNC9lc3RhZGlzdGljYXMiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToxO30=',1759831807),('MPLWJ52e7NzKaXmqVCmUI5kGearEwc3jpO3wo86b',NULL,'93.123.109.214','l9tcpid/v1.1.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiTTRlaEVpWHBLUWZTMVBPYnpCeHhhTnIyRE50OEFDOUVOZmJBSUMyUSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759825592),('NSySn4FDGQuutkuZgLFkl8nnTVE2N5hfbQiuptRj',NULL,'66.249.93.1','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiUXNaSExQWUJKRGdBTDFiYnpncjJqRUMweHRreExTM1d2bFU0Z3FZYSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830216),('oqTBgSxRR8lWkRmDYrbIATHvzuv3pnXv8JhS1YUn',NULL,'66.249.83.134','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiWjJtOHBEMVp4enN2ZVJ6Vnl4b0g4RHNMYjV0dXdFRlJQb0ZwcUVoMCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830218),('oR0GYNV5MDMCpjtRiR64dA0r6pYnFesSqPggAESc',NULL,'93.123.109.214','l9tcpid/v1.1.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiZ2w2bmlPcDA3SW1UOEhEUGJqazFSbFduSTNPYjZ4aG0wRWVPR2xZbyI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759859649),('Ozvbw5c4o1vVE55U1Vn2ZDP8h3WcfGhecSKTDhGL',NULL,'66.249.93.1','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiQk51NUlURWo0cGwzbGYxNFhXNDVsaVRtR1d6UUhqSktkOVFUWnkxbSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyNjoiaHR0cHM6Ly9pc3JhY29sb3IuZGRucy5uZXQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyNjoiaHR0cHM6Ly9pc3JhY29sb3IuZGRucy5uZXQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759827187),('peZSZTpHdXGQD7zMrEvhYHSTdAHviRbdquXEHdrV',NULL,'89.248.165.82','','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiaGVFYjZpaWNIVlRXc3dOc0lHWFVFMGlNVFhMdFhBTVN6ZExTcjJxQSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759866550),('QdCbeB2i2DzJHZU3g0pshg8VRVjFqoFDayoC6NmD',NULL,'66.249.93.3','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoidzhnbFBrWEhuMnBERHlVVDd6YlJvMjNUdmhKWWdZWnhXRXRJbFNKRyI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo3MDoiaHR0cHM6Ly9pc3JhY29sb3IuZGRucy5uZXQvcmV2aXNpb24vNC9jZW50cmFsZXMvNC9lbGVtZW50b3M/dmlzdGE9em9uYSI7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjcwOiJodHRwczovL2lzcmFjb2xvci5kZG5zLm5ldC9yZXZpc2lvbi80L2NlbnRyYWxlcy80L2VsZW1lbnRvcz92aXN0YT16b25hIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830217),('QoVFO8PNyYyDK8RcRs4fuLDGyvRfQ7lZ6D0XSlKJ',1,'194.56.239.34','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Mobile Safari/537.36','YTo1OntzOjY6Il90b2tlbiI7czo0MDoiSlhnbHRHc1hBUE1MWElYMmRqNVNTbXFVT1FJVmtrMmpyS3lsdWRFdyI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czozOiJ1cmwiO2E6MDp7fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NzA6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L3JldmlzaW9uLzQvY2VudHJhbGVzLzQvZWxlbWVudG9zP3Zpc3RhPWxhem8iO319',1759830281),('r51WzzGBAkpNdNUdX7Kya6MDIzT2JUhoSenr09P9',NULL,'159.65.41.25','Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoicnFzc3VCOWNkcW04RG5qd0pjMnJtRDl5OW5xbnc2OUo4aG5TTGt6biI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMToiaHR0cHM6Ly84OC4yMS4yMjkuMjQ0Ijt9czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzY6Imh0dHBzOi8vODguMjEuMjI5LjI0NC9pbmljaWFyLXNlc2lvbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=',1759872764),('raB4HrzaTuwQSZn5E7IeIXG9s7bgs4zkyBbEbGBz',NULL,'162.142.125.122','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiWDExYmxpMll6c3JLTTJtZ1JibmFheHk1NFo2SndTc1FySlhLS0d1TyI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzU6Imh0dHA6Ly84OC4yMS4yMjkuMjQ0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759863193),('S4N2pKhBlARik98vANGl2zVWnWbYXz9jT3aroA3x',1,'194.56.239.34','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Mobile Safari/537.36','YTo1OntzOjY6Il90b2tlbiI7czo0MDoicjFCT1VKcHphTkIzaEZJbDRkZjBONWdyMXlZYlBwRTRsUk1GRUVwdyI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjE6e3M6MzoidXJsIjtzOjQxOiJodHRwczovL2lzcmFjb2xvci5kZG5zLm5ldC9pbmljaWFyLXNlc2lvbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==',1759827174),('sA8v0rOibtEi99geuU7SJC818FQEbiL8TacpfuKw',NULL,'66.249.93.1','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiSTRoajdSUE1TNEFjVUJkNlJEMmlIQlQwNzBVWXd6cVpXMlRBWnBsdCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830284),('snWh0jBpHV6MxGeNu4TGvoJhRZbVWyOAFbwIWPm6',NULL,'66.249.93.2','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiUGp4S1JKTlU4M0ZiRGZnbHJoelExTGdONWhlSTFORkhFMkxXTW44dCI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759827188),('U7mrUkrjvjpOLEWlGck5XFGy4vFGm3qN3Dhcuguf',NULL,'66.249.93.2','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoiZFkwWVQ2ODM5MmNxTDVJbEN5QWJMRWwxTmQ2V3RWRzl5ODNZWWIzdyI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830217),('UNVg6pEFo4SaeOipFm3r58NPvIsmlDUL4SPjrBXu',NULL,'66.249.83.134','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36 (compatible; Google-Read-Aloud; +https://support.google.com/webmasters/answer/1061943)','YTozOntzOjY6Il90b2tlbiI7czo0MDoicTQ0bHpibGtNM054N3BxS2t2aW93M2VMVUZNTzdPSkpWNW83T2R1WiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6NDE6Imh0dHBzOi8vaXNyYWNvbG9yLmRkbnMubmV0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759830218),('WcVRWT7YHAxmLMNHDivHkTBNSNpdGn6fTek7Pvww',NULL,'93.123.109.214','l9tcpid/v1.1.0','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiWUxVZEJ4Smp4b0Zlek5IYUhrTFRxVHdIcmhldnVFeVA0R2lkUUkzVSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759831467),('ZKVUftp29dHG1ksC6E1mq58iXmLLjc01qGfzJhwK',NULL,'170.64.237.55','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36','YTozOntzOjY6Il90b2tlbiI7czo0MDoiMkY1VlhCOEtPV0lVbUFIdDNaMzJhY3p3VWZlSTFQWHk0WFhTaXlEcSI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzU6Imh0dHA6Ly84OC4yMS4yMjkuMjQ0L2luaWNpYXItc2VzaW9uIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==',1759839791),('zohfnR1pQPVJbxjsfzZBrWgIxRSOiSznm6BRYKbG',NULL,'162.142.125.122','Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)','YTo0OntzOjY6Il90b2tlbiI7czo0MDoiV1dQT0xuc09veVRCQzA3RGFOQ0dvOWFFeE5waGF5ZE81RU9YdEIyMSI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czoyMDoiaHR0cDovLzg4LjIxLjIyOS4yNDQiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX19',1759863189);

--
-- Table structure for table `template_responses`
--

CREATE TABLE `template_responses` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `template_id` bigint(20) unsigned NOT NULL,
  `source_type` varchar(255) DEFAULT NULL,
  `source_id` bigint(20) unsigned DEFAULT NULL,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`data`)),
  `generated_file_path` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'generated',
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `generated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `template_responses_template_id_generated_at_index` (`template_id`,`generated_at`),
  KEY `template_responses_source_type_source_id_index` (`source_type`,`source_id`),
  KEY `template_responses_user_id_index` (`user_id`),
  CONSTRAINT `template_responses_template_id_foreign` FOREIGN KEY (`template_id`) REFERENCES `templates` (`id`) ON DELETE CASCADE,
  CONSTRAINT `template_responses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `template_responses`
--


--
-- Table structure for table `template_variables`
--

CREATE TABLE `template_variables` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `template_id` bigint(20) unsigned NOT NULL,
  `variable_name` varchar(255) NOT NULL,
  `label` varchar(255) NOT NULL,
  `type` enum('text','number','date','textarea','select','email','tel') NOT NULL,
  `is_required` tinyint(1) NOT NULL DEFAULT 0,
  `default_value` text DEFAULT NULL,
  `options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`options`)),
  `help_text` text DEFAULT NULL,
  `order` int(11) NOT NULL DEFAULT 0,
  `source` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `template_variables_template_id_variable_name_unique` (`template_id`,`variable_name`),
  KEY `template_variables_template_id_order_index` (`template_id`,`order`),
  CONSTRAINT `template_variables_template_id_foreign` FOREIGN KEY (`template_id`) REFERENCES `templates` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `template_variables`
--


--
-- Table structure for table `templates`
--

CREATE TABLE `templates` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `module` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `templates_type_is_active_index` (`type`,`is_active`),
  KEY `templates_module_index` (`module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `templates`
--


--
-- Table structure for table `trabajo_fichajes`
--

CREATE TABLE `trabajo_fichajes` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `tipo_fichaje_id` bigint(20) unsigned NOT NULL,
  `lugar_id` bigint(20) unsigned DEFAULT NULL,
  `tipo_movimiento` enum('entrada','salida','pausa','continuar') NOT NULL DEFAULT 'entrada',
  `fecha_hora` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `status` enum('correcto','incorrecto') NOT NULL DEFAULT 'correcto',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_fichajes_user_id_foreign` (`user_id`),
  KEY `trabajo_fichajes_tipo_fichaje_id_foreign` (`tipo_fichaje_id`),
  KEY `trabajo_fichajes_lugar_id_foreign` (`lugar_id`),
  CONSTRAINT `trabajo_fichajes_lugar_id_foreign` FOREIGN KEY (`lugar_id`) REFERENCES `lugares` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_fichajes_tipo_fichaje_id_foreign` FOREIGN KEY (`tipo_fichaje_id`) REFERENCES `trabajo_fichajes_tipos` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_fichajes_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_fichajes`
--


--
-- Table structure for table `trabajo_fichajes_tipos`
--

CREATE TABLE `trabajo_fichajes_tipos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `tipo_fichaje` enum('Código','Ubicación','QR','NFC','Aplicación') NOT NULL,
  `ubicacion_id` bigint(20) unsigned DEFAULT NULL,
  `codigo` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_fichajes_tipos_user_id_foreign` (`user_id`),
  KEY `trabajo_fichajes_tipos_ubicacion_id_foreign` (`ubicacion_id`),
  CONSTRAINT `trabajo_fichajes_tipos_ubicacion_id_foreign` FOREIGN KEY (`ubicacion_id`) REFERENCES `lugares` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_fichajes_tipos_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_fichajes_tipos`
--


--
-- Table structure for table `trabajo_horas_trabajador`
--

CREATE TABLE `trabajo_horas_trabajador` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `lunes` int(11) NOT NULL DEFAULT 0,
  `martes` int(11) NOT NULL DEFAULT 0,
  `miercoles` int(11) NOT NULL DEFAULT 0,
  `jueves` int(11) NOT NULL DEFAULT 0,
  `viernes` int(11) NOT NULL DEFAULT 0,
  `horas_semanales` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_horas_trabajador_user_id_foreign` (`user_id`),
  CONSTRAINT `trabajo_horas_trabajador_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_horas_trabajador`
--


--
-- Table structure for table `trabajo_parte_materiales`
--

CREATE TABLE `trabajo_parte_materiales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `trabajo_parte_id` bigint(20) unsigned NOT NULL,
  `material_id` bigint(20) unsigned NOT NULL,
  `cantidad` int(11) NOT NULL,
  `observaciones` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_parte_materiales_trabajo_parte_id_foreign` (`trabajo_parte_id`),
  KEY `trabajo_parte_materiales_material_id_foreign` (`material_id`),
  CONSTRAINT `trabajo_parte_materiales_material_id_foreign` FOREIGN KEY (`material_id`) REFERENCES `materiales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_parte_materiales_trabajo_parte_id_foreign` FOREIGN KEY (`trabajo_parte_id`) REFERENCES `trabajo_partes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_parte_materiales`
--


--
-- Table structure for table `trabajo_parte_registros`
--

CREATE TABLE `trabajo_parte_registros` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `trabajo_parte_id` bigint(20) unsigned NOT NULL,
  `trabajo_registro_diario_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `parte_registro_unique` (`trabajo_parte_id`,`trabajo_registro_diario_id`),
  KEY `trabajo_parte_registros_trabajo_registro_diario_id_foreign` (`trabajo_registro_diario_id`),
  CONSTRAINT `trabajo_parte_registros_trabajo_parte_id_foreign` FOREIGN KEY (`trabajo_parte_id`) REFERENCES `trabajo_partes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_parte_registros_trabajo_registro_diario_id_foreign` FOREIGN KEY (`trabajo_registro_diario_id`) REFERENCES `trabajo_registros_diarios` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_parte_registros`
--


--
-- Table structure for table `trabajo_partes`
--

CREATE TABLE `trabajo_partes` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `lugar_id` bigint(20) unsigned NOT NULL,
  `direccion` varchar(255) NOT NULL,
  `poblacion` varchar(255) NOT NULL,
  `observaciones` text DEFAULT NULL,
  `estado` enum('borrador','finalizado','verificado') NOT NULL DEFAULT 'borrador',
  `creado_por` bigint(20) unsigned NOT NULL,
  `verificado_por` bigint(20) unsigned DEFAULT NULL,
  `fecha_verificacion` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_partes_lugar_id_foreign` (`lugar_id`),
  KEY `trabajo_partes_creado_por_foreign` (`creado_por`),
  KEY `trabajo_partes_verificado_por_foreign` (`verificado_por`),
  CONSTRAINT `trabajo_partes_creado_por_foreign` FOREIGN KEY (`creado_por`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_partes_lugar_id_foreign` FOREIGN KEY (`lugar_id`) REFERENCES `lugares` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_partes_verificado_por_foreign` FOREIGN KEY (`verificado_por`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_partes`
--


--
-- Table structure for table `trabajo_registros`
--

CREATE TABLE `trabajo_registros` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `hora_inicio` time NOT NULL,
  `hora_fin` time NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `user_id_2` bigint(20) unsigned DEFAULT NULL,
  `user_id_3` bigint(20) unsigned DEFAULT NULL,
  `user_id_4` bigint(20) unsigned DEFAULT NULL,
  `user_id_5` bigint(20) unsigned DEFAULT NULL,
  `user_id_6` bigint(20) unsigned DEFAULT NULL,
  `user_id_7` bigint(20) unsigned DEFAULT NULL,
  `user_id_8` bigint(20) unsigned DEFAULT NULL,
  `user_id_9` bigint(20) unsigned DEFAULT NULL,
  `user_id_10` bigint(20) unsigned DEFAULT NULL,
  `descripcion` text DEFAULT NULL,
  `materiales` text DEFAULT NULL,
  `verificado` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_registros_user_id_foreign` (`user_id`),
  KEY `trabajo_registros_user_id_2_foreign` (`user_id_2`),
  KEY `trabajo_registros_user_id_3_foreign` (`user_id_3`),
  KEY `trabajo_registros_user_id_4_foreign` (`user_id_4`),
  KEY `trabajo_registros_user_id_5_foreign` (`user_id_5`),
  KEY `trabajo_registros_user_id_6_foreign` (`user_id_6`),
  KEY `trabajo_registros_user_id_7_foreign` (`user_id_7`),
  KEY `trabajo_registros_user_id_8_foreign` (`user_id_8`),
  KEY `trabajo_registros_user_id_9_foreign` (`user_id_9`),
  KEY `trabajo_registros_user_id_10_foreign` (`user_id_10`),
  CONSTRAINT `trabajo_registros_user_id_10_foreign` FOREIGN KEY (`user_id_10`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_2_foreign` FOREIGN KEY (`user_id_2`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_3_foreign` FOREIGN KEY (`user_id_3`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_4_foreign` FOREIGN KEY (`user_id_4`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_5_foreign` FOREIGN KEY (`user_id_5`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_6_foreign` FOREIGN KEY (`user_id_6`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_7_foreign` FOREIGN KEY (`user_id_7`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_8_foreign` FOREIGN KEY (`user_id_8`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_9_foreign` FOREIGN KEY (`user_id_9`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_registros`
--


--
-- Table structure for table `trabajo_registros_diarios`
--

CREATE TABLE `trabajo_registros_diarios` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `fichaje_id` bigint(20) unsigned DEFAULT NULL,
  `fecha` date NOT NULL,
  `hora_inicio` time NOT NULL,
  `hora_fin` time NOT NULL,
  `descripcion_trabajo` text NOT NULL,
  `lugar_id` bigint(20) unsigned NOT NULL,
  `estado` enum('pendiente','en_parte','verificado','aprobado','rechazado') NOT NULL DEFAULT 'pendiente',
  `observaciones` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_registros_diarios_fichaje_id_foreign` (`fichaje_id`),
  KEY `trabajo_registros_diarios_lugar_id_foreign` (`lugar_id`),
  KEY `trabajo_registros_diarios_user_id_fecha_index` (`user_id`,`fecha`),
  KEY `trabajo_registros_diarios_estado_index` (`estado`),
  CONSTRAINT `trabajo_registros_diarios_fichaje_id_foreign` FOREIGN KEY (`fichaje_id`) REFERENCES `trabajo_fichajes` (`id`) ON DELETE SET NULL,
  CONSTRAINT `trabajo_registros_diarios_lugar_id_foreign` FOREIGN KEY (`lugar_id`) REFERENCES `lugares` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_registros_diarios_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_registros_diarios`
--


--
-- Table structure for table `trabajo_registros_materiales`
--

CREATE TABLE `trabajo_registros_materiales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `registro_diario_id` bigint(20) unsigned NOT NULL,
  `material_id` bigint(20) unsigned NOT NULL,
  `cantidad_utilizada` decimal(10,2) NOT NULL,
  `observaciones` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `trabajo_registros_materiales_registro_diario_id_index` (`registro_diario_id`),
  KEY `trabajo_registros_materiales_material_id_index` (`material_id`),
  CONSTRAINT `trabajo_registros_materiales_material_id_foreign` FOREIGN KEY (`material_id`) REFERENCES `materiales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `trabajo_registros_materiales_registro_diario_id_foreign` FOREIGN KEY (`registro_diario_id`) REFERENCES `trabajo_registros_diarios` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `trabajo_registros_materiales`
--



