--
-- Host: localhost    Database: inv
-- ------------------------------------------------------


--
-- Table structure for table `inv_asignaciones`
--

CREATE TABLE `inv_asignaciones` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ciclo_item_id` int(11) NOT NULL,
  `empleado_id` int(11) NOT NULL,
  `monitor_id` int(11) NOT NULL,
  `asignado_por` int(11) NOT NULL,
  `asignado_en` datetime NOT NULL,
  `entregado_en` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ciclo_item_id` (`ciclo_item_id`),
  KEY `empleado_id` (`empleado_id`),
  KEY `monitor_id` (`monitor_id`)
) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `inv_asignaciones`
--


--
-- Table structure for table `inv_ciclo_items`
--

CREATE TABLE `inv_ciclo_items` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ciclo_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `item_variation_id` int(11) DEFAULT NULL,
  `estado` enum('nuevo','asignado','en_proceso','listo','archivado') NOT NULL DEFAULT 'nuevo',
  `creado_en` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_cycle_item` (`ciclo_id`,`item_id`,`item_variation_id`),
  KEY `ciclo_id` (`ciclo_id`),
  KEY `estado` (`estado`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `inv_ciclo_items`
--

INSERT INTO `inv_ciclo_items` VALUES (70,1,2837,NULL,'archivado','2026-02-04 23:19:30'),(71,1,3858,22200,'nuevo','2026-02-04 23:21:45'),(72,1,3858,22201,'nuevo','2026-02-04 23:21:45'),(73,1,3858,22202,'nuevo','2026-02-04 23:21:45'),(74,1,3858,22203,'nuevo','2026-02-04 23:21:45'),(75,1,4572,NULL,'archivado','2026-02-04 23:23:28');

--
-- Table structure for table `inv_ciclos`
--

CREATE TABLE `inv_ciclos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(200) NOT NULL,
  `estado` enum('abierto','en_revision','archivado') NOT NULL DEFAULT 'abierto',
  `creado_por` int(11) NOT NULL,
  `creado_en` datetime NOT NULL,
  `notas` text,
  PRIMARY KEY (`id`),
  KEY `estado` (`estado`),
  KEY `creado_en` (`creado_en`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `inv_ciclos`
--

INSERT INTO `inv_ciclos` VALUES (1,'test','abierto',1,'2026-02-04 19:03:20','testtes'),(2,'Invemntario Arreglo','archivado',1,'2026-02-04 22:38:25','');

--
-- Table structure for table `inv_movimientos`
--

CREATE TABLE `inv_movimientos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tipo` enum('ASIGNAR','CAPTURAR','ENVIAR_REVISION','ARCHIVAR','RECONTAR') NOT NULL,
  `referencia_id` int(11) DEFAULT NULL,
  `usuario_id` int(11) NOT NULL,
  `fecha` datetime NOT NULL,
  `detalle` text,
  PRIMARY KEY (`id`),
  KEY `tipo` (`tipo`),
  KEY `fecha` (`fecha`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `inv_movimientos`
--


--
-- Table structure for table `inv_reconteos`
--

CREATE TABLE `inv_reconteos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ciclo_item_id` int(11) NOT NULL,
  `vitrina_id` int(11) NOT NULL,
  `cantidad` int(11) NOT NULL DEFAULT '0',
  `capturado_por` int(11) NOT NULL,
  `capturado_en` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_reconteo` (`ciclo_item_id`,`vitrina_id`),
  KEY `ciclo_item_id` (`ciclo_item_id`),
  KEY `vitrina_id` (`vitrina_id`)
) ENGINE=InnoDB AUTO_INCREMENT=440 DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `inv_reconteos`
--


--
-- Table structure for table `inv_users`
--

CREATE TABLE `inv_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario` varchar(100) NOT NULL,
  `clave_hash` varchar(255) NOT NULL,
  `rol` enum('admin','monitor','empleado') NOT NULL DEFAULT 'empleado',
  `activo` tinyint(1) NOT NULL DEFAULT '1',
  `creado_en` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `usuario` (`usuario`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `inv_users`
--

INSERT INTO `inv_users` VALUES (1,'admin','$2y$10$KoBVR9okTF7WsxBYih5/D..r3AeLi2V9zcDQsFxO/79L6JHG2ieJ.','admin',1,'2026-02-04 17:50:24'),(2,'ilde','$2y$10$XGoLFVBUZP8yUqlDMQ1spO.OSgr/4TzrjST8UhDP8jy8bCPPG7bp2','monitor',1,'2026-02-04 19:06:03'),(3,'mery','$2y$10$pvfcLdRF7KKMOhpFuFW5eu3pMw0lVZ3y9JB6OM0bIMLN/dKJbzr26','empleado',1,'2026-02-04 19:06:10'),(4,'juan','$2y$10$wNWpC8QMbDB3nF5oAq2RRuXsBMvjLxxwDtE8oRwyUAtKnuKqGQTB2','empleado',0,'2026-02-04 19:06:26'),(5,'yuly','$2y$10$5IVPWuHFbqseJOBi4LcEt.PN2I36ApOIE/h34GmMst5pC4Un6IEJq','monitor',1,'2026-02-04 23:06:27'),(6,'gley','$2y$10$JAe3uUk8zM6t/ImVNAVNteQM9gZIMg4KfXD8X00WEEMtC6lzlyyVy','empleado',1,'2026-02-04 23:06:40'),(7,'sarah','$2y$10$F9zvIOR/rIVzBKQB6Amdz.sGk.j2uHDMFeV/kVuwUpuJAqZuONpRK','empleado',1,'2026-02-04 23:06:52'),(8,'keiber','$2y$10$9fRr4Gh1IvXSJ70qvsfeHeGV5YKMQLPOVh.ropTUHxtOA6BkXzLki','empleado',1,'2026-02-04 23:07:01'),(9,'angeles','$2y$10$PBDwf2Gg.IkDOCoCWtuVCO1nx6Mh1RXCJp7rV28W8xuts3Rmwb7qW','empleado',1,'2026-02-04 23:07:29'),(10,'frank','$2y$10$N.sUdf0NiQXRj4ERSgAp/OlodYizFby5PXqiQjeqwIGTuWl2z5eVq','empleado',1,'2026-02-04 23:07:46'),(11,'buceina','$2y$10$SrtI.9b0PMogcFd89c77M.6eL2lGLQ8TnLEbtfD.7Qm3ZsCMidvVe','empleado',0,'2026-02-04 23:07:56'),(13,'buc','$2y$10$xjO3lav3ljx6i8BZTFAaW.HpvxStdN9BHOvFWEAzImyXv2cn2bxV6','admin',1,'2026-02-04 23:08:21');

--
-- Dumping events for database 'inv'
--

--
-- Dumping routines for database 'inv'
--


