-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 14-01-2026 a las 17:35:32
-- Versión del servidor: 10.6.24-MariaDB
-- Versión de PHP: 8.4.16

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!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 */;

--
-- Base de datos: `shopcr_BDI`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `brands`
--

CREATE TABLE `brands` (
  `id_brand` int(11) NOT NULL,
  `name_brand` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `reference_brand` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `inserted_brand` int(11) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `brands`
--

INSERT INTO `brands` (`id_brand`, `name_brand`, `reference_brand`, `is_active`, `inserted_brand`, `created_at`, `updated_at`) VALUES
(1, 'Santa Lights Co', 'SLC001', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(2, 'Frosty Deco', 'FDC002', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(3, 'North Pole Crafts', 'NPC003', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(4, 'Reindeer Spark', 'RDS004', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(5, 'Snowflake Designs', 'SND005', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(6, 'Magic Elf Works', 'MEW006', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(7, 'Holiday Glow', 'HDG007', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(8, 'Candy Cane Factory', 'CCF008', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(9, 'JingleBell Creations', 'JBC009', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03'),
(10, 'WinterStar Products', 'WSP010', 1, 1, '2026-01-10 14:27:03', '2026-01-10 14:27:03');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `categories`
--

CREATE TABLE `categories` (
  `id_category` int(11) NOT NULL,
  `name_category` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `level_category` int(11) NOT NULL DEFAULT 0,
  `reference_father_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `reference_category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `inserted_category` int(11) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `categories`
--

INSERT INTO `categories` (`id_category`, `name_category`, `level_category`, `reference_father_category`, `reference_category`, `is_active`, `inserted_category`, `created_at`, `updated_at`) VALUES
(1, 'Navidad', 1, '0', 'Nav-1', 1, 1, '2026-01-10 14:25:08', '2026-01-10 14:25:08'),
(2, 'Arboles', 2, 'Nav-1', 'Nav-2', 1, 1, '2026-01-10 14:25:09', '2026-01-10 14:25:09'),
(3, 'Luces', 2, 'Nav-1', 'Nav-3', 1, 1, '2026-01-10 14:25:09', '2026-01-10 14:25:09'),
(4, 'Pelotas', 2, 'Nav-1', 'Nav-4', 1, 1, '2026-01-10 14:25:09', '2026-01-10 14:25:09'),
(5, 'Guirnalda', 2, 'Nav-1', 'Nav-5', 1, 1, '2026-01-10 14:25:09', '2026-01-10 14:25:09'),
(6, 'Muñecos', 2, 'Nav-1', 'Nav-6', 1, 1, '2026-01-10 14:33:29', '2026-01-10 14:33:29');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `clients`
--

CREATE TABLE `clients` (
  `id` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `failed_attempts` int(11) NOT NULL DEFAULT 0,
  `locked_until` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `clients`
--

INSERT INTO `clients` (`id`, `username`, `password_hash`, `is_active`, `failed_attempts`, `locked_until`, `created_at`, `updated_at`) VALUES
(1, 'Soporte', '$2y$10$4J7qyEpgzsQ3YC0jyuJcJ.rTlr2IjFiqtKTTzZPMk1Ub7lDep3VHO', 1, 0, NULL, '0000-00-00 00:00:00', '2026-01-10 16:52:44');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `companies`
--

CREATE TABLE `companies` (
  `id` int(11) NOT NULL,
  `name_company` varchar(100) NOT NULL,
  `cedula_company` varchar(100) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `companies`
--

INSERT INTO `companies` (`id`, `name_company`, `cedula_company`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Soporte Arthis', '30909090909', 1, '2026-01-13 22:46:20', '2026-01-13 22:55:14');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `licenses`
--

CREATE TABLE `licenses` (
  `id` int(11) NOT NULL,
  `client_id` int(11) NOT NULL,
  `company_id` int(11) NOT NULL,
  `license_key` varchar(100) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `expires_at` datetime DEFAULT NULL,
  `last_revoked_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `licenses`
--

INSERT INTO `licenses` (`id`, `client_id`, `company_id`, `license_key`, `is_active`, `created_at`, `expires_at`, `last_revoked_at`) VALUES
(1, 1, 1, '659da2d5ebb07824bb0a954d', 1, '2026-01-10 14:31:03', '2028-01-04 23:59:59', '2026-01-13 22:00:25');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `products`
--

CREATE TABLE `products` (
  `id_product` int(11) NOT NULL,
  `reference_product` varchar(200) NOT NULL,
  `reference_category_product` varchar(100) NOT NULL,
  `reference_brand_product` varchar(100) NOT NULL,
  `name_product` varchar(250) NOT NULL,
  `name_short_product` varchar(250) NOT NULL,
  `description_product` varchar(500) DEFAULT NULL,
  `cost_product` decimal(10,2) NOT NULL,
  `price_sale_product` decimal(10,2) NOT NULL COMMENT 'Precio de venta SIN impuesto',
  `quantity_product` decimal(10,2) NOT NULL,
  `tax_product` decimal(10,2) NOT NULL COMMENT 'Porcentaje de impuesto',
  `weight_product` decimal(10,2) DEFAULT NULL COMMENT 'Peso en kg',
  `width_product` decimal(10,2) DEFAULT NULL COMMENT 'Ancho en cms',
  `high_product` decimal(10,2) DEFAULT NULL COMMENT 'Alto en cms',
  `cubicaje_product` decimal(10,2) DEFAULT NULL COMMENT 'Cubicaje en cms',
  `is_active` tinyint(1) NOT NULL COMMENT '1 = Activo, 0 = Inactivo',
  `inserted_product` int(11) NOT NULL COMMENT '1 = Insertado en tienda, 0 = Pendiente',
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `products`
--

INSERT INTO `products` (`id_product`, `reference_product`, `reference_category_product`, `reference_brand_product`, `name_product`, `name_short_product`, `description_product`, `cost_product`, `price_sale_product`, `quantity_product`, `tax_product`, `weight_product`, `width_product`, `high_product`, `cubicaje_product`, `is_active`, `inserted_product`, `created_at`, `updated_at`) VALUES
(1, 'NAV-001', 'Nav-2', 'SLC001', 'Árbol de Navidad 180cm', 'Árbol Navidad 180cm', 'Árbol artificial de navidad con base metálica', 25000.00, 29327.73, 50.00, 19.00, 8.50, 120.00, 180.00, 21600.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(2, 'NAV-002', 'Nav-3', 'SLC001', 'Luces LED Navideñas 100 luces', 'Luces LED Navidad', 'Serie de luces LED blancas para decoración navideña', 5500.00, 7563.03, 200.00, 19.00, 0.80, 15.00, 10.00, 1500.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(3, 'NAV-003', 'Nav-4', 'SLC001', 'Esfera Navideña Roja x12', 'Esferas Rojas x12', 'Set de 12 esferas navideñas color rojo', 4200.00, 6302.52, 150.00, 19.00, 0.60, 20.00, 10.00, 2000.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(4, 'NAV-004', 'Nav-5', 'SLC001', 'Guirnalda Navideña Verde', 'Guirnalda Navidad', 'Guirnalda verde decorativa para navidad', 3800.00, 5462.18, 100.00, 19.00, 1.20, 200.00, 20.00, 4000.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(5, 'NAV-005', 'Nav-6', 'SLC001', 'Nacimiento Navideño 10 piezas', 'Nacimiento Navidad', 'Nacimiento clásico con 10 figuras pintadas a mano', 12000.00, 18487.39, 40.00, 19.00, 4.50, 60.00, 35.00, 8400.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(6, 'NAV-006', 'Nav-2', 'SLC001', 'Corona Navideña Decorada', 'Corona Navidad', 'Corona navideña con adornos y luces', 6200.00, 9243.70, 80.00, 19.00, 1.80, 45.00, 45.00, 2025.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(7, 'NAV-007', 'Nav-2', 'SLC001', 'Bota Navideña Decorativa', 'Bota Navidad', 'Bota decorativa para regalos navideños', 1800.00, 3361.34, 300.00, 19.00, 0.30, 25.00, 40.00, 1000.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(8, 'NAV-008', 'Nav-2', 'SLC001', 'Estrella Punta Árbol', 'Estrella Árbol', 'Estrella dorada para la punta del árbol de navidad', 2600.00, 4201.68, 120.00, 19.00, 0.50, 30.00, 30.00, 900.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(9, 'NAV-009', 'Nav-6', 'SLC001', 'Muñeco de Nieve Decorativo', 'Muñeco Nieve', 'Muñeco de nieve decorativo para interiores', 7400.00, 11344.54, 60.00, 19.00, 3.20, 50.00, 80.00, 4000.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23'),
(10, 'NAV-010', 'Nav-6', 'SLC001', 'Santa Claus Decorativo 60cm', 'Santa Claus 60cm', 'Figura decorativa de Santa Claus de 60 cm', 9800.00, 15126.05, 45.00, 19.00, 5.00, 40.00, 60.00, 2400.00, 1, 0, '2026-01-10 14:29:51', '2026-01-10 14:42:23');

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id_brand`);

--
-- Indices de la tabla `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id_category`);

--
-- Indices de la tabla `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD KEY `idx_clients_active` (`is_active`);

--
-- Indices de la tabla `companies`
--
ALTER TABLE `companies`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `licenses`
--
ALTER TABLE `licenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_license_key` (`license_key`),
  ADD KEY `idx_client_license` (`client_id`,`license_key`),
  ADD KEY `fk_licenses_company` (`company_id`);

--
-- Indices de la tabla `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id_product`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `brands`
--
ALTER TABLE `brands`
  MODIFY `id_brand` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT de la tabla `categories`
--
ALTER TABLE `categories`
  MODIFY `id_category` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT de la tabla `clients`
--
ALTER TABLE `clients`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `companies`
--
ALTER TABLE `companies`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `licenses`
--
ALTER TABLE `licenses`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `products`
--
ALTER TABLE `products`
  MODIFY `id_product` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `licenses`
--
ALTER TABLE `licenses`
  ADD CONSTRAINT `fk_licenses_client` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_licenses_company` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON UPDATE CASCADE;
COMMIT;

/*!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 */;
