﻿-- MariaDB dump 10.19  Distrib 10.4.32-MariaDB, for Win64 (AMD64)
--
-- Host: localhost    Database: ncpos
-- ------------------------------------------------------
-- Server version	10.4.32-MariaDB

/*!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 */;
/*!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 */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB 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 */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB 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 `card_handover_items`
--

DROP TABLE IF EXISTS `card_handover_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `card_handover_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `card_handover_id` bigint(20) unsigned NOT NULL,
  `tcg_game` varchar(100) DEFAULT NULL,
  `card_name` varchar(255) NOT NULL,
  `set_name` varchar(255) DEFAULT NULL,
  `card_number` varchar(100) DEFAULT NULL,
  `quantity` int(10) unsigned NOT NULL DEFAULT 1,
  `condition_note` varchar(500) DEFAULT NULL,
  `remarks` varchar(500) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `card_handover_items_card_handover_id_foreign` (`card_handover_id`),
  CONSTRAINT `card_handover_items_card_handover_id_foreign` FOREIGN KEY (`card_handover_id`) REFERENCES `card_handovers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `card_handover_items`
--

LOCK TABLES `card_handover_items` WRITE;
/*!40000 ALTER TABLE `card_handover_items` DISABLE KEYS */;
/*!40000 ALTER TABLE `card_handover_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `card_handover_logs`
--

