-- MySQL dump 10.13  Distrib 8.0.31, for Win64 (x86_64)
--
-- Host: 127.0.0.1    Database: bd_join
-- ------------------------------------------------------
-- Server version	8.0.31

/*!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 */;
/*!50503 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' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `cache`
--

DROP TABLE IF EXISTS `cache`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache` (
  `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` int NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cache`
--

LOCK TABLES `cache` WRITE;
/*!40000 ALTER TABLE `cache` DISABLE KEYS */;
/*!40000 ALTER TABLE `cache` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cache_locks`
--

DROP TABLE IF EXISTS `cache_locks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache_locks` (
  `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `owner` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` int NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cache_locks`
--

LOCK TABLES `cache_locks` WRITE;
/*!40000 ALTER TABLE `cache_locks` DISABLE KEYS */;
/*!40000 ALTER TABLE `cache_locks` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `categorias`
--

DROP TABLE IF EXISTS `categorias`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `categorias` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `slug` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `color` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'slate',
  `icono` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `descripcion` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `categorias_nombre_unique` (`nombre`),
  UNIQUE KEY `categorias_slug_unique` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `categorias`
--

LOCK TABLES `categorias` WRITE;
/*!40000 ALTER TABLE `categorias` DISABLE KEYS */;
INSERT INTO `categorias` VALUES (1,'Frutos Rojos','frutos-rojos','red','🍓',NULL,'2026-01-10 22:40:34','2026-01-10 22:40:34',NULL),(2,'Frutas','frutas','orange','🍋',NULL,'2026-01-10 22:54:43','2026-01-11 03:52:09',NULL),(3,'Café de Especialidad','cafe-de-especialidad','slate','☕',NULL,'2026-01-10 23:08:24','2026-01-11 03:48:31',NULL),(4,'Chocolates y Granolas','chocolates-y-granolas','stone','🍫',NULL,'2026-01-11 00:43:25','2026-01-11 07:43:00',NULL),(5,'Frescos y Hongos','frescos-y-hongos','sky','🍄',NULL,'2026-01-11 00:43:25','2026-01-11 03:53:08',NULL),(6,'Desayuno y Despensa','desayuno-y-despensa','amber','🥞',NULL,'2026-01-11 00:43:25','2026-01-11 03:45:51',NULL),(7,'Cárnicos','carnicos','red','🥩',NULL,'2026-01-11 00:43:25','2026-01-11 03:46:15',NULL);
/*!40000 ALTER TABLE `categorias` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `clientes`
--

DROP TABLE IF EXISTS `clientes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `clientes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nombre_completo` varchar(150) NOT NULL,
  `tipo_documento` enum('CC','CE','NIT','PASAPORTE') DEFAULT 'CC',
  `numero_documento` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `telefono` varchar(20) NOT NULL,
  `notas_internas` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `clientes`
--

LOCK TABLES `clientes` WRITE;
/*!40000 ALTER TABLE `clientes` DISABLE KEYS */;
/*!40000 ALTER TABLE `clientes` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `detalles_pedido`
--

DROP TABLE IF EXISTS `detalles_pedido`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `detalles_pedido` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `pedido_id` bigint unsigned NOT NULL,
  `producto_id` bigint unsigned NOT NULL,
  `cantidad` int NOT NULL,
  `precio_unitario_venta` decimal(10,2) NOT NULL,
  `subtotal` decimal(10,2) GENERATED ALWAYS AS ((`cantidad` * `precio_unitario_venta`)) STORED,
  PRIMARY KEY (`id`),
  KEY `pedido_id` (`pedido_id`),
  KEY `producto_id` (`producto_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `detalles_pedido`
--

LOCK TABLES `detalles_pedido` WRITE;
/*!40000 ALTER TABLE `detalles_pedido` DISABLE KEYS */;
/*!40000 ALTER TABLE `detalles_pedido` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `direcciones_clientes`
--

DROP TABLE IF EXISTS `direcciones_clientes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `direcciones_clientes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `cliente_id` bigint unsigned NOT NULL,
  `tarifa_zona_id` bigint unsigned DEFAULT NULL,
  `direccion` varchar(200) NOT NULL,
  `barrio` varchar(100) DEFAULT NULL,
  `ciudad` varchar(50) DEFAULT 'Cali',
  `latitud` decimal(10,8) DEFAULT NULL,
  `longitud` decimal(11,8) DEFAULT NULL,
  `es_principal` tinyint(1) DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cliente_id` (`cliente_id`),
  KEY `tarifa_zona_id` (`tarifa_zona_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `direcciones_clientes`
--

LOCK TABLES `direcciones_clientes` WRITE;
/*!40000 ALTER TABLE `direcciones_clientes` DISABLE KEYS */;
/*!40000 ALTER TABLE `direcciones_clientes` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `inventario_historial`
--

DROP TABLE IF EXISTS `inventario_historial`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `inventario_historial` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `producto_id` bigint unsigned NOT NULL,
  `usuario_id` bigint unsigned NOT NULL COMMENT 'Quien realizo la accion',
  `tipo_movimiento` enum('carga_inicial','venta','merma','ajuste_auditoria','devolucion') NOT NULL,
  `cantidad` int NOT NULL COMMENT 'Positivo suma, negativo resta',
  `stock_anterior` int NOT NULL,
  `stock_nuevo` int NOT NULL,
  `observacion` text COMMENT 'Obligatorio si es merna o ajuste',
  `fecha_movimiento` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `producto_id` (`producto_id`),
  KEY `usuario_id` (`usuario_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `inventario_historial`
--

LOCK TABLES `inventario_historial` WRITE;
/*!40000 ALTER TABLE `inventario_historial` DISABLE KEYS */;
INSERT INTO `inventario_historial` VALUES (1,2,1,'carga_inicial',10,0,10,'Carga de cosecha diaria','2026-01-11 08:07:23'),(2,30,1,'carga_inicial',5,7,12,'Carga de cosecha diaria','2026-01-11 08:07:23'),(3,3,1,'devolucion',5,0,5,'Auditoría: Sistema espera 0, Físico reporta 5. Se identifican en bodega','2026-01-11 16:49:48'),(4,1,1,'carga_inicial',20,2,22,'Carga de cosecha diaria','2026-01-12 21:44:53'),(5,9,1,'carga_inicial',10,0,10,'Recontar','2026-01-12 21:44:53');
/*!40000 ALTER TABLE `inventario_historial` ENABLE KEYS */;
UNLOCK TABLES;

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

DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`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 `migrations`
--

LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` VALUES (1,'2026_01_03_124236_add_categoria_id_to_productos_table',1),(2,'2026_01_03_124233_create_categorias_table',2),(3,'2026_01_04_175845_add_lat_long_to_direcciones_clientes_table',3),(4,'2026_01_04_185503_add_avatar_to_users_table',4),(5,'2026_01_04_183135_add_vehicle_fields_to_users_table',5),(6,'2026_01_05_015214_add_direccion_to_users_table',5),(7,'0001_01_01_000001_create_cache_table',6),(8,'2026_01_11_162013_adds_disponible_to_usuarios_table',7),(9,'2026_01_13_095349_add_priority_fields_to_productos_table',8);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `notificaciones_recurrentes`
--

DROP TABLE IF EXISTS `notificaciones_recurrentes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `notificaciones_recurrentes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `cliente_id` bigint unsigned NOT NULL,
  `producto_interes_id` bigint unsigned DEFAULT NULL,
  `frecuencia_dias` int DEFAULT '7' COMMENT 'Cada cuantos dias recordar',
  `fecha_ultima_notificacion` date DEFAULT NULL,
  `mensaje_personalizado` text,
  `activo` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `cliente_id` (`cliente_id`),
  KEY `producto_interes_id` (`producto_interes_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `notificaciones_recurrentes`
--

LOCK TABLES `notificaciones_recurrentes` WRITE;
/*!40000 ALTER TABLE `notificaciones_recurrentes` DISABLE KEYS */;
/*!40000 ALTER TABLE `notificaciones_recurrentes` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `pedidos`
--

DROP TABLE IF EXISTS `pedidos`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pedidos` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `codigo_seguimiento` varchar(36) DEFAULT NULL COMMENT 'UUID o Codigo corto',
  `cliente_id` bigint unsigned NOT NULL,
  `direccion_entrega_id` bigint unsigned NOT NULL,
  `estado` enum('pendiente','confirmado','en_empaque','en_ruta','entregado','cancelado','reprogramado') DEFAULT 'pendiente',
  `fecha_creacion` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `fecha_entrega_programada` date NOT NULL,
  `hora_preferente_entrega` varchar(50) DEFAULT NULL,
  `total_productos` decimal(12,2) DEFAULT '0.00',
  `costo_domicilio` decimal(10,2) DEFAULT '0.00',
  `total_pagar` decimal(12,2) GENERATED ALWAYS AS ((`total_productos` + `costo_domicilio`)) STORED,
  `metodo_pago` enum('efectivo','transferencia','contraentrega') DEFAULT 'contraentrega',
  `estado_pago` enum('pendiente','pagado') DEFAULT 'pendiente',
  `es_regalo` tinyint(1) DEFAULT '0',
  `mensaje_regalo` text,
  `requiere_bolsa_regalo` tinyint(1) DEFAULT '0',
  `destinatario_final_nombre` varchar(100) DEFAULT NULL COMMENT 'Si es diferente al cliente',
  `destinatario_final_telefono` varchar(20) DEFAULT NULL,
  `evidencia_foto_url` varchar(255) DEFAULT NULL,
  `observacion_entrega` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `codigo_seguimiento` (`codigo_seguimiento`),
  KEY `cliente_id` (`cliente_id`),
  KEY `direccion_entrega_id` (`direccion_entrega_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `pedidos`
--

LOCK TABLES `pedidos` WRITE;
/*!40000 ALTER TABLE `pedidos` DISABLE KEYS */;
/*!40000 ALTER TABLE `pedidos` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `productos`
--

DROP TABLE IF EXISTS `productos`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `productos` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `orden` int DEFAULT '0',
  `codigo` varchar(50) DEFAULT NULL,
  `nombre` varchar(100) NOT NULL,
  `icono` varchar(50) DEFAULT NULL,
  `descripcion` text,
  `unidad_medida` varchar(20) DEFAULT 'unidad',
  `peso_gramos` int NOT NULL DEFAULT '0',
  `precio_costo` int DEFAULT '0',
  `precio_venta` int DEFAULT '0',
  `stock_actual` int DEFAULT '0',
  `es_perecedero` tinyint(1) DEFAULT '1',
  `categoria_id` bigint unsigned DEFAULT NULL,
  `es_corporativo` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Si es true, sólo visible para clientes corporativos',
  `es_alta_demanda` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Flag para algoritmo de prioridad',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `productos_codigo_unique` (`codigo`),
  KEY `productos_categoria_id_foreign` (`categoria_id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `productos`
--

LOCK TABLES `productos` WRITE;
/*!40000 ALTER TABLE `productos` DISABLE KEYS */;
INSERT INTO `productos` VALUES (1,1,'T1','Fresas Tipo 1','🍓',NULL,'unid',1050,0,35000,22,1,1,0,0,NULL,'2026-01-11 04:05:00','2026-01-12 21:44:53'),(2,2,'T2','Fresas Tipo 2','🍓',NULL,'unid',550,0,16000,10,1,1,0,0,NULL,'2026-01-11 07:29:24','2026-01-12 21:40:58'),(3,3,'T3','Fresas Tipo 3','🍓',NULL,'UNIDAD',550,0,9000,5,1,1,0,0,NULL,'2026-01-11 07:29:24','2026-01-12 21:40:58'),(4,4,'FbR','Frambuesa Rojas','🍒',NULL,'unid',150,0,20000,0,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:40:58'),(5,5,'FG','Full-Ghee','🍒',NULL,'unid',370,0,42000,0,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:40:58'),(6,6,'AraLib','Arándano 500g','🫐',NULL,'unid',500,0,30000,0,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:40:58'),(7,7,'Ara1/2','Arándano 250g','🫐',NULL,'unid',250,0,19000,0,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:40:58'),(8,8,'Mr','Mora','🍇',NULL,'unid',250,0,20000,0,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:40:58'),(9,9,'Cer','Cereza','🍒',NULL,'UNIDAD',250,0,20000,10,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:44:53'),(10,10,'Drz','Durazno Nectarin','🍑',NULL,'UNIDAD',500,0,18000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-12 21:40:58'),(11,11,'Cir','Ciruela','🍒',NULL,'UNIDAD',500,0,17000,0,1,1,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:06:43'),(12,12,'Grdlla','Granadilla','🟠',NULL,'UNIDAD',750,0,17000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:22:33'),(13,13,'Grd','Granada ???gr','🔴',NULL,'UNIDAD',0,0,33000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:22:42'),(14,14,'Kiwi','Kiwi','🥝',NULL,'unid',500,0,19000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 07:29:25'),(15,15,'Mzn','Manzana royal','🍎',NULL,'unid',500,0,9000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 07:29:25'),(16,16,'MznV','Manzana Verde','🍏',NULL,'unid',450,0,11000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 07:29:25'),(17,17,'Pera','Pera verde','🍐',NULL,'unid',500,0,8000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 07:29:25'),(18,18,'UvL','Uva verde sin semilla','🟢',NULL,'UNIDAD',500,0,20000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:22:58'),(19,19,'CCao','Cacao orgánico en barra','🍫',NULL,'UNIDAD',250,0,26000,0,1,4,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:05:41'),(20,20,'Ore','Orellanas','🍄',NULL,'UNIDAD',300,0,18000,0,1,5,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:05:21'),(21,21,'Pcao','Cacao organico en polvo','🍫',NULL,'UNIDAD',200,0,26000,0,1,4,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:05:10'),(22,22,'GraC','Granola artesanal Chips','🥣',NULL,'UNIDAD',300,0,28000,0,1,4,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:15:16'),(23,23,'GraA','Granola artesanal Arándano','🥣',NULL,'UNIDAD',300,0,28000,0,1,4,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:15:31'),(24,24,'MM','Mantequilla de mani','🧈',NULL,'UNIDAD',250,0,27000,0,1,6,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:03:09'),(25,25,'Miel','Miel pura','🍯',NULL,'unid',600,0,39000,0,1,6,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 07:29:25'),(26,26,'Café','Café de especialidad molido','☕',NULL,'UNIDAD',340,0,42000,0,1,3,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:02:38'),(27,27,'Café grn','Café de especialidad en grano','☕',NULL,'UNIDAD',340,0,42000,0,1,3,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:02:27'),(28,28,'PP','Patitas de pollo','🍗',NULL,'UNIDAD',200,0,16000,0,1,7,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:02:01'),(29,29,'UvR','Uva roja sin semilla','🍇',NULL,'UNIDAD',500,0,20000,0,1,2,0,0,NULL,'2026-01-11 07:29:25','2026-01-11 16:01:44'),(31,30,'AA1','Producto Prueba','🥝',NULL,'LITRO',500,0,10000,5,1,3,0,0,NULL,'2026-01-13 15:19:07','2026-01-13 15:19:07');
/*!40000 ALTER TABLE `productos` ENABLE KEYS */;
UNLOCK TABLES;

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

DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `roles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(50) NOT NULL,
  `descripcion` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

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

LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES (1,'superadmin','Control Total','2026-01-01 23:06:57','2026-01-01 23:06:57'),(2,'asistente','Gestión Pedidos','2026-01-01 23:06:57','2026-01-01 23:06:57'),(3,'empacador','Bodega','2026-01-01 23:06:57','2026-01-01 23:06:57'),(4,'cobrador','Cartera','2026-01-01 23:06:57','2026-01-01 23:06:57'),(5,'domiciliario','Reparto','2026-01-01 23:06:57','2026-01-01 23:06:57');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `ruta_detalles`
--

DROP TABLE IF EXISTS `ruta_detalles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ruta_detalles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `ruta_id` bigint unsigned NOT NULL,
  `pedido_id` bigint unsigned NOT NULL,
  `orden_entrega` int DEFAULT '0' COMMENT 'Secuencia de parada 1, 2, 3...',
  `estado_entrega` enum('pendiente','entregado','fallido','reprogramado') DEFAULT 'pendiente',
  `hora_llegada` datetime DEFAULT NULL,
  `observaciones` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `ruta_id` (`ruta_id`),
  KEY `pedido_id` (`pedido_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ruta_detalles`
--

LOCK TABLES `ruta_detalles` WRITE;
/*!40000 ALTER TABLE `ruta_detalles` DISABLE KEYS */;
/*!40000 ALTER TABLE `ruta_detalles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `rutas`
--

DROP TABLE IF EXISTS `rutas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `rutas` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `domiciliario_id` bigint unsigned NOT NULL,
  `nombre_ruta` varchar(100) DEFAULT NULL COMMENT 'Ej: Norte Mañana',
  `fecha_programada` date NOT NULL,
  `estado` enum('planificacion','en_curso','finalizada','cancelada') DEFAULT 'planificacion',
  `creado_por_id` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `domiciliario_id` (`domiciliario_id`),
  KEY `creado_por_id` (`creado_por_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `rutas`
--

LOCK TABLES `rutas` WRITE;
/*!40000 ALTER TABLE `rutas` DISABLE KEYS */;
/*!40000 ALTER TABLE `rutas` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tarifas_domicilio`
--

DROP TABLE IF EXISTS `tarifas_domicilio`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tarifas_domicilio` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `nombre_zona` varchar(50) NOT NULL,
  `precio_base` decimal(10,2) NOT NULL,
  `activo` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tarifas_domicilio`
--

LOCK TABLES `tarifas_domicilio` WRITE;
/*!40000 ALTER TABLE `tarifas_domicilio` DISABLE KEYS */;
/*!40000 ALTER TABLE `tarifas_domicilio` ENABLE KEYS */;
UNLOCK TABLES;

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

DROP TABLE IF EXISTS `usuarios`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `usuarios` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `rol_id` bigint unsigned NOT NULL,
  `nombre` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `direccion` varchar(255) DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `telefono` varchar(20) DEFAULT NULL,
  `activo` tinyint(1) DEFAULT '1',
  `disponible` tinyint(1) NOT NULL DEFAULT '1',
  `tiene_vehiculo` tinyint(1) NOT NULL DEFAULT '0',
  `tipo_vehiculo` enum('Carro','Moto','Bici') DEFAULT NULL,
  `placa` varchar(10) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  KEY `rol_id` (`rol_id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

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

LOCK TABLES `usuarios` WRITE;
/*!40000 ALTER TABLE `usuarios` DISABLE KEYS */;
INSERT INTO `usuarios` VALUES (1,1,'Sergio Antonio Carabalí','saluz.sergio@gmail.com','Calle 48P Sur #5F-18 Int. 13','avatars/SlKwMWN63yl4BkmBRsdP0ZdSvdlHUMfePtV5yiJg.png','$2y$12$qprywmHMycU6gsSFuuZWdOEXUC0rEjCPSvdRtWU/m/NK66hv1LEsC','3186641951',1,0,0,NULL,NULL,'2026-01-01 23:11:21','2026-01-12 17:58:37'),(12,2,'Cristian Neva','domi2@jointrust.com',NULL,NULL,'$2y$12$/YC7YFYQML0zzuXGaV2UbeEqhb2IwHN.D2PB1qWpGMbgRFmk08tt6','3227328922',1,0,0,NULL,NULL,'2026-01-12 15:06:05','2026-01-12 17:58:37'),(13,5,'Cristian Avila','domi3@jointrust.com',NULL,'avatars/Z3EJq0WvuqviUAjEnsI5UOUvXy0EKAJ9GDBVTuuh.jpg','$2y$12$ojuHLvcmTBm2oc4XatCWgeNAbu68TpH0uQRpZrnjIrE.FZH6CuFge','3502290251',1,1,1,'Moto','SGV458','2026-01-12 15:06:06','2026-01-12 17:44:13'),(14,5,'Yeferson Cabiativa','domi4@jointrust.com',NULL,NULL,'$2y$12$MQUFE.hz19X8rn7ks5PmZunA7aRGd7/ytrj15ueISgqoyuCpl2Ase','3192526163',1,0,0,NULL,NULL,'2026-01-12 15:06:06','2026-01-12 17:44:25'),(15,5,'William Ballesteros','domi5@jointrust.com',NULL,NULL,'$2y$12$QzuxKYEK97KCqA5oF9/UNuH.gJT3bMa2RSDDzrARL/d3UyefgChGS','3112675924',1,0,0,NULL,NULL,'2026-01-12 15:06:06','2026-01-12 17:43:54'),(16,5,'Juan David Martínez','domi6@jointrust.com',NULL,NULL,'$2y$12$7TtnR5XEZczkiy5asS/YBuTYGtLAfzophhJgUc2OLWARDrt4T/nfe','3112849971',1,1,0,NULL,NULL,'2026-01-12 15:06:07','2026-01-12 17:59:25'),(17,3,'Sergio Yopasa','domi7@jointrust.com','Calle 48p Sur # 5F-18','avatars/tO7Ms5B7ZYl7kUWwk5kQC7hsVELmYuZWjogDQAnw.jpg','$2y$12$A8kb/ElY2loQH9iyGrcu4eZAED.8mYQsAi7Z7hlMeRFssHQ4vqiG2','3166832868',1,1,1,'Carro','spa574','2026-01-12 15:06:07','2026-01-12 17:45:41'),(18,5,'Juan Calderón','domi8@jointrust.com',NULL,NULL,'$2y$12$IYEXZ7KTYMYmbZ87eABBdeLkhJvdp4mettsuFX//o2AYF1F.XzPxG','3115818021',1,0,0,NULL,NULL,'2026-01-12 15:06:07','2026-01-12 17:43:54'),(19,5,'Jhony Hernandez','domi9@jointrust.com',NULL,NULL,'$2y$12$tiAO/K8boqGs77.28UzeiubEU/vdK0kZeZQGSnr9iF9QIiZDrf03.','3124827923',1,0,0,NULL,NULL,'2026-01-12 15:06:08','2026-01-12 17:43:54'),(20,5,'Yecit Jiménez','domi10@jointrust.com',NULL,NULL,'$2y$12$SSwghE5j652JKWxL2fFVa.oMxwPFbF622EL04leiVP6pv/lXbw85q','3143334096',1,0,0,NULL,NULL,'2026-01-12 15:06:08','2026-01-12 17:44:25'),(21,5,'Carlos Poveda','domi11@jointrust.com',NULL,NULL,'$2y$12$iZ5IDcZWy/6birghsERqueW5ptzNrG4krMjXW9oDUMzAz5Pnb.vE6','3105766771',1,0,0,NULL,NULL,'2026-01-12 15:06:09','2026-01-12 17:59:39');
/*!40000 ALTER TABLE `usuarios` 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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-01-13  6:00:58
