--
-- Host: localhost    Database: cashier_assistant
-- ------------------------------------------------------


--
-- Table structure for table `messenger_messages`
--

CREATE TABLE `messenger_messages` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `body` longtext NOT NULL,
  `headers` longtext NOT NULL,
  `queue_name` varchar(190) NOT NULL,
  `created_at` datetime NOT NULL,
  `available_at` datetime NOT NULL,
  `delivered_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_75EA56E0FB7336F0` (`queue_name`),
  KEY `IDX_75EA56E0E3BD61CE` (`available_at`),
  KEY `IDX_75EA56E016BA31DB` (`delivered_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `messenger_messages`
--


--
-- Table structure for table `offers`
--

CREATE TABLE `offers` (
  `id` varchar(36) NOT NULL,
  `quantity` int(11) NOT NULL,
  `price_cents` int(11) NOT NULL,
  `is_deleted` tinyint(4) NOT NULL,
  `updated_at` datetime NOT NULL,
  `product_id` varchar(36) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_DA4604274584665A` (`product_id`),
  CONSTRAINT `FK_DA4604274584665A` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `offers`
--

INSERT INTO `offers` VALUES ('382330a5-8027-4602-b1f9-3b2f6d7fc899',2,400,0,'2026-08-11 01:28:20','ae6b23f0-5a8d-4928-b635-8059e0ff5b1e');

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` varchar(36) NOT NULL,
  `barcode` varchar(64) NOT NULL,
  `name` varchar(160) NOT NULL,
  `brand` varchar(120) DEFAULT NULL,
  `category` varchar(40) NOT NULL,
  `price_cents` int(11) NOT NULL,
  `size` double DEFAULT NULL,
  `size_label` varchar(40) DEFAULT NULL,
  `stock_on_hand` int(11) NOT NULL,
  `reorder_point` int(11) NOT NULL,
  `is_tax_allowed` tinyint(4) NOT NULL,
  `is_favorite` tinyint(4) NOT NULL,
  `is_deleted` tinyint(4) NOT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `image_url` varchar(255) DEFAULT NULL,
  `sync_status` varchar(20) NOT NULL,
  `client_id` varchar(36) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `store_id` varchar(36) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_store_barcode_unique` (`store_id`,`barcode`),
  KEY `IDX_B3BA5A5AB092A811` (`store_id`),
  KEY `products_store_name_idx` (`store_id`,`name`),
  CONSTRAINT `FK_B3BA5A5AB092A811` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `products`
--

INSERT INTO `products` VALUES ('0361e92e-59cd-4323-b680-53fede5ee593','06717401','Dasani Water','Dasani','softDrink',149,591,'591 ml',2,10,0,0,0,NULL,NULL,'synced',NULL,'2026-08-11 01:28:20','2026-08-11 01:28:20','8241c908-a268-4867-85dc-e6714e489812'),('726aec6a-98ec-4e8d-bf13-8fca8957704d','0123456789012','Salted Chips','Store Brand','grocery',199,NULL,NULL,25,6,1,0,0,NULL,NULL,'synced',NULL,'2026-08-11 01:28:20','2026-08-11 01:28:20','8241c908-a268-4867-85dc-e6714e489812'),('ae6b23f0-5a8d-4928-b635-8059e0ff5b1e','5449000000996','Coca-Cola Original Taste','Coca-Cola','softDrink',250,500,'500 ml',4,8,1,0,0,NULL,NULL,'synced',NULL,'2026-08-11 01:28:20','2026-08-11 01:28:20','8241c908-a268-4867-85dc-e6714e489812');

--
-- Table structure for table `sale_lines`
--

CREATE TABLE `sale_lines` (
  `id` varchar(36) NOT NULL,
  `barcode` varchar(64) NOT NULL,
  `name_snapshot` varchar(180) NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price_cents` int(11) NOT NULL,
  `offer_id` varchar(36) DEFAULT NULL,
  `line_subtotal_cents` int(11) NOT NULL,
  `line_tax_cents` int(11) NOT NULL,
  `tax_basis_points` int(11) NOT NULL,
  `sale_id` varchar(36) NOT NULL,
  `product_id` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_9FDDD4154A7E4868` (`sale_id`),
  KEY `IDX_9FDDD4154584665A` (`product_id`),
  CONSTRAINT `FK_9FDDD4154584665A` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  CONSTRAINT `FK_9FDDD4154A7E4868` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `sale_lines`
--

INSERT INTO `sale_lines` VALUES ('2d70187f-3840-4c4f-a41c-6fea867c972a','5449000000996','Coca-Cola Original Taste',2,250,NULL,400,52,1300,'e4ebb467-45d5-4fe8-9249-9753b726ea39','ae6b23f0-5a8d-4928-b635-8059e0ff5b1e');

--
-- Table structure for table `sales`
--

CREATE TABLE `sales` (
  `id` varchar(36) NOT NULL,
  `sale_number` varchar(40) NOT NULL,
  `status` varchar(20) NOT NULL,
  `payment_method` varchar(20) NOT NULL,
  `subtotal_cents` int(11) NOT NULL,
  `tax_cents` int(11) NOT NULL,
  `total_cents` int(11) NOT NULL,
  `cash_tendered_cents` int(11) DEFAULT NULL,
  `change_due_cents` int(11) DEFAULT NULL,
  `device_id` varchar(64) NOT NULL,
  `void_reason` varchar(255) DEFAULT NULL,
  `sync_status` varchar(20) NOT NULL,
  `client_id` varchar(36) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `store_id` varchar(36) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sales_store_number_unique` (`store_id`,`sale_number`),
  KEY `IDX_6B817044B092A811` (`store_id`),
  KEY `sales_store_created_idx` (`store_id`,`created_at`),
  CONSTRAINT `FK_6B817044B092A811` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `sales`
--

INSERT INTO `sales` VALUES ('e4ebb467-45d5-4fe8-9249-9753b726ea39','CA-DEMO-0001','completed','cash',400,52,452,500,48,'demo-device',NULL,'synced',NULL,'2026-08-11 01:28:20','2026-08-11 01:28:20','8241c908-a268-4867-85dc-e6714e489812');

--
-- Table structure for table `stores`
--

CREATE TABLE `stores` (
  `id` varchar(36) NOT NULL,
  `name` varchar(160) NOT NULL,
  `code` varchar(64) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ_D5907CCC77153098` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `stores`
--

INSERT INTO `stores` VALUES ('8241c908-a268-4867-85dc-e6714e489812','Maraj Convenience','MARAJ-01','Local store','2026-08-11 01:28:20','2026-08-11 01:28:20');