DROP TABLE IF EXISTS `card_handover_logs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `card_handover_logs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `card_handover_id` bigint(20) unsigned NOT NULL,
  `action` varchar(255) NOT NULL,
  `old_status` varchar(255) DEFAULT NULL,
  `new_status` varchar(255) DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `by_staff_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `card_handover_logs_card_handover_id_foreign` (`card_handover_id`),
  KEY `card_handover_logs_by_staff_id_foreign` (`by_staff_id`),
  CONSTRAINT `card_handover_logs_by_staff_id_foreign` FOREIGN KEY (`by_staff_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `card_handover_logs_card_handover_id_foreign` FOREIGN KEY (`card_handover_id`) REFERENCES `card_handovers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `card_handover_logs`
--

LOCK TABLES `card_handover_logs` WRITE;
/*!40000 ALTER TABLE `card_handover_logs` DISABLE KEYS */;
INSERT INTO `card_handover_logs` VALUES (1,1,'created',NULL,'awaiting_pickup','Handover created.',1,'2026-04-21 01:57:54','2026-04-21 01:57:54'),(2,1,'updated','awaiting_pickup','awaiting_pickup','Handover details updated.',1,'2026-04-21 01:58:59','2026-04-21 01:58:59'),(3,1,'collected','awaiting_pickup','collected','code match',1,'2026-04-21 02:00:37','2026-04-21 02:00:37');
/*!40000 ALTER TABLE `card_handover_logs` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `card_handovers`
--

DROP TABLE IF EXISTS `card_handovers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `card_handovers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `handover_code` varchar(255) NOT NULL,
  `dropped_by_member_id` bigint(20) unsigned DEFAULT NULL,
  `dropped_by_name` varchar(255) NOT NULL,
  `dropped_by_phone` varchar(50) NOT NULL,
  `recipient_member_id` bigint(20) unsigned DEFAULT NULL,
  `recipient_name` varchar(255) NOT NULL,
  `recipient_phone` varchar(50) NOT NULL,
  `item_summary` text NOT NULL,
  `total_quantity` int(10) unsigned NOT NULL DEFAULT 1,
  `status` varchar(255) NOT NULL DEFAULT 'awaiting_pickup',
  `storage_location` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `verification_note` text DEFAULT NULL,
  `dropped_at` datetime NOT NULL,
  `collected_at` datetime DEFAULT NULL,
  `collected_by_name` varchar(255) DEFAULT NULL,
  `released_by_staff_id` bigint(20) unsigned DEFAULT NULL,
  `created_by_staff_id` bigint(20) unsigned NOT NULL,
  `updated_by_staff_id` bigint(20) unsigned DEFAULT NULL,
  `expires_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `card_handovers_handover_code_unique` (`handover_code`),
  KEY `card_handovers_dropped_by_member_id_foreign` (`dropped_by_member_id`),
  KEY `card_handovers_recipient_member_id_foreign` (`recipient_member_id`),
  KEY `card_handovers_released_by_staff_id_foreign` (`released_by_staff_id`),
  KEY `card_handovers_created_by_staff_id_foreign` (`created_by_staff_id`),
  KEY `card_handovers_updated_by_staff_id_foreign` (`updated_by_staff_id`),
  KEY `card_handovers_status_index` (`status`),
  KEY `card_handovers_dropped_by_phone_index` (`dropped_by_phone`),
  KEY `card_handovers_recipient_phone_index` (`recipient_phone`),
  KEY `card_handovers_dropped_at_index` (`dropped_at`),
  CONSTRAINT `card_handovers_created_by_staff_id_foreign` FOREIGN KEY (`created_by_staff_id`) REFERENCES `users` (`id`),
  CONSTRAINT `card_handovers_dropped_by_member_id_foreign` FOREIGN KEY (`dropped_by_member_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `card_handovers_recipient_member_id_foreign` FOREIGN KEY (`recipient_member_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `card_handovers_released_by_staff_id_foreign` FOREIGN KEY (`released_by_staff_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `card_handovers_updated_by_staff_id_foreign` FOREIGN KEY (`updated_by_staff_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `card_handovers`
--

LOCK TABLES `card_handovers` WRITE;
/*!40000 ALTER TABLE `card_handovers` DISABLE KEYS */;
INSERT INTO `card_handovers` VALUES (1,'HO-20260421-0001',NULL,'Zamir','0187818177',NULL,'Syamsul','0146909803','barang card',1,'collected','Sheft',NULL,'code match','2026-04-21 09:57:54','2026-04-21 10:00:37','Syamsul',1,1,1,'2026-06-29 00:00:00','2026-04-21 01:57:54','2026-04-21 02:00:37');
/*!40000 ALTER TABLE `card_handovers` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `customers`
--

DROP TABLE IF EXISTS `customers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `member_code` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `current_level_id` bigint(20) unsigned DEFAULT NULL,
  `current_cycle_stamps` int(10) unsigned NOT NULL DEFAULT 0,
  `lifetime_stamps` int(10) unsigned NOT NULL DEFAULT 0,
  `loyalty_joined_at` timestamp NULL DEFAULT NULL,
  `level_expires_at` timestamp NULL DEFAULT NULL,
  `points_balance` int(11) NOT NULL DEFAULT 0,
  `total_spent` decimal(12,2) NOT NULL DEFAULT 0.00,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `customers_member_code_unique` (`member_code`),
  UNIQUE KEY `customers_email_unique` (`email`),
  UNIQUE KEY `customers_phone_unique` (`phone`),
  KEY `customers_current_level_id_foreign` (`current_level_id`),
  CONSTRAINT `customers_current_level_id_foreign` FOREIGN KEY (`current_level_id`) REFERENCES `member_levels` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `customers`
--

LOCK TABLES `customers` WRITE;
/*!40000 ALTER TABLE `customers` DISABLE KEYS */;
INSERT INTO `customers` VALUES (1,'CUST-00001','Sample Member','member@example.test','010-000-0001',1,0,0,'2026-04-21 03:27:39',NULL,0,0.00,1,NULL,'2026-04-20 14:22:57','2026-04-21 03:27:39'),(2,'CUST-260421-8003','Zamir Saufi','zamirsaufi97@gmail.com','0187818177',1,1,1,'2026-04-21 01:44:29',NULL,747,747.50,1,NULL,'2026-04-21 01:44:29','2026-04-21 03:02:22');
/*!40000 ALTER TABLE `customers` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `expense_categories`
--

DROP TABLE IF EXISTS `expense_categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `expense_categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `expense_categories_slug_unique` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `expense_categories`
--

LOCK TABLES `expense_categories` WRITE;
/*!40000 ALTER TABLE `expense_categories` DISABLE KEYS */;
INSERT INTO `expense_categories` VALUES (1,'Rent','rent','2026-04-18 13:29:12','2026-04-18 13:29:12'),(2,'Payroll','payroll','2026-04-18 13:29:12','2026-04-18 13:29:12'),(3,'Shipping','shipping','2026-04-18 13:29:12','2026-04-18 13:29:12'),(4,'Marketing','marketing','2026-04-18 13:29:12','2026-04-18 13:29:12'),(5,'Events','events','2026-04-18 13:29:12','2026-04-18 13:29:12');
/*!40000 ALTER TABLE `expense_categories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `expenses`
--

DROP TABLE IF EXISTS `expenses`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `expenses` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `category_id` bigint(20) unsigned DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `expense_date` date NOT NULL,
  `vendor` varchar(255) DEFAULT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `expenses_category_id_foreign` (`category_id`),
  KEY `expenses_created_by_foreign` (`created_by`),
  KEY `expenses_expense_date_index` (`expense_date`),
  CONSTRAINT `expenses_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `expense_categories` (`id`) ON DELETE SET NULL,
  CONSTRAINT `expenses_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `expenses`
--

LOCK TABLES `expenses` WRITE;
/*!40000 ALTER TABLE `expenses` DISABLE KEYS */;
/*!40000 ALTER TABLE `expenses` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `loyalty_level_histories`
--

DROP TABLE IF EXISTS `loyalty_level_histories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `loyalty_level_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` bigint(20) unsigned NOT NULL,
  `old_level_id` bigint(20) unsigned DEFAULT NULL,
  `new_level_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `stamps_used` int(10) unsigned NOT NULL DEFAULT 0,
  `upgraded_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `loyalty_level_histories_old_level_id_foreign` (`old_level_id`),
  KEY `loyalty_level_histories_new_level_id_foreign` (`new_level_id`),
  KEY `loyalty_level_histories_user_id_foreign` (`user_id`),
  KEY `loyalty_level_histories_customer_id_upgraded_at_index` (`customer_id`,`upgraded_at`),
  CONSTRAINT `loyalty_level_histories_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loyalty_level_histories_new_level_id_foreign` FOREIGN KEY (`new_level_id`) REFERENCES `member_levels` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loyalty_level_histories_old_level_id_foreign` FOREIGN KEY (`old_level_id`) REFERENCES `member_levels` (`id`) ON DELETE SET NULL,
  CONSTRAINT `loyalty_level_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `loyalty_level_histories`
--

LOCK TABLES `loyalty_level_histories` WRITE;
/*!40000 ALTER TABLE `loyalty_level_histories` DISABLE KEYS */;
/*!40000 ALTER TABLE `loyalty_level_histories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `loyalty_point_transactions`
--

DROP TABLE IF EXISTS `loyalty_point_transactions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `loyalty_point_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` bigint(20) unsigned NOT NULL,
  `sale_id` bigint(20) unsigned DEFAULT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `type` varchar(255) NOT NULL,
  `points_change` int(11) NOT NULL,
  `balance_before` int(11) NOT NULL,
  `balance_after` int(11) NOT NULL,
  `money_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `loyalty_point_transactions_sale_id_foreign` (`sale_id`),
  KEY `loyalty_point_transactions_user_id_foreign` (`user_id`),
  KEY `loyalty_point_transactions_customer_id_created_at_index` (`customer_id`,`created_at`),
  CONSTRAINT `loyalty_point_transactions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loyalty_point_transactions_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE SET NULL,
  CONSTRAINT `loyalty_point_transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `loyalty_point_transactions`
--

LOCK TABLES `loyalty_point_transactions` WRITE;
/*!40000 ALTER TABLE `loyalty_point_transactions` DISABLE KEYS */;
INSERT INTO `loyalty_point_transactions` VALUES (1,1,4,1,'earned',250,0,250,0.00,'Earned from sale S-20260421024049-486','2026-04-20 18:40:49','2026-04-20 18:40:49'),(2,2,6,1,'earned',250,0,250,0.00,'Earned from sale S-20260421094752-366','2026-04-21 01:47:52','2026-04-21 01:47:52'),(3,2,7,1,'earned',250,250,500,0.00,'Earned from sale S-20260421100611-749','2026-04-21 02:06:11','2026-04-21 02:06:11'),(4,2,8,1,'earned',247,500,747,0.00,'Earned from sale S-20260421110222-188','2026-04-21 03:02:22','2026-04-21 03:02:22');
/*!40000 ALTER TABLE `loyalty_point_transactions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `loyalty_stamp_transactions`
--

DROP TABLE IF EXISTS `loyalty_stamp_transactions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `loyalty_stamp_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `customer_id` bigint(20) unsigned NOT NULL,
  `sale_id` bigint(20) unsigned DEFAULT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `stamp_count` int(11) NOT NULL,
  `week_key` varchar(255) DEFAULT NULL,
  `type` enum('earned','revoked','adjusted','level_up_reset') NOT NULL,
  `notes` text DEFAULT NULL,
  `needs_manual_review` tinyint(1) NOT NULL DEFAULT 0,
  `earned_sale_id` bigint(20) unsigned DEFAULT NULL,
  `weekly_earned_key` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `loyalty_stamp_transactions_earned_sale_id_unique` (`earned_sale_id`),
  UNIQUE KEY `loyalty_stamp_transactions_weekly_earned_key_unique` (`weekly_earned_key`),
  KEY `loyalty_stamp_transactions_sale_id_foreign` (`sale_id`),
  KEY `loyalty_stamp_transactions_user_id_foreign` (`user_id`),
  KEY `loyalty_stamp_transactions_customer_id_type_created_at_index` (`customer_id`,`type`,`created_at`),
  KEY `loyalty_stamp_transactions_week_key_index` (`week_key`),
  CONSTRAINT `loyalty_stamp_transactions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loyalty_stamp_transactions_earned_sale_id_foreign` FOREIGN KEY (`earned_sale_id`) REFERENCES `sales` (`id`) ON DELETE SET NULL,
  CONSTRAINT `loyalty_stamp_transactions_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE SET NULL,
  CONSTRAINT `loyalty_stamp_transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `loyalty_stamp_transactions`
--

LOCK TABLES `loyalty_stamp_transactions` WRITE;
/*!40000 ALTER TABLE `loyalty_stamp_transactions` DISABLE KEYS */;
INSERT INTO `loyalty_stamp_transactions` VALUES (1,1,4,1,1,'2026-W17','earned','Earned from sale S-20260421024049-486.',0,4,'1:2026-W17','2026-04-20 18:40:49','2026-04-20 18:40:49'),(2,2,6,1,1,'2026-W17','earned','Earned from sale S-20260421094752-366.',0,6,'2:2026-W17','2026-04-21 01:47:52','2026-04-21 01:47:52');
/*!40000 ALTER TABLE `loyalty_stamp_transactions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `member_levels`
--

DROP TABLE IF EXISTS `member_levels`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `member_levels` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `rank_order` int(10) unsigned NOT NULL,
  `stamps_required` int(10) unsigned NOT NULL DEFAULT 8,
  `discount_type` varchar(255) NOT NULL DEFAULT 'none',
  `discount_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `benefit_description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `member_levels_rank_order_unique` (`rank_order`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `member_levels`
--

LOCK TABLES `member_levels` WRITE;
/*!40000 ALTER TABLE `member_levels` DISABLE KEYS */;
INSERT INTO `member_levels` VALUES (1,'Rookie',1,8,'none',0.00,'Base loyalty tier with stamp and point earning.',1,'2026-04-20 15:22:25','2026-04-21 03:09:42'),(2,'Grinder',2,8,'percent',2.00,'Automatic 2% checkout discount.',1,'2026-04-20 15:22:25','2026-04-21 02:16:35'),(3,'Elite',3,8,'percent',5.00,'Automatic 5% checkout discount.',1,'2026-04-20 15:22:25','2026-04-21 02:16:35'),(4,'Legend',4,8,'percent',10.00,'Automatic 10% checkout discount.',1,'2026-04-20 15:22:25','2026-04-21 02:16:35');
/*!40000 ALTER TABLE `member_levels` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `migrations`
--

DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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=22 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,'0001_01_01_000000_create_users_table',1),(2,'0001_01_01_000001_create_cache_table',1),(3,'0001_01_01_000002_create_personal_access_tokens_table',1),(4,'2026_04_16_000100_create_roles_and_permissions_tables',1),(5,'2026_04_16_000200_create_catalog_tables',1),(6,'2026_04_16_000300_create_supplier_purchase_tables',1),(7,'2026_04_16_000400_create_sales_tables',1),(8,'2026_04_16_000500_create_expense_tables',1),(9,'2026_04_16_000600_create_stock_movements_table',1),(10,'2026_04_16_000700_create_settings_table',1),(11,'2026_04_18_000800_create_tournament_tables',1),(12,'2026_04_19_000900_create_customers_and_loyalty_tables',2),(13,'2026_04_20_001000_create_member_levels_and_stamp_loyalty_tables',3),(14,'2026_04_21_001100_add_level_expiry_to_customers',4),(15,'2026_04_21_001200_create_product_types_table',5),(16,'2026_04_21_001300_add_result_fields_to_tournament_registrations',6),(17,'2026_04_21_001400_create_tournament_games_table',7),(18,'2026_04_21_001500_add_sale_document_fields',8),(19,'2026_04_21_001600_add_customer_to_tournament_registrations',9),(20,'2026_04_21_001700_create_card_handover_tables',10),(21,'2026_04_21_001800_add_benefits_to_member_levels_and_sales',11);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `password_reset_tokens`
--

DROP TABLE IF EXISTS `password_reset_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `password_reset_tokens`
--

LOCK TABLES `password_reset_tokens` WRITE;
/*!40000 ALTER TABLE `password_reset_tokens` DISABLE KEYS */;
/*!40000 ALTER TABLE `password_reset_tokens` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `permission_role`
--

DROP TABLE IF EXISTS `permission_role`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permission_role` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `role_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `permission_role_role_id_foreign` (`role_id`),
  CONSTRAINT `permission_role_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `permission_role_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `permission_role`
--

LOCK TABLES `permission_role` WRITE;
/*!40000 ALTER TABLE `permission_role` DISABLE KEYS */;
INSERT INTO `permission_role` VALUES (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(4,1),(4,3),(5,1),(5,2),(5,3),(6,1),(7,1),(7,2),(7,3),(8,1),(9,1),(9,2),(10,1),(10,2),(11,1),(11,2),(12,1),(13,1),(13,2),(14,1),(15,1),(15,2),(15,3),(16,1),(17,1),(17,3),(18,1),(18,2),(19,1),(19,2),(20,1),(21,1),(22,1),(22,2),(22,3),(23,1),(24,1),(24,2),(24,3),(25,1),(25,3);
/*!40000 ALTER TABLE `permission_role` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `permissions`
--

DROP TABLE IF EXISTS `permissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permissions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `label` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `permissions`
--

LOCK TABLES `permissions` WRITE;
/*!40000 ALTER TABLE `permissions` DISABLE KEYS */;
INSERT INTO `permissions` VALUES (1,'dashboard.view','View dashboard','2026-04-18 13:29:12','2026-04-18 13:29:12'),(2,'products.view','View products','2026-04-18 13:29:12','2026-04-18 13:29:12'),(3,'products.manage','Manage products','2026-04-18 13:29:12','2026-04-18 13:29:12'),(4,'sales.create','Process POS sales','2026-04-18 13:29:12','2026-04-18 13:29:12'),(5,'sales.view','View sales history','2026-04-18 13:29:12','2026-04-18 13:29:12'),(6,'sales.refund','Refund or void sales','2026-04-18 13:29:12','2026-04-18 13:29:12'),(7,'inventory.view','View inventory','2026-04-18 13:29:12','2026-04-18 13:29:12'),(8,'inventory.adjust','Adjust inventory','2026-04-18 13:29:12','2026-04-18 13:29:12'),(9,'expenses.view','View expenses','2026-04-18 13:29:12','2026-04-18 13:29:12'),(10,'expenses.manage','Manage expenses','2026-04-18 13:29:12','2026-04-18 13:29:12'),(11,'suppliers.view','View suppliers','2026-04-18 13:29:12','2026-04-18 13:29:12'),(12,'suppliers.manage','Manage suppliers','2026-04-18 13:29:12','2026-04-18 13:29:12'),(13,'purchases.view','View purchases','2026-04-18 13:29:12','2026-04-18 13:29:12'),(14,'purchases.manage','Manage purchases','2026-04-18 13:29:12','2026-04-18 13:29:12'),(15,'tournaments.view','View tournaments','2026-04-18 13:29:12','2026-04-18 13:29:12'),(16,'tournaments.manage','Manage tournaments','2026-04-18 13:29:12','2026-04-18 13:29:12'),(17,'tournaments.register','Register players for tournaments','2026-04-18 13:29:12','2026-04-18 13:29:12'),(18,'reports.view','View operational reports','2026-04-18 13:29:12','2026-04-18 13:29:12'),(19,'reports.financial','View financial reports','2026-04-18 13:29:12','2026-04-18 13:29:12'),(20,'users.manage','Manage users and roles','2026-04-18 13:29:12','2026-04-18 13:29:12'),(21,'settings.manage','Manage settings','2026-04-18 13:29:12','2026-04-18 13:29:12'),(22,'customers.view','View customers and loyalty points','2026-04-20 14:22:56','2026-04-20 14:22:56'),(23,'customers.manage','Manage customers and loyalty points','2026-04-20 14:22:56','2026-04-20 14:22:56'),(24,'handovers.view','View card handovers','2026-04-20 19:57:35','2026-04-20 19:57:35'),(25,'handovers.manage','Manage card handovers','2026-04-20 19:57:35','2026-04-20 19:57:35');
/*!40000 ALTER TABLE `permissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `personal_access_tokens`
--

DROP TABLE IF EXISTS `personal_access_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `personal_access_tokens`
--

LOCK TABLES `personal_access_tokens` WRITE;
/*!40000 ALTER TABLE `personal_access_tokens` DISABLE KEYS */;
INSERT INTO `personal_access_tokens` VALUES (1,'App\\Models\\User',1,'shop-dashboard','a2b2f48f3222823dedc6cb3d75b75841f99134ed21096c06d6465582179dc3c2','[\"*\"]','2026-04-18 13:29:25',NULL,'2026-04-18 13:29:24','2026-04-18 13:29:25'),(3,'App\\Models\\User',1,'shop-dashboard','57192bd18d7909c79e8d2fc987a3e61b1da36a8126514f98b7ea2d00ca1f63bb','[\"*\"]','2026-04-20 14:55:41',NULL,'2026-04-18 16:48:38','2026-04-20 14:55:41'),(4,'App\\Models\\User',1,'shop-dashboard','df71fb2a4f642a83061ebc1db32438ce993ec709c2cfc1fe55215757562401ca','[\"*\"]','2026-04-18 17:01:40',NULL,'2026-04-18 17:01:38','2026-04-18 17:01:40'),(5,'App\\Models\\User',1,'shop-dashboard','fcb64f6d743a5ff3665b8174409556161b0a9da3c1a8c381a33d4d10744dc7bd','[\"*\"]','2026-04-18 17:01:55',NULL,'2026-04-18 17:01:52','2026-04-18 17:01:55'),(6,'App\\Models\\User',1,'shop-dashboard','6062c1d032bb393c180a203287162b27b9a4dfb3bb09f075b22ae7a5b4a828a0','[\"*\"]','2026-04-18 17:02:27',NULL,'2026-04-18 17:02:26','2026-04-18 17:02:27'),(7,'App\\Models\\User',1,'shop-dashboard','f83d411c23266f2b585aa1f5940ccfc5ea3279c6cf2bf94f9422857911fb7a60','[\"*\"]','2026-04-18 17:03:02',NULL,'2026-04-18 17:03:01','2026-04-18 17:03:02'),(8,'App\\Models\\User',1,'shop-dashboard','43409730c18371e4a560595577a5cfd694446dce7e0a6f0408662380486e5c45','[\"*\"]','2026-04-19 07:20:27',NULL,'2026-04-19 07:20:25','2026-04-19 07:20:27'),(9,'App\\Models\\User',1,'shop-dashboard','236bbacd48f5d5a803e5a7d18e9b700eed0366c48f52dc425ce17efb2e0a1244','[\"*\"]','2026-04-19 09:30:28',NULL,'2026-04-19 09:30:28','2026-04-19 09:30:28'),(20,'App\\Models\\User',3,'shop-dashboard','9ef15bc9741cca1b0d8ec489faa60fab63a3481696420c58fac077323ee2573c','[\"*\"]','2026-04-21 03:09:06',NULL,'2026-04-21 03:08:44','2026-04-21 03:09:06'),(29,'App\\Models\\User',1,'shop-dashboard','1490797f087b6e508424e451bdf17d421bbdf3fed5c8fc318398516bc8f89b74','[\"*\"]','2026-04-21 18:18:06',NULL,'2026-04-21 17:56:54','2026-04-21 18:18:06');
/*!40000 ALTER TABLE `personal_access_tokens` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_categories`
--

DROP TABLE IF EXISTS `product_categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_categories_slug_unique` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_categories`
--

LOCK TABLES `product_categories` WRITE;
/*!40000 ALTER TABLE `product_categories` DISABLE KEYS */;
INSERT INTO `product_categories` VALUES (1,'Singles','singles','2026-04-18 13:29:12','2026-04-18 13:29:12'),(2,'Sealed Products','sealed-products','2026-04-18 13:29:12','2026-04-18 13:29:12'),(3,'Accessories','accessories','2026-04-18 13:29:12','2026-04-18 13:29:12'),(4,'Tournament Entries','tournament-entries','2026-04-18 13:29:12','2026-04-18 13:29:12');
/*!40000 ALTER TABLE `product_categories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_images`
--

DROP TABLE IF EXISTS `product_images`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_images` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `path` varchar(255) NOT NULL,
  `is_primary` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_images_product_id_foreign` (`product_id`),
  CONSTRAINT `product_images_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_images`
--

LOCK TABLES `product_images` WRITE;
/*!40000 ALTER TABLE `product_images` DISABLE KEYS */;
INSERT INTO `product_images` VALUES (1,8,'products/M0JNCGLxY4WyaNOM47DplQsZ2QaX7hE0jXyDHmTk.webp',1,'2026-04-21 17:31:07','2026-04-21 17:31:07'),(2,7,'products/hVQSWF1SEG0avRwQk3LrnHYgLRl3B5O30x4Ao0TL.jpg',1,'2026-04-21 18:08:46','2026-04-21 18:08:46');
/*!40000 ALTER TABLE `product_images` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_types`
--

DROP TABLE IF EXISTS `product_types`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_types` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `value` varchar(255) NOT NULL,
  `label` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `default_category_id` bigint(20) unsigned DEFAULT NULL,
  `tracks_inventory` tinyint(1) NOT NULL DEFAULT 1,
  `has_set_name` tinyint(1) NOT NULL DEFAULT 0,
  `is_card` tinyint(1) NOT NULL DEFAULT 0,
  `is_tournament_entry` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(10) unsigned NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_types_value_unique` (`value`),
  KEY `product_types_default_category_id_foreign` (`default_category_id`),
  KEY `product_types_is_active_sort_order_index` (`is_active`,`sort_order`),
  CONSTRAINT `product_types_default_category_id_foreign` FOREIGN KEY (`default_category_id`) REFERENCES `product_categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_types`
--

LOCK TABLES `product_types` WRITE;
/*!40000 ALTER TABLE `product_types` DISABLE KEYS */;
INSERT INTO `product_types` VALUES (1,'single_card','Single card','Individual cards with set, condition, rarity, and foil details.',1,1,1,1,0,1,10,'2026-04-20 16:58:44','2026-04-20 16:58:44'),(2,'sealed_product','Sealed product','Booster boxes, packs, decks, bundles, and cases.',2,1,1,0,0,1,20,'2026-04-20 16:58:44','2026-04-20 16:58:44'),(3,'accessory','Accessory','Sleeves, deck boxes, binders, playmats, dice, and supplies.',3,1,0,0,0,1,30,'2026-04-20 16:58:44','2026-04-20 16:58:44'),(4,'tournament_entry','Tournament entry','Non-stock registration products used by tournaments.',4,0,0,0,1,1,40,'2026-04-20 16:58:44','2026-04-20 16:58:44');
/*!40000 ALTER TABLE `product_types` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `products`
--

DROP TABLE IF EXISTS `products`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `products` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `category_id` bigint(20) unsigned DEFAULT NULL,
  `sku` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `product_type` varchar(255) NOT NULL,
  `set_name` varchar(255) DEFAULT NULL,
  `card_number` varchar(255) DEFAULT NULL,
  `rarity` varchar(255) DEFAULT NULL,
  `condition` varchar(255) DEFAULT NULL,
  `language` varchar(255) DEFAULT NULL,
  `is_foil` tinyint(1) NOT NULL DEFAULT 0,
  `cost_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `retail_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `stock_quantity` int(11) NOT NULL DEFAULT 0,
  `reorder_level` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_sku_unique` (`sku`),
  KEY `products_category_id_foreign` (`category_id`),
  KEY `products_product_type_is_active_index` (`product_type`,`is_active`),
  KEY `products_stock_quantity_reorder_level_index` (`stock_quantity`,`reorder_level`),
  KEY `products_barcode_index` (`barcode`),
  KEY `products_product_type_index` (`product_type`),
  KEY `products_set_name_index` (`set_name`),
  CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `product_categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `products`
--

LOCK TABLES `products` WRITE;
/*!40000 ALTER TABLE `products` DISABLE KEYS */;
INSERT INTO `products` VALUES (1,1,'SGL-DRG-001',NULL,'Azure Mythic Dragon','single_card','Founders Set','001','Mythic','NM','EN',1,28.00,44.90,4,1,0,'2026-04-18 13:29:12','2026-04-19 07:12:03'),(2,2,'SEA-BOX-001',NULL,'Founders Set Booster Box','sealed_product',NULL,NULL,NULL,NULL,NULL,0,320.00,429.90,10,3,0,'2026-04-18 13:29:12','2026-04-19 07:12:07'),(3,3,'ACC-SLV-001',NULL,'Premium Matte Sleeves','accessory',NULL,NULL,NULL,NULL,NULL,0,12.00,24.90,50,10,0,'2026-04-18 13:29:12','2026-04-19 07:12:10'),(4,4,'EVT-REG-STD',NULL,'Standard Tournament Registration','tournament_entry',NULL,NULL,NULL,NULL,NULL,0,0.00,25.00,0,0,0,'2026-04-18 13:29:12','2026-04-19 07:12:14'),(5,3,'FS-04-001',NULL,'One Piece Flagship April','tournament_entry',NULL,NULL,NULL,NULL,NULL,0,0.00,35.00,0,0,0,'2026-04-20 16:45:09','2026-04-20 16:45:31'),(6,4,'OP-001-01',NULL,'One Piece TCG','tournament_entry',NULL,NULL,NULL,NULL,NULL,0,0.00,35.00,0,0,1,'2026-04-20 17:19:57','2026-04-20 17:19:57'),(7,2,'OP15-001',NULL,'One Piece : OP15 (box)','sealed_product',NULL,NULL,NULL,NULL,NULL,0,130.00,250.00,6,0,1,'2026-04-20 18:39:22','2026-04-21 03:02:22'),(8,1,'OP15-119-JP',NULL,'Monkey D. Luffy','single_card','OP15','119','SEC','NM','JPN',1,0.00,70.00,5,0,1,'2026-04-21 17:31:06','2026-04-21 17:32:26');
/*!40000 ALTER TABLE `products` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `purchase_items`
--

DROP TABLE IF EXISTS `purchase_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `purchase_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_cost` decimal(12,2) NOT NULL,
  `line_total` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `purchase_items_purchase_id_foreign` (`purchase_id`),
  KEY `purchase_items_product_id_foreign` (`product_id`),
  CONSTRAINT `purchase_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `purchase_items_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `purchase_items`
--

LOCK TABLES `purchase_items` WRITE;
/*!40000 ALTER TABLE `purchase_items` DISABLE KEYS */;
/*!40000 ALTER TABLE `purchase_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `purchases`
--

DROP TABLE IF EXISTS `purchases`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `purchases` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `purchase_number` varchar(255) NOT NULL,
  `supplier_id` bigint(20) unsigned DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `purchase_date` date NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'received',
  `subtotal` decimal(12,2) NOT NULL DEFAULT 0.00,
  `shipping_cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `purchases_purchase_number_unique` (`purchase_number`),
  KEY `purchases_supplier_id_foreign` (`supplier_id`),
  KEY `purchases_created_by_foreign` (`created_by`),
  CONSTRAINT `purchases_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `purchases_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `purchases`
--

LOCK TABLES `purchases` WRITE;
/*!40000 ALTER TABLE `purchases` DISABLE KEYS */;
/*!40000 ALTER TABLE `purchases` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `role_user`
--

DROP TABLE IF EXISTS `role_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `role_user` (
  `role_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`user_id`),
  KEY `role_user_user_id_foreign` (`user_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 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `role_user`
--

LOCK TABLES `role_user` WRITE;
/*!40000 ALTER TABLE `role_user` DISABLE KEYS */;
INSERT INTO `role_user` VALUES (1,1),(1,2),(3,3);
/*!40000 ALTER TABLE `role_user` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `label` 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=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_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,'admin','Admin','2026-04-18 13:29:12','2026-04-18 13:29:12'),(2,'accountant','Accountant','2026-04-18 13:29:12','2026-04-18 13:29:12'),(3,'staff','Staff','2026-04-18 13:29:12','2026-04-18 13:29:12');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sale_items`
--

DROP TABLE IF EXISTS `sale_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sale_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(12,2) NOT NULL,
  `cost_price` decimal(12,2) NOT NULL,
  `discount_total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `line_total` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_items_sale_id_foreign` (`sale_id`),
  KEY `sale_items_product_id_foreign` (`product_id`),
  CONSTRAINT `sale_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `sale_items_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sale_items`
--

LOCK TABLES `sale_items` WRITE;
/*!40000 ALTER TABLE `sale_items` DISABLE KEYS */;
INSERT INTO `sale_items` VALUES (3,3,4,1,35.00,0.00,0.00,35.00,'2026-04-19 06:51:28','2026-04-19 06:51:28'),(4,4,7,1,250.00,130.00,0.00,250.00,'2026-04-20 18:40:49','2026-04-20 18:40:49'),(5,5,6,1,35.00,0.00,0.00,35.00,'2026-04-20 18:43:11','2026-04-20 18:43:11'),(6,6,7,1,250.00,130.00,0.00,250.00,'2026-04-21 01:47:52','2026-04-21 01:47:52'),(7,7,7,1,250.00,130.00,0.00,250.00,'2026-04-21 02:06:11','2026-04-21 02:06:11'),(8,8,7,1,250.00,130.00,0.00,250.00,'2026-04-21 03:02:22','2026-04-21 03:02:22');
/*!40000 ALTER TABLE `sale_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sales`
--

DROP TABLE IF EXISTS `sales`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_number` varchar(255) NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `customer_id` bigint(20) unsigned DEFAULT NULL,
  `member_level_id` bigint(20) unsigned DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `subtotal` decimal(12,2) NOT NULL DEFAULT 0.00,
  `discount_total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `level_discount_total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `points_earned` int(11) NOT NULL DEFAULT 0,
  `points_redeemed` int(11) NOT NULL DEFAULT 0,
  `points_discount_total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `tax_total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL DEFAULT 0.00,
  `payment_method` varchar(255) NOT NULL DEFAULT 'cash',
  `status` varchar(255) NOT NULL DEFAULT 'completed',
  `sold_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `receipt_token` varchar(64) DEFAULT NULL,
  `invoice_number` varchar(255) DEFAULT NULL,
  `invoice_issued_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sales_sale_number_unique` (`sale_number`),
  UNIQUE KEY `sales_receipt_token_unique` (`receipt_token`),
  UNIQUE KEY `sales_invoice_number_unique` (`invoice_number`),
  KEY `sales_user_id_foreign` (`user_id`),
  KEY `sales_status_sold_at_index` (`status`,`sold_at`),
  KEY `sales_customer_id_foreign` (`customer_id`),
  KEY `sales_member_level_id_foreign` (`member_level_id`),
  CONSTRAINT `sales_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `sales_member_level_id_foreign` FOREIGN KEY (`member_level_id`) REFERENCES `member_levels` (`id`) ON DELETE SET NULL,
  CONSTRAINT `sales_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sales`
--

LOCK TABLES `sales` WRITE;
/*!40000 ALTER TABLE `sales` DISABLE KEYS */;
INSERT INTO `sales` VALUES (3,'S-20260419145128-703',1,NULL,NULL,'Ariff',35.00,0.00,0.00,0,0,0.00,0.00,35.00,'qr','completed','2026-04-19 06:51:28','2026-04-19 06:51:28','2026-04-19 06:51:28','84cZ3X73djDpFB7r1XGbTGGfxV0Cg8OoRqSYzQJe',NULL,NULL),(4,'S-20260421024049-486',1,1,NULL,'Sample Member',250.00,0.00,0.00,250,0,0.00,0.00,250.00,'qr','completed','2026-04-20 18:40:49','2026-04-20 18:40:49','2026-04-20 18:40:49','r0bo6HoFon25OgxAudM8rzfNiN99HT1ADwlDtg5B',NULL,NULL),(5,'S-20260421024311-808',1,NULL,NULL,'Ariff',35.00,0.00,0.00,0,0,0.00,0.00,35.00,'cash','completed','2026-04-20 18:43:11','2026-04-20 18:43:11','2026-04-20 18:43:11','wq1Ouc1TCN7VMzX5dhhMkzEkbJ0SLFYmD9PBWePO',NULL,NULL),(6,'S-20260421094752-366',1,2,NULL,'Zamir Saufi',250.00,0.00,0.00,250,0,0.00,0.00,250.00,'qr','completed','2026-04-21 01:47:52','2026-04-21 01:47:52','2026-04-21 01:47:52','ArH648dnsEabGhsyRtgkfyvcgODndHFxgwFQhnss',NULL,NULL),(7,'S-20260421100611-749',1,2,NULL,'Zamir Saufi',250.00,0.00,0.00,250,0,0.00,0.00,250.00,'cash','completed','2026-04-21 02:06:11','2026-04-21 02:06:11','2026-04-21 02:06:11','vsNyf9S9XLmIMTMr4r8nCfESfL2dRMYPLvryCrMl',NULL,NULL),(8,'S-20260421110222-188',1,2,1,'Zamir Saufi',250.00,2.50,2.50,247,0,0.00,0.00,247.50,'cash','completed','2026-04-21 03:02:22','2026-04-21 03:02:22','2026-04-21 03:02:22','Kdhgk1Gj0rxhuFKQVVIb3tDC21d3DEf2Hrypx4FN',NULL,NULL);
/*!40000 ALTER TABLE `sales` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sessions`
--

DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sessions`
--

LOCK TABLES `sessions` WRITE;
/*!40000 ALTER TABLE `sessions` DISABLE KEYS */;
/*!40000 ALTER TABLE `sessions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `settings`
--

DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `key` varchar(255) NOT NULL,
  `value` text DEFAULT NULL,
  `type` varchar(255) NOT NULL DEFAULT 'string',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `settings_key_unique` (`key`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `settings`
--

LOCK TABLES `settings` WRITE;
/*!40000 ALTER TABLE `settings` DISABLE KEYS */;
INSERT INTO `settings` VALUES (1,'shop_name','CardVerse TCG','string','2026-04-18 13:29:12','2026-04-21 17:05:44'),(2,'currency','MYR','string','2026-04-18 13:29:12','2026-04-18 13:29:12'),(3,'tax_rate','0','number','2026-04-18 13:29:12','2026-04-18 13:29:12'),(4,'receipt_footer','Thank you for supporting your local card shop.','string','2026-04-18 13:29:12','2026-04-18 13:29:12'),(5,'points_per_currency','1','number','2026-04-20 14:22:57','2026-04-20 14:22:57'),(6,'point_currency_value','0.01','number','2026-04-20 14:22:57','2026-04-20 14:22:57'),(7,'loyalty_stamps_continue_at_max_level','1','boolean','2026-04-20 15:22:26','2026-04-20 15:22:26'),(8,'loyalty_level_progress_mode','cycle_reset','select','2026-04-20 15:36:59','2026-04-20 15:36:59'),(9,'loyalty_level_expiry_enabled','0','boolean','2026-04-20 16:12:20','2026-04-20 16:12:20'),(10,'loyalty_level_expiry_months','12','number','2026-04-20 16:12:20','2026-04-20 16:12:20'),(11,'shop_address',NULL,'string','2026-04-21 17:02:49','2026-04-21 17:05:44'),(12,'shop_phone','01234567890','string','2026-04-21 17:02:49','2026-04-21 17:05:44'),(13,'shop_logo_url','http://localhost:8000/storage/shop/30QuvRlgZrKAQ19XHDXNTTKcM6yNQIbhXJjmXXtu.png','image','2026-04-21 17:02:49','2026-04-21 17:51:36'),(14,'shop_favicon_url','http://localhost:8000/storage/shop/kKaOerXIMt4H3rp7iBAxXhDCM43ByrnIFGhNlbsJ.png','image','2026-04-21 17:02:49','2026-04-21 17:43:28'),(15,'shop_timezone','Asia/Kuala_Lumpur','select','2026-04-21 17:16:52','2026-04-21 17:16:52'),(16,'theme_primary_color','#b68a35','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(17,'theme_primary_hover_color','#c99b45','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(18,'theme_secondary_color','#1f4b3c','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(19,'theme_accent_color','#c7664f','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(20,'theme_background_color','#090d0c','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(21,'theme_surface_color','#f6f5f0','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(22,'theme_text_color','#171717','color','2026-04-21 17:16:52','2026-04-21 17:16:52'),(23,'theme_sidebar_text_color','#f4f1e8','color','2026-04-21 17:26:58','2026-04-21 17:26:58'),(24,'theme_logo_icon_color','#b68a35','color','2026-04-21 17:26:58','2026-04-21 17:26:58'),(25,'theme_sidebar_active_text_color','#836220','color','2026-04-21 17:31:22','2026-04-21 17:47:43'),(26,'system_update_manifest_url','','url','2026-04-21 18:16:11','2026-04-21 18:16:11');
/*!40000 ALTER TABLE `settings` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `stock_movements`
--

DROP TABLE IF EXISTS `stock_movements`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stock_movements` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `movement_type` varchar(255) NOT NULL,
  `quantity_change` int(11) NOT NULL,
  `stock_before` int(11) NOT NULL,
  `stock_after` int(11) NOT NULL,
  `source_type` varchar(255) DEFAULT NULL,
  `source_id` bigint(20) unsigned DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `stock_movements_user_id_foreign` (`user_id`),
  KEY `stock_movements_source_type_source_id_index` (`source_type`,`source_id`),
  KEY `stock_movements_product_id_created_at_index` (`product_id`,`created_at`),
  KEY `stock_movements_movement_type_index` (`movement_type`),
  CONSTRAINT `stock_movements_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `stock_movements_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_movements`
--

LOCK TABLES `stock_movements` WRITE;
/*!40000 ALTER TABLE `stock_movements` DISABLE KEYS */;
INSERT INTO `stock_movements` VALUES (1,7,1,'adjustment',10,0,10,NULL,NULL,'add stock','2026-04-20 18:40:27','2026-04-20 18:40:27'),(2,7,1,'sale',-1,10,9,'App\\Models\\SaleItem',4,'Sale S-20260421024049-486','2026-04-20 18:40:49','2026-04-20 18:40:49'),(3,7,1,'sale',-1,9,8,'App\\Models\\SaleItem',6,'Sale S-20260421094752-366','2026-04-21 01:47:52','2026-04-21 01:47:52'),(4,7,1,'sale',-1,8,7,'App\\Models\\SaleItem',7,'Sale S-20260421100611-749','2026-04-21 02:06:11','2026-04-21 02:06:11'),(5,7,1,'sale',-1,7,6,'App\\Models\\SaleItem',8,'Sale S-20260421110222-188','2026-04-21 03:02:22','2026-04-21 03:02:22'),(6,8,1,'adjustment',5,0,5,NULL,NULL,'add','2026-04-21 17:32:26','2026-04-21 17:32:26');
/*!40000 ALTER TABLE `stock_movements` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `suppliers`
--

DROP TABLE IF EXISTS `suppliers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `suppliers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `contact_name` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `is_active` 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=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `suppliers`
--

LOCK TABLES `suppliers` WRITE;
/*!40000 ALTER TABLE `suppliers` DISABLE KEYS */;
INSERT INTO `suppliers` VALUES (1,'Premium TCG Distributor','Purchasing Desk','orders@example.test',NULL,NULL,NULL,1,'2026-04-18 13:29:12','2026-04-18 13:29:12');
/*!40000 ALTER TABLE `suppliers` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tournament_games`
--

DROP TABLE IF EXISTS `tournament_games`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tournament_games` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(10) unsigned NOT NULL DEFAULT 50,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `tournament_games_name_unique` (`name`),
  UNIQUE KEY `tournament_games_slug_unique` (`slug`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tournament_games`
--

LOCK TABLES `tournament_games` WRITE;
/*!40000 ALTER TABLE `tournament_games` DISABLE KEYS */;
INSERT INTO `tournament_games` VALUES (1,'Magic: The Gathering','magic-the-gathering',NULL,1,10,'2026-04-20 17:27:30','2026-04-20 17:27:30'),(2,'One Piece Card Game','one-piece-card-game',NULL,1,20,'2026-04-20 17:27:30','2026-04-20 17:27:30'),(3,'Pokemon','pokemon',NULL,1,30,'2026-04-20 17:27:30','2026-04-20 17:27:30'),(4,'Yu-Gi-Oh!','yu-gi-oh',NULL,1,40,'2026-04-20 17:27:30','2026-04-20 17:27:30'),(5,'Disney Lorcana','disney-lorcana',NULL,1,50,'2026-04-20 17:27:30','2026-04-20 17:27:30');
/*!40000 ALTER TABLE `tournament_games` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tournament_registrations`
--

DROP TABLE IF EXISTS `tournament_registrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tournament_registrations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tournament_id` bigint(20) unsigned NOT NULL,
  `registered_by` bigint(20) unsigned DEFAULT NULL,
  `sale_id` bigint(20) unsigned DEFAULT NULL,
  `customer_id` bigint(20) unsigned DEFAULT NULL,
  `player_name` varchar(255) NOT NULL,
  `player_email` varchar(255) DEFAULT NULL,
  `player_phone` varchar(255) DEFAULT NULL,
  `player_identifier` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'registered',
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `registered_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `match_wins` int(10) unsigned NOT NULL DEFAULT 0,
  `match_draws` int(10) unsigned NOT NULL DEFAULT 0,
  `match_losses` int(10) unsigned NOT NULL DEFAULT 0,
  `tournament_points` int(10) unsigned NOT NULL DEFAULT 0,
  `standing_rank` int(10) unsigned DEFAULT NULL,
  `result_recorded_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `tournament_registrations_tournament_id_player_identifier_unique` (`tournament_id`,`player_identifier`),
  KEY `tournament_registrations_registered_by_foreign` (`registered_by`),
  KEY `tournament_registrations_sale_id_foreign` (`sale_id`),
  KEY `tournament_registrations_tournament_id_status_index` (`tournament_id`,`status`),
  KEY `tournament_registrations_customer_id_foreign` (`customer_id`),
  CONSTRAINT `tournament_registrations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tournament_registrations_registered_by_foreign` FOREIGN KEY (`registered_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tournament_registrations_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE SET NULL,
  CONSTRAINT `tournament_registrations_tournament_id_foreign` FOREIGN KEY (`tournament_id`) REFERENCES `tournaments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tournament_registrations`
--

LOCK TABLES `tournament_registrations` WRITE;
/*!40000 ALTER TABLE `tournament_registrations` DISABLE KEYS */;
INSERT INTO `tournament_registrations` VALUES (3,2,1,3,NULL,'Ariff',NULL,NULL,NULL,'cancelled',35.00,'2026-04-19 06:51:28',NULL,'2026-04-19 06:51:28','2026-04-20 17:19:17',0,0,0,0,NULL,NULL),(4,4,1,5,NULL,'Ariff',NULL,NULL,NULL,'paid',35.00,'2026-04-20 18:43:11',NULL,'2026-04-20 18:43:11','2026-04-20 18:43:11',0,0,0,0,NULL,NULL);
/*!40000 ALTER TABLE `tournament_registrations` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tournaments`
--

DROP TABLE IF EXISTS `tournaments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tournaments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `registration_product_id` bigint(20) unsigned DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `game` varchar(255) DEFAULT NULL,
  `format` varchar(255) DEFAULT NULL,
  `starts_at` datetime NOT NULL,
  `entry_fee` decimal(12,2) NOT NULL DEFAULT 0.00,
  `capacity` int(10) unsigned NOT NULL DEFAULT 16,
  `status` varchar(255) NOT NULL DEFAULT 'scheduled',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tournaments_registration_product_id_foreign` (`registration_product_id`),
  KEY `tournaments_created_by_foreign` (`created_by`),
  KEY `tournaments_starts_at_status_index` (`starts_at`,`status`),
  CONSTRAINT `tournaments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `tournaments_registration_product_id_foreign` FOREIGN KEY (`registration_product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tournaments`
--

LOCK TABLES `tournaments` WRITE;
/*!40000 ALTER TABLE `tournaments` DISABLE KEYS */;
INSERT INTO `tournaments` VALUES (1,4,2,'Weekly Standard Showdown','Magic: The Gathering','Standard','2026-04-24 19:30:00',25.00,32,'scheduled','Seeded sample tournament.','2026-04-18 13:29:12','2026-04-20 16:58:45'),(2,NULL,1,'Extra Battle April 2026','One Piece Card Game','Swiss','2026-04-18 21:00:00',35.00,32,'cancelled',NULL,'2026-04-18 13:31:52','2026-04-20 17:19:13'),(4,6,1,'Flagship April','One Piece Card Game',NULL,'2026-04-25 21:00:00',35.00,32,'scheduled',NULL,'2026-04-20 17:35:54','2026-04-20 17:35:54');
/*!40000 ALTER TABLE `tournaments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'Shop Admin','admin@gmail.com',NULL,'$2y$12$/7Mn5JBEEjMA/WueAzHAZOJZKK4hmPIiuxmGZa3nqbfXDeFSlfjNe',1,NULL,'2026-04-18 13:29:12','2026-04-20 16:40:43'),(2,'Shop Admin','admin@ncpos.test',NULL,'$2y$12$.cdMaIqzUCAFRtXDXdMlEupDs7q8PNisKEKPq.wcnDyW/BxcbAq0G',1,NULL,'2026-04-20 16:58:44','2026-04-21 03:27:39'),(3,'Nazmi','shahrulnazmi@gmail.com',NULL,'$2y$12$76aqiJ6wCXMnQ9cPwZ6tUeqGLf5GAx/e9e5FHn2BGZxEjYGKS.hcq',1,NULL,'2026-04-21 03:03:15','2026-04-21 03:03:15');
/*!40000 ALTER TABLE `users` 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-04-22  2:20:27
