-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `mebuy`
--

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

--
-- Table structure for table `addresses`
--

CREATE TABLE `addresses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL COMMENT 'e.g. Home, Office',
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `company` varchar(255) DEFAULT NULL,
  `phone` varchar(255) NOT NULL,
  `address_line1` varchar(255) NOT NULL,
  `address_line2` varchar(255) DEFAULT NULL,
  `city` varchar(255) NOT NULL,
  `state` varchar(255) NOT NULL,
  `postal_code` varchar(255) DEFAULT NULL,
  `country` varchar(255) NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `type` enum('shipping','billing','both') NOT NULL DEFAULT 'both',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `addresses`
--

INSERT INTO `addresses` (`id`, `user_id`, `title`, `first_name`, `last_name`, `company`, `phone`, `address_line1`, `address_line2`, `city`, `state`, `postal_code`, `country`, `is_default`, `type`, `created_at`, `updated_at`) VALUES
(1, 1, 'Home Address', 'Andrews', 'Offei Boateng', NULL, '+233247525851', 'Nana Afia Serwaa Avenue', 'AE-1310-8610', 'Juaben', 'Kumasi', 'AE1310', 'Ghana', 1, 'both', '2026-05-03 05:43:13', '2026-05-03 05:43:13'),
(2, 3, 'Home', 'Lois', 'Adoma', NULL, '0506600358', 'Nana Afia Serwaa Avenue', 'AE-1310-8610', 'Juaben', 'Kumasi', 'AE1310', 'Ghana', 0, 'both', '2026-05-07 08:28:38', '2026-05-07 08:28:38');

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

--
-- Table structure for table `attendances`
--

CREATE TABLE `attendances` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `clock_in` time DEFAULT NULL,
  `clock_out` time DEFAULT NULL,
  `status` enum('present','absent','late','half_day','holiday','leave') NOT NULL DEFAULT 'present',
  `notes` text DEFAULT NULL,
  `ip_address` varchar(255) DEFAULT NULL,
  `device_info` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `brands`
--

CREATE TABLE `brands` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `logo` varchar(255) DEFAULT NULL,
  `banner` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `bulk_sms`
--

CREATE TABLE `bulk_sms` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `message` text NOT NULL,
  `target_type` varchar(255) NOT NULL DEFAULT 'all',
  `recipient_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`recipient_ids`)),
  `status` varchar(255) NOT NULL DEFAULT 'draft',
  `total_recipients` int(11) NOT NULL DEFAULT 0,
  `sent_count` int(11) NOT NULL DEFAULT 0,
  `failed_count` int(11) NOT NULL DEFAULT 0,
  `delivered_count` int(11) NOT NULL DEFAULT 0,
  `scheduled_at` timestamp NULL DEFAULT NULL,
  `sent_at` timestamp NULL DEFAULT NULL,
  `sender_id` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `campaigns`
--

CREATE TABLE `campaigns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL DEFAULT 'email',
  `description` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'draft',
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_flash_sale` tinyint(1) NOT NULL DEFAULT 0,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `budget` decimal(10,2) DEFAULT NULL,
  `spent` decimal(10,2) NOT NULL DEFAULT 0.00,
  `impressions` int(11) NOT NULL DEFAULT 0,
  `clicks` int(11) NOT NULL DEFAULT 0,
  `conversions` int(11) NOT NULL DEFAULT 0,
  `image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `campaign_requests`
--

CREATE TABLE `campaign_requests` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `campaign_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `discount` decimal(10,2) DEFAULT NULL,
  `discount_type` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `admin_notes` text DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `parent_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `icon` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `banner` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `commission_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `meta` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`meta`)),
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `parent_id`, `name`, `slug`, `icon`, `image`, `banner`, `description`, `sort_order`, `is_active`, `is_featured`, `commission_rate`, `meta`, `meta_title`, `meta_description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, NULL, 'Electronics', 'electronics', '💻', NULL, NULL, 'Electronic devices and accessories', 1, 1, 1, 5.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:27', NULL),
(2, 1, 'Smartphones', 'smartphones', '📱', NULL, NULL, 'Mobile phones and accessories', 1, 1, 1, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:27', NULL),
(3, 1, 'Laptops', 'laptops', '💻', NULL, NULL, 'Laptops and notebooks', 2, 1, 1, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:27', NULL),
(4, 1, 'Tablets', 'tablets', '💡', NULL, NULL, 'Tablets and e-readers', 3, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:27', NULL),
(5, 1, 'Audio', 'audio', '📋', NULL, NULL, 'Headphones, speakers, and audio equipment', 4, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:27', NULL),
(6, 1, 'Cameras', 'cameras', '🔖', NULL, NULL, 'Digital cameras and photography', 5, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(7, NULL, 'Fashion', 'fashion', '👗', NULL, NULL, 'Clothing, shoes, and accessories', 2, 1, 1, 10.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(8, 7, 'Men\'s Clothing', 'mens-clothing', '👕', NULL, NULL, 'Men\'s fashion and apparel', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(9, 7, 'Women\'s Clothing', 'womens-clothing', '👕', NULL, NULL, 'Women\'s fashion and apparel', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(10, 7, 'Shoes', 'shoes', '👟', NULL, NULL, 'Footwear for all', 3, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(11, 7, 'Accessories', 'fashion-accessories', '👜', NULL, NULL, 'Fashion accessories', 4, 1, 1, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 10:29:29', NULL),
(12, NULL, 'Home & Garden', 'home-garden', '🏠', NULL, NULL, 'Home decor and garden supplies', 3, 1, 1, 8.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(13, 12, 'Furniture', 'furniture', '🪑', NULL, NULL, 'Home and office furniture', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(14, 12, 'Kitchen', 'kitchen', '🍳', NULL, NULL, 'Kitchen appliances and utensils', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(15, 12, 'Garden', 'garden', '🌿', NULL, NULL, 'Garden tools and plants', 3, 1, 1, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 10:29:21', NULL),
(16, NULL, 'Sports & Outdoors', 'sports-outdoors', '⚽', NULL, NULL, 'Sports equipment and outdoor gear', 4, 1, 1, 7.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(17, 16, 'Fitness', 'fitness', '🏋️', NULL, NULL, 'Fitness equipment and accessories', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(18, 16, 'Outdoor', 'outdoor', '🏕️', NULL, NULL, 'Camping and hiking gear', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(19, 16, 'Team Sports', 'team-sports', '⚽', NULL, NULL, 'Equipment for team sports', 3, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(20, NULL, 'Health & Beauty', 'health-beauty', '💄', NULL, NULL, 'Health products and beauty supplies', 5, 1, 1, 12.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(21, 20, 'Skincare', 'skincare', '🧴', NULL, NULL, 'Skincare products', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(22, 20, 'Makeup', 'makeup', '💄', NULL, NULL, 'Cosmetics and makeup', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(23, 20, 'Haircare', 'haircare', '🚗', NULL, NULL, 'Hair care products', 3, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(24, NULL, 'Books & Media', 'books-media', '📚', NULL, NULL, 'Books, movies, and music', 6, 1, 1, 5.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 04:01:02', NULL),
(25, 24, 'Books', 'books', '📚', NULL, NULL, 'Physical and digital books', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(26, 24, 'Movies', 'movies', '🛍️', NULL, NULL, 'DVDs and digital movies', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(27, 24, 'Music', 'music', '🎵', NULL, NULL, 'CDs and digital music', 3, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(28, NULL, 'Food & Groceries', 'food-groceries', '🍔', NULL, NULL, 'Fresh food and grocery items', 7, 1, 1, 3.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 04:01:02', NULL),
(29, 28, 'Fresh Produce', 'fresh-produce', '🎁', NULL, NULL, 'Fresh fruits and vegetables', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(30, 28, 'Snacks', 'snacks', '🍿', NULL, NULL, 'Snacks and treats', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(31, 28, 'Beverages', 'beverages', '🥤', NULL, NULL, 'Drinks and beverages', 3, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(32, NULL, 'Automotive', 'automotive', '🚗', NULL, NULL, 'Car parts and accessories', 8, 1, 1, 6.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 04:01:02', NULL),
(33, 32, 'Car Parts', 'car-parts', '🚗', NULL, NULL, 'Replacement car parts', 1, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:31:28', NULL),
(34, 32, 'Car Accessories', 'car-accessories', '👜', NULL, NULL, 'Car accessories and gadgets', 2, 1, 0, 0.00, NULL, NULL, NULL, '2026-05-03 03:29:33', '2026-05-03 03:49:52', NULL);

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

--
-- Table structure for table `chats`
--

CREATE TABLE `chats` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `promoter_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `admin_id` bigint(20) UNSIGNED DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `last_message_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `chats`
--

INSERT INTO `chats` (`id`, `title`, `promoter_id`, `customer_id`, `admin_id`, `vendor_id`, `product_id`, `is_active`, `last_message_at`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, NULL, NULL, NULL, 1, 1, 3, 1, '2026-05-07 05:44:36', '2026-05-07 04:38:53', '2026-05-07 05:44:36', NULL),
(2, NULL, NULL, 3, 1, NULL, 1, 1, '2026-05-07 08:15:34', '2026-05-07 08:13:56', '2026-05-07 08:15:34', NULL);

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

--
-- Table structure for table `collections`
--

CREATE TABLE `collections` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `delivery_man_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `colors`
--

CREATE TABLE `colors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `hex_code` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `commissions`
--

CREATE TABLE `commissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `delivery_man_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `type` varchar(255) NOT NULL DEFAULT 'delivery',
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `coupons`
--

CREATE TABLE `coupons` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `type` enum('fixed','percentage','free_shipping') NOT NULL DEFAULT 'percentage',
  `value` decimal(15,2) NOT NULL COMMENT 'Discount value',
  `min_purchase` decimal(15,2) NOT NULL DEFAULT 0.00 COMMENT 'Minimum purchase amount',
  `max_discount` decimal(15,2) DEFAULT NULL COMMENT 'Maximum discount amount for percentage type',
  `usage_limit` int(11) DEFAULT NULL COMMENT 'Total usage limit',
  `usage_limit_per_user` int(11) NOT NULL DEFAULT 1,
  `used_count` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `valid_from` timestamp NULL DEFAULT NULL,
  `valid_until` timestamp NULL DEFAULT NULL,
  `applicable_categories` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`applicable_categories`)),
  `applicable_products` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`applicable_products`)),
  `applicable_vendors` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`applicable_vendors`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `coupons`
--

INSERT INTO `coupons` (`id`, `code`, `description`, `type`, `value`, `min_purchase`, `max_discount`, `usage_limit`, `usage_limit_per_user`, `used_count`, `is_active`, `valid_from`, `valid_until`, `applicable_categories`, `applicable_products`, `applicable_vendors`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'WELCOME10', 'Welcome discount for new customers', 'percentage', 10.00, 50.00, 25.00, 1000, 1, 0, 1, '2026-05-03 03:31:11', '2026-11-03 03:31:11', NULL, NULL, NULL, '2026-05-03 03:31:11', '2026-05-03 03:31:11', NULL),
(2, 'SAVE20', 'Save $20 on orders over $100', 'fixed', 20.00, 100.00, NULL, 500, 2, 0, 1, '2026-05-03 03:31:11', '2026-08-03 03:31:11', NULL, NULL, NULL, '2026-05-03 03:31:11', '2026-05-03 03:31:11', NULL),
(3, 'FREESHIP', 'Free shipping on any order', 'free_shipping', 0.00, 25.00, NULL, NULL, 5, 0, 1, '2026-05-03 03:31:11', '2027-05-03 03:31:11', NULL, NULL, NULL, '2026-05-03 03:31:11', '2026-05-03 03:31:11', NULL),
(4, 'FLASH50', 'Flash sale - 50% off selected items', 'percentage', 50.00, 0.00, 100.00, 100, 1, 0, 1, '2026-05-03 03:31:11', '2026-05-10 03:31:11', NULL, NULL, NULL, '2026-05-03 03:31:11', '2026-05-03 03:31:11', NULL),
(5, 'VENDOR15', '15% off from featured vendors', 'percentage', 15.00, 75.00, 50.00, 200, 3, 0, 1, '2026-05-03 03:31:11', '2026-07-03 03:31:11', NULL, NULL, NULL, '2026-05-03 03:31:11', '2026-05-03 03:31:11', NULL);

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

--
-- Table structure for table `currencies`
--

CREATE TABLE `currencies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(3) NOT NULL,
  `name` varchar(255) NOT NULL,
  `symbol` varchar(255) NOT NULL,
  `exchange_rate` decimal(12,6) NOT NULL DEFAULT 1.000000 COMMENT 'Rate relative to base currency (USD)',
  `flag` varchar(255) DEFAULT NULL COMMENT 'Emoji flag or icon',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `currencies`
--

INSERT INTO `currencies` (`id`, `code`, `name`, `symbol`, `exchange_rate`, `flag`, `is_active`, `is_default`, `created_at`, `updated_at`) VALUES
(1, 'USD', 'US Dollar', '$', 1.000000, '🇺🇸', 1, 0, '2026-05-03 03:23:21', '2026-05-04 22:57:49'),
(2, 'GHS', 'Ghana Cedi', 'GH₵', 15.500000, '🇬🇭', 1, 0, '2026-05-03 03:23:21', '2026-05-06 21:56:48'),
(3, 'CNY', 'Chinese Yuan', '¥', 7.240000, '🇨🇳', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(4, 'EUR', 'Euro', '€', 0.920000, '🇪🇺', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(5, 'GBP', 'British Pound', '£', 0.790000, '🇬🇧', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(6, 'NGN', 'Nigerian Naira', '₦', 1550.000000, '🇳🇬', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(7, 'KES', 'Kenyan Shilling', 'KSh', 129.500000, '🇰🇪', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(8, 'INR', 'Indian Rupee', '₹', 83.500000, '🇮🇳', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(9, 'JPY', 'Japanese Yen', '¥', 154.000000, '🇯🇵', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(10, 'ZAR', 'South African Rand', 'R', 18.200000, '🇿🇦', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(11, 'CAD', 'Canadian Dollar', 'C$', 1.370000, '🇨🇦', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(12, 'AUD', 'Australian Dollar', 'A$', 1.530000, '🇦🇺', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(13, 'BRL', 'Brazilian Real', 'R$', 5.000000, '🇧🇷', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(14, 'AED', 'UAE Dirham', 'د.إ', 3.670000, '🇦🇪', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21'),
(15, 'SAR', 'Saudi Riyal', '﷼', 3.750000, '🇸🇦', 1, 0, '2026-05-03 03:23:21', '2026-05-03 03:23:21');

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

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `head_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `description`, `head_id`, `status`, `created_at`, `updated_at`) VALUES
(1, 'General', 'Default department for promoters', NULL, 'active', '2026-05-07 12:06:17', '2026-05-07 12:06:17');

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

--
-- Table structure for table `deposits`
--

CREATE TABLE `deposits` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `delivery_man_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `method` varchar(255) NOT NULL DEFAULT 'cash',
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `designations`
--

CREATE TABLE `designations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `department_id` bigint(20) UNSIGNED NOT NULL,
  `description` text DEFAULT NULL,
  `level` int(11) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `designations`
--

INSERT INTO `designations` (`id`, `name`, `department_id`, `description`, `level`, `created_at`, `updated_at`) VALUES
(1, 'Promoter', 1, 'Default designation for promoters', 1, '2026-05-07 12:06:17', '2026-05-07 12:06:17');

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

--
-- Table structure for table `employees`
--

CREATE TABLE `employees` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_code` varchar(255) NOT NULL,
  `referral_code` varchar(255) DEFAULT NULL,
  `referral_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `gender` enum('male','female','other') NOT NULL,
  `date_of_birth` date NOT NULL,
  `marital_status` enum('single','married','divorced','widowed') NOT NULL DEFAULT 'single',
  `department_id` bigint(20) UNSIGNED NOT NULL,
  `designation_id` bigint(20) UNSIGNED NOT NULL,
  `supervisor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employment_type` enum('full_time','part_time','contract','intern') NOT NULL DEFAULT 'full_time',
  `join_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `salary` decimal(12,2) NOT NULL,
  `basic_salary` decimal(12,2) NOT NULL,
  `allowances` decimal(12,2) NOT NULL DEFAULT 0.00,
  `deductions` decimal(12,2) NOT NULL DEFAULT 0.00,
  `bank_name` varchar(255) DEFAULT NULL,
  `bank_account` varchar(255) DEFAULT NULL,
  `emergency_contact_name` varchar(255) DEFAULT NULL,
  `emergency_contact_phone` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `state` varchar(255) DEFAULT NULL,
  `country` varchar(255) NOT NULL DEFAULT 'Ghana',
  `avatar` varchar(255) DEFAULT NULL,
  `status` enum('active','inactive','terminated','on_leave') NOT NULL DEFAULT 'active',
  `resume_path` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `employees`
--

INSERT INTO `employees` (`id`, `user_id`, `employee_code`, `referral_code`, `referral_balance`, `first_name`, `last_name`, `email`, `phone`, `gender`, `date_of_birth`, `marital_status`, `department_id`, `designation_id`, `supervisor_id`, `employment_type`, `join_date`, `end_date`, `salary`, `basic_salary`, `allowances`, `deductions`, `bank_name`, `bank_account`, `emergency_contact_name`, `emergency_contact_phone`, `address`, `city`, `state`, `country`, `avatar`, `status`, `resume_path`, `created_at`, `updated_at`) VALUES
(1, 4, 'EMP-000001', 'EMP-AE536B31', 0.00, 'Demo', 'Promoter', 'promoter@mebuy.com', '+1234567893', 'other', '2001-05-07', 'single', 1, 1, NULL, 'full_time', '2026-05-07', NULL, 0.00, 0.00, 0.00, 0.00, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'Ghana', NULL, 'active', NULL, '2026-05-07 12:06:17', '2026-05-07 12:20:02');

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

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `holidays`
--

CREATE TABLE `holidays` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `date` date NOT NULL,
  `description` text DEFAULT NULL,
  `is_mandatory` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `hrm_jobs`
--

CREATE TABLE `hrm_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `designation_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text NOT NULL,
  `requirements` text NOT NULL,
  `location` varchar(255) DEFAULT NULL,
  `salary_min` decimal(12,2) DEFAULT NULL,
  `salary_max` decimal(12,2) DEFAULT NULL,
  `employment_type` enum('full_time','part_time','contract','intern') NOT NULL DEFAULT 'full_time',
  `status` enum('draft','published','closed') NOT NULL DEFAULT 'draft',
  `opening_date` date NOT NULL,
  `closing_date` date DEFAULT NULL,
  `vacancies` int(11) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `hrm_job_applications`
--

CREATE TABLE `hrm_job_applications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `job_id` bigint(20) UNSIGNED NOT NULL,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `cover_letter` text NOT NULL,
  `resume_path` varchar(255) DEFAULT NULL,
  `status` enum('pending','shortlisted','interviewed','hired','rejected') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` smallint(5) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `languages`
--

CREATE TABLE `languages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(5) NOT NULL,
  `name` varchar(255) NOT NULL,
  `native_name` varchar(255) NOT NULL,
  `flag` varchar(255) DEFAULT NULL COMMENT 'Emoji flag',
  `direction` varchar(255) NOT NULL DEFAULT 'ltr',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `languages`
--

INSERT INTO `languages` (`id`, `code`, `name`, `native_name`, `flag`, `direction`, `is_active`, `is_default`, `created_at`, `updated_at`) VALUES
(1, 'en', 'English', 'English', '🇬🇧', 'ltr', 1, 1, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(2, 'zh', 'Chinese', '中文', '🇨🇳', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(3, 'es', 'Spanish', 'Español', '🇪🇸', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(4, 'fr', 'French', 'Français', '🇫🇷', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(5, 'ar', 'Arabic', 'العربية', '🇸🇦', 'rtl', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(6, 'hi', 'Hindi', 'हिन्दी', '🇮🇳', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(7, 'pt', 'Portuguese', 'Português', '🇧🇷', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(8, 'ja', 'Japanese', '日本語', '🇯🇵', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(9, 'de', 'German', 'Deutsch', '🇩🇪', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42'),
(10, 'ru', 'Russian', 'Русский', '🇷🇺', 'ltr', 1, 0, '2026-05-03 03:23:42', '2026-05-03 03:23:42');

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

--
-- Table structure for table `leaves`
--

CREATE TABLE `leaves` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `leave_type` enum('annual','sick','maternity','paternity','bereavement','unpaid','casual','earned') NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `total_days` int(11) NOT NULL,
  `reason` text NOT NULL,
  `status` enum('pending','approved','rejected','cancelled') NOT NULL DEFAULT 'pending',
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `leave_balances`
--

CREATE TABLE `leave_balances` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `leave_type` varchar(255) NOT NULL,
  `year` int(11) NOT NULL,
  `total_days` int(11) NOT NULL,
  `used_days` int(11) NOT NULL DEFAULT 0,
  `remaining_days` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `chat_id` bigint(20) UNSIGNED NOT NULL,
  `sender_id` bigint(20) UNSIGNED NOT NULL,
  `message` text NOT NULL,
  `attachments` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attachments`)),
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `messages`
--

INSERT INTO `messages` (`id`, `chat_id`, `sender_id`, `message`, `attachments`, `is_read`, `read_at`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'hello Andy, how much is the Macbook pro 16', NULL, 1, '2026-05-07 04:52:06', '2026-05-07 04:48:29', '2026-05-07 04:52:11', '2026-05-07 04:52:11'),
(2, 1, 1, 'hello Andy, how much is the Macbook pro 16', NULL, 1, '2026-05-07 04:52:06', '2026-05-07 04:49:22', '2026-05-07 04:52:11', '2026-05-07 04:52:11'),
(3, 1, 2, 'GHS 6700.00 Only', NULL, 1, '2026-05-07 09:46:45', '2026-05-07 04:53:01', '2026-05-07 09:46:45', NULL),
(4, 1, 1, 'hello', '[]', 0, NULL, '2026-05-07 05:44:36', '2026-05-07 05:44:36', NULL),
(5, 2, 3, 'hello gud morning please how are doing, how much the Iphone 15 pro max.', '[]', 1, '2026-05-07 09:46:47', '2026-05-07 08:14:36', '2026-05-07 09:46:47', NULL),
(6, 2, 1, 'it only Ghs 5200.00 cedis only', '[]', 0, NULL, '2026-05-07 08:15:34', '2026-05-07 08:15:34', NULL);

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

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) 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_jobs_table', 1),
(4, '2026_04_30_170902_create_permission_tables', 1),
(5, '2026_04_30_170917_create_vendors_table', 1),
(6, '2026_04_30_170920_create_categories_table', 1),
(7, '2026_04_30_170924_create_products_table', 1),
(8, '2026_04_30_170928_create_product_images_table', 1),
(9, '2026_04_30_170932_create_product_variants_table', 1),
(10, '2026_04_30_170935_create_orders_table', 1),
(11, '2026_04_30_170939_create_order_items_table', 1),
(12, '2026_04_30_170943_create_payments_table', 1),
(13, '2026_04_30_170947_create_wallets_table', 1),
(14, '2026_04_30_170952_create_reviews_table', 1),
(15, '2026_04_30_170958_create_addresses_table', 1),
(16, '2026_04_30_171002_create_wishlists_table', 1),
(17, '2026_04_30_171005_create_carts_table', 1),
(18, '2026_04_30_171012_create_coupons_table', 1),
(19, '2026_04_30_171017_create_notifications_table', 1),
(20, '2026_04_30_171021_create_chats_table', 1),
(21, '2026_04_30_171025_create_messages_table', 1),
(22, '2026_04_30_171028_create_live_sessions_table', 1),
(23, '2026_04_30_171033_create_cms_contents_table', 1),
(24, '2026_04_30_171037_create_vendor_withdrawals_table', 1),
(25, '2026_04_30_171041_create_settings_table', 1),
(26, '2026_04_30_171420_add_role_to_users_table', 1),
(27, '2026_04_30_172321_create_personal_access_tokens_table', 1),
(28, '2026_04_30_234341_add_order_type_and_pickup_hub_to_orders', 1),
(29, '2026_04_30_234400_create_pickup_hubs_table', 1),
(30, '2026_05_01_001930_add_fields_to_live_sessions_table', 1),
(31, '2026_05_01_012504_add_variants_to_product_images_table', 1),
(32, '2026_05_01_052132_create_refunds_table', 1),
(33, '2026_05_01_055901_create_promoter_wallets_table', 1),
(34, '2026_05_01_055906_create_promoter_withdrawals_table', 1),
(35, '2026_05_01_060117_add_promoter_fields_to_orders', 1),
(36, '2026_05_01_124743_add_product_type_and_deal_columns_to_products_table', 1),
(37, '2026_05_01_131527_add_title_to_reviews_table', 1),
(38, '2026_05_01_132608_create_colors_table', 1),
(39, '2026_05_01_133716_create_product_attributes_table', 1),
(40, '2026_05_01_133717_create_product_attribute_values_table', 1),
(41, '2026_05_01_140506_make_category_id_nullable_in_product_attribute_values_table', 1),
(42, '2026_05_01_142238_add_brand_columns_table', 1),
(43, '2026_05_01_144045_add_fields_to_categories_table', 1),
(44, '2026_05_01_162641_add_is_pos_to_orders_table', 1),
(45, '2026_05_01_170201_add_wholesale_fields_to_products_table', 1),
(46, '2026_05_01_180427_create_currencies_table', 1),
(47, '2026_05_01_181224_create_languages_table', 1),
(48, '2026_05_02_055615_add_social_login_columns_to_users_table', 1),
(49, '2026_05_02_104945_add_banned_at_to_users_table', 1),
(50, '2026_05_02_150204_add_daily_room_url_to_live_sessions_table', 1),
(51, '2026_05_02_163105_create_vendor_packages_table', 1),
(52, '2026_05_02_173935_add_image_to_vendor_packages_table', 1),
(53, '2026_05_02_192433_create_vendor_package_purchases_table', 1),
(54, '2026_05_02_192454_add_package_subscription_fields_to_users_table', 1),
(55, '2026_05_03_031514_add_coupon_foreign_key_to_orders_table', 1),
(56, '2026_05_03_054532_fix_notifications_table_uuid_default', 2),
(57, '2026_05_03_062653_add_confirmed_status_to_orders', 3),
(58, '2026_05_03_064758_update_payment_gateway_enum', 4),
(59, '2026_05_03_085019_add_flash_sale_fields_to_products_table', 5),
(60, '2026_05_03_195217_create_delivery_men_table', 6),
(61, '2026_05_03_201909_create_commissions_table', 7),
(62, '2026_05_03_203431_create_delivery_config_table', 8),
(63, '2026_05_03_203601_create_deposits_table', 9),
(65, '2026_05_03_203602_create_collections_table', 10),
(66, '2026_05_03_215919_add_notification_fields_to_delivery_config_table', 11),
(67, '2026_05_03_232644_add_storage_config_to_delivery_config_table', 12),
(68, '2026_05_03_233219_remove_storage_fields_from_delivery_config_table', 13),
(72, '2026_05_04_031446_create_wholesale_products_table', 14),
(73, '2026_05_05_004610_create_refund_settings_table', 15),
(74, '2026_05_05_020811_add_refund_settings_fields_to_refund_settings_table', 16),
(75, '2026_05_05_030001_create_campaigns_table', 17),
(76, '2026_05_05_030002_create_campaign_requests_table', 17),
(77, '2026_05_05_030003_create_bulk_sms_table', 17),
(78, '2026_05_05_030004_create_subscribers_table', 17),
(79, '2026_05_05_040001_add_featured_and_flash_sale_to_campaigns', 18),
(80, '2026_05_05_050001_add_product_and_discount_to_campaign_requests', 19),
(81, '2026_05_06_000001_add_warehouse_to_products_table', 20),
(82, '2026_05_06_000002_add_warehouse_fulfillment_to_order_items_table', 20),
(83, '2026_05_06_000003_create_order_shipments_table', 20),
(84, '2026_05_06_164823_add_heading_to_cms_contents_table', 21),
(85, '2026_05_07_042927_make_promoter_id_nullable_in_chats_table', 22),
(86, '2026_05_07_043257_add_admin_id_to_chats_table', 23),
(87, '2026_05_07_043805_make_customer_and_promoter_nullable_in_chats_table', 24),
(88, '2025_01_15_000001_create_departments_table', 25),
(89, '2025_01_15_000002_create_designations_table', 25),
(90, '2025_01_15_000003_create_employees_table', 25),
(91, '2025_01_15_000004_create_attendances_table', 25),
(92, '2025_01_15_000005_create_leaves_table', 25),
(93, '2025_01_15_000006_create_leave_balances_table', 25),
(94, '2025_01_15_000007_create_holidays_table', 25),
(95, '2025_01_15_000008_create_payrolls_table', 25),
(96, '2025_01_15_000009_create_performance_reviews_table', 25),
(97, '2025_01_15_000010_create_recruitment_jobs_table', 26),
(98, '2025_01_15_000011_create_referral_commissions_table', 27),
(99, '2025_01_15_000012_add_referral_fields', 27),
(100, '2025_01_15_000013_add_referral_to_orders', 28);

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

--
-- Table structure for table `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_roles`
--

INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES
(1, 'App\\Models\\User', 1),
(2, 'App\\Models\\User', 2),
(3, 'App\\Models\\User', 3),
(4, 'App\\Models\\User', 4);

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

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` varchar(36) NOT NULL DEFAULT uuid(),
  `type` varchar(255) NOT NULL,
  `notifiable_type` varchar(255) NOT NULL,
  `notifiable_id` bigint(20) UNSIGNED NOT NULL,
  `data` text NOT NULL,
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `type`, `notifiable_type`, `notifiable_id`, `data`, `read_at`, `created_at`, `updated_at`) VALUES
('0a393348-3338-4204-93fc-987c92983faf', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000001\",\"total\":\"49.99\",\"message\":\"Your order #MB-00000001 has been placed successfully.\"}', NULL, '2026-05-03 05:43:42', '2026-05-03 05:43:42'),
('12d4af51-886f-49b9-8488-34348ec36df4', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000008\",\"total\":\"49.99\",\"message\":\"Your order #MB-00000008 has been placed successfully.\"}', NULL, '2026-05-05 06:23:46', '2026-05-05 06:23:46'),
('156b6df4-8eac-4a9a-8a2f-e3242ed792f0', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000009\",\"order_number\":\"MB-00000009\",\"order_id\":9,\"total\":\"349.99\",\"customer_name\":\"Demo Customer\"}', '2026-05-07 13:43:14', '2026-05-07 08:29:01', '2026-05-07 13:43:14'),
('1775ba62-09fd-4d4f-aef8-519444b2f80c', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000004\",\"order_number\":\"MB-00000004\",\"order_id\":4,\"total\":\"0.00\",\"customer_name\":\"Super Admin\"}', '2026-05-05 06:59:06', '2026-05-03 13:42:04', '2026-05-05 06:59:06'),
('26c19714-52f9-4c69-9950-8c184c425d89', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000008\",\"order_number\":\"MB-00000008\",\"order_id\":8,\"total\":\"49.99\",\"customer_name\":\"Super Admin\"}', '2026-05-05 06:58:46', '2026-05-05 06:23:46', '2026-05-05 06:58:46'),
('2974a287-814e-4711-add3-a16740856f1a', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000006\",\"old_status\":\"pending\",\"new_status\":\"confirmed\",\"message\":\"Order #MB-00000006 status changed to Confirmed\"}', NULL, '2026-05-03 14:23:44', '2026-05-03 14:23:44'),
('2be1c43d-ecd3-4f7e-a8cc-12f3a0b6043a', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000006\",\"order_number\":\"MB-00000006\",\"order_id\":6,\"total\":\"49.99\",\"customer_name\":\"Super Admin\"}', '2026-05-05 06:58:56', '2026-05-03 13:50:47', '2026-05-05 06:58:56'),
('2d81d400-6e79-48b3-b6e4-da08e59fe67a', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000007\",\"old_status\":\"pending\",\"new_status\":\"processing\",\"message\":\"Order #MB-00000007 status changed to Processing\"}', NULL, '2026-05-03 19:04:48', '2026-05-03 19:04:48'),
('33a413eb-143a-4f3a-b9f7-71dbfc7c61d1', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 3, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000009\",\"old_status\":\"confirmed\",\"new_status\":\"confirmed\",\"message\":\"Order #MB-00000009 status changed to Confirmed\"}', NULL, '2026-05-07 08:30:31', '2026-05-07 08:30:31'),
('36fc7c4a-9e7d-4fd5-94be-f9a9a063a2a8', 'App\\Notifications\\NewVendorOrderNotification', 'App\\Models\\User', 2, '{\"type\":\"new_vendor_order\",\"order_number\":\"MB-00000009\",\"customer\":\"Demo Customer\",\"message\":\"New order #MB-00000009 received.\"}', NULL, '2026-05-07 08:29:01', '2026-05-07 08:29:01'),
('38a0c16b-f25b-4264-8301-65d2eaf6678e', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000005\",\"order_number\":\"MB-00000005\",\"order_id\":5,\"total\":\"24.99\",\"customer_name\":\"Super Admin\"}', '2026-05-05 06:58:59', '2026-05-03 13:43:30', '2026-05-05 06:58:59'),
('4409fb4c-dc0d-4cbe-9f87-3df2780560f2', 'App\\Notifications\\NewVendorOrderNotification', 'App\\Models\\User', 2, '{\"type\":\"new_vendor_order\",\"order_number\":\"MB-00000005\",\"customer\":\"Super Admin\",\"message\":\"New order #MB-00000005 received.\"}', NULL, '2026-05-03 13:43:30', '2026-05-03 13:43:30'),
('45ba24cc-a59e-452f-a8d0-eb658704f95f', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000007\",\"order_number\":\"MB-00000007\",\"order_id\":7,\"total\":\"24.99\",\"customer_name\":\"Super Admin\"}', '2026-05-05 06:58:53', '2026-05-03 14:02:04', '2026-05-05 06:58:53'),
('56e92e26-aa9e-4f40-9985-634cac030afa', 'App\\Notifications\\NewVendorOrderNotification', 'App\\Models\\User', 2, '{\"type\":\"new_vendor_order\",\"order_number\":\"MB-00000007\",\"customer\":\"Super Admin\",\"message\":\"New order #MB-00000007 received.\"}', NULL, '2026-05-03 14:02:04', '2026-05-03 14:02:04'),
('61233e99-5e56-4567-86b2-dc056ca8d6a7', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000005\",\"total\":\"24.99\",\"message\":\"Your order #MB-00000005 has been placed successfully.\"}', NULL, '2026-05-03 13:43:30', '2026-05-03 13:43:30'),
('63eb6e23-845d-4886-97cf-5350baf3572e', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000009\",\"old_status\":\"confirmed\",\"new_status\":\"confirmed\",\"message\":\"Order #MB-00000009 status changed to Confirmed\"}', NULL, '2026-05-07 08:30:31', '2026-05-07 08:30:31'),
('670f5266-348e-4749-b82c-2891d1f04c9e', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000001\",\"old_status\":\"processing\",\"new_status\":\"shipped\",\"message\":\"Order #MB-00000001 status changed to Shipped\"}', NULL, '2026-05-03 06:49:52', '2026-05-03 06:49:52'),
('6bade8b2-de88-45e4-af40-190d492d3256', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 1, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000001\",\"old_status\":\"processing\",\"new_status\":\"processing\",\"message\":\"Order #MB-00000001 status changed to Processing\"}', NULL, '2026-05-03 06:01:07', '2026-05-03 06:01:07'),
('704821af-ff07-4b05-8025-c3c537787f06', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000009\",\"old_status\":\"pending\",\"new_status\":\"confirmed\",\"message\":\"Order #MB-00000009 status changed to Confirmed\"}', NULL, '2026-05-07 08:29:56', '2026-05-07 08:29:56'),
('70d28681-9c1c-4db5-b71b-87b264a44a91', 'App\\Notifications\\NewOrderNotification', 'App\\Models\\User', 1, '{\"type\":\"new_order\",\"message\":\"New order placed: MB-00000002\",\"order_number\":\"MB-00000002\",\"order_id\":2,\"total\":\"0.00\",\"customer_name\":\"Super Admin\"}', '2026-05-05 06:59:10', '2026-05-03 05:46:50', '2026-05-05 06:59:10'),
('7227a371-f035-4d2b-b3a0-2701968d037b', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 3, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000009\",\"total\":\"349.99\",\"message\":\"Your order #MB-00000009 has been placed successfully.\"}', NULL, '2026-05-07 08:29:01', '2026-05-07 08:29:01'),
('75f21398-59dd-4e8a-abca-5e2b02b7cec7', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 3, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000009\",\"old_status\":\"pending\",\"new_status\":\"confirmed\",\"message\":\"Order #MB-00000009 status changed to Confirmed\"}', NULL, '2026-05-07 08:29:56', '2026-05-07 08:29:56'),
('7e4ad40c-827d-4cfd-b9b3-644058849c43', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 1, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000006\",\"old_status\":\"confirmed\",\"new_status\":\"processing\",\"message\":\"Order #MB-00000006 status changed to Processing\"}', NULL, '2026-05-03 14:24:14', '2026-05-03 14:24:14'),
('958c41d0-178a-4370-aac1-891f9c0011d1', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000002\",\"total\":\"0.00\",\"message\":\"Your order #MB-00000002 has been placed successfully.\"}', NULL, '2026-05-03 05:46:50', '2026-05-03 05:46:50'),
('99ca1061-016b-4143-9f7c-252b720907fe', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000006\",\"old_status\":\"confirmed\",\"new_status\":\"processing\",\"message\":\"Order #MB-00000006 status changed to Processing\"}', NULL, '2026-05-03 14:24:14', '2026-05-03 14:24:14'),
('a225df3e-6713-4517-b604-ffe0c1908b4e', 'App\\Notifications\\NewVendorOrderNotification', 'App\\Models\\User', 2, '{\"type\":\"new_vendor_order\",\"order_number\":\"MB-00000008\",\"customer\":\"Super Admin\",\"message\":\"New order #MB-00000008 received.\"}', NULL, '2026-05-05 06:23:46', '2026-05-05 06:23:46'),
('a62eac33-35a2-4c22-8aff-6ae76d17f87e', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 2, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000001\",\"old_status\":\"processing\",\"new_status\":\"processing\",\"message\":\"Order #MB-00000001 status changed to Processing\"}', NULL, '2026-05-03 06:01:07', '2026-05-03 06:01:07'),
('a66578b1-cf9d-42c5-a80c-44faba60bf92', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000004\",\"total\":\"0.00\",\"message\":\"Your order #MB-00000004 has been placed successfully.\"}', NULL, '2026-05-03 13:42:04', '2026-05-03 13:42:04'),
('b158a200-3553-415a-a028-d08b3af8d66d', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000006\",\"total\":\"49.99\",\"message\":\"Your order #MB-00000006 has been placed successfully.\"}', NULL, '2026-05-03 13:50:47', '2026-05-03 13:50:47'),
('d5677175-6554-4767-a699-f53c2ea95ebd', 'App\\Notifications\\NewVendorOrderNotification', 'App\\Models\\User', 2, '{\"type\":\"new_vendor_order\",\"order_number\":\"MB-00000006\",\"customer\":\"Super Admin\",\"message\":\"New order #MB-00000006 received.\"}', NULL, '2026-05-03 13:50:47', '2026-05-03 13:50:47'),
('d96316aa-827b-4abb-91df-8ae67d1afcdc', 'App\\Notifications\\NewVendorOrderNotification', 'App\\Models\\User', 2, '{\"type\":\"new_vendor_order\",\"order_number\":\"MB-00000001\",\"customer\":\"Super Admin\",\"message\":\"New order #MB-00000001 received.\"}', NULL, '2026-05-03 05:43:42', '2026-05-03 05:43:42'),
('e56b1cc6-c088-4b0b-9286-1e732b30d345', 'App\\Notifications\\OrderPlacedNotification', 'App\\Models\\User', 1, '{\"type\":\"order_placed\",\"order_number\":\"MB-00000007\",\"total\":\"24.99\",\"message\":\"Your order #MB-00000007 has been placed successfully.\"}', NULL, '2026-05-03 14:02:04', '2026-05-03 14:02:04'),
('e9870c6a-7157-4e93-9173-1aa29cc08e12', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 1, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000006\",\"old_status\":\"pending\",\"new_status\":\"confirmed\",\"message\":\"Order #MB-00000006 status changed to Confirmed\"}', NULL, '2026-05-03 14:23:44', '2026-05-03 14:23:44'),
('f0cb4eea-5132-4a96-ad22-9edda42b670e', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 1, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000001\",\"old_status\":\"processing\",\"new_status\":\"shipped\",\"message\":\"Order #MB-00000001 status changed to Shipped\"}', NULL, '2026-05-03 06:49:52', '2026-05-03 06:49:52'),
('ff7e7850-9bba-4945-b99e-c8aaff853a33', 'App\\Notifications\\OrderStatusNotification', 'App\\Models\\User', 1, '{\"type\":\"order_status_update\",\"order_number\":\"MB-00000007\",\"old_status\":\"pending\",\"new_status\":\"processing\",\"message\":\"Order #MB-00000007 status changed to Processing\"}', NULL, '2026-05-03 19:04:48', '2026-05-03 19:04:48');

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

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_number` varchar(255) NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `promoter_id` bigint(20) UNSIGNED DEFAULT NULL,
  `subtotal` decimal(15,2) NOT NULL,
  `shipping_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total` decimal(15,2) NOT NULL,
  `promoter_commission` decimal(10,2) NOT NULL DEFAULT 0.00,
  `promoter_commission_credited` tinyint(1) NOT NULL DEFAULT 0,
  `status` enum('pending','confirmed','processing','shipped','delivered','cancelled','refunded','ready_for_pickup','picked_up') DEFAULT 'pending',
  `order_type` enum('admin','vendor','pickup_hub') NOT NULL DEFAULT 'vendor',
  `pickup_hub_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_status` enum('pending','paid','failed','refunded') NOT NULL DEFAULT 'pending',
  `payment_method` varchar(255) DEFAULT NULL,
  `is_pos` tinyint(1) NOT NULL DEFAULT 0,
  `payment_transaction_id` varchar(255) DEFAULT NULL,
  `shipping_method` varchar(255) DEFAULT NULL,
  `shipping_address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`shipping_address`)),
  `billing_address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`billing_address`)),
  `coupon_id` bigint(20) UNSIGNED DEFAULT NULL,
  `coupon_code` varchar(255) DEFAULT NULL,
  `referral_code` varchar(255) DEFAULT NULL,
  `referrable_type` varchar(255) DEFAULT NULL,
  `referrable_id` bigint(20) UNSIGNED DEFAULT NULL,
  `referral_commission` decimal(15,2) NOT NULL DEFAULT 0.00,
  `referral_commission_credited` tinyint(1) NOT NULL DEFAULT 0,
  `customer_notes` text DEFAULT NULL,
  `admin_notes` text DEFAULT NULL,
  `paid_at` timestamp NULL DEFAULT NULL,
  `shipped_at` timestamp NULL DEFAULT NULL,
  `ready_for_pickup_at` timestamp NULL DEFAULT NULL,
  `picked_up_at` timestamp NULL DEFAULT NULL,
  `delivered_at` timestamp NULL DEFAULT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `cancelled_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id`, `order_number`, `customer_id`, `promoter_id`, `subtotal`, `shipping_cost`, `tax`, `discount`, `total`, `promoter_commission`, `promoter_commission_credited`, `status`, `order_type`, `pickup_hub_id`, `payment_status`, `payment_method`, `is_pos`, `payment_transaction_id`, `shipping_method`, `shipping_address`, `billing_address`, `coupon_id`, `coupon_code`, `referral_code`, `referrable_type`, `referrable_id`, `referral_commission`, `referral_commission_credited`, `customer_notes`, `admin_notes`, `paid_at`, `shipped_at`, `ready_for_pickup_at`, `picked_up_at`, `delivered_at`, `cancelled_at`, `cancelled_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'MB-00000001', 1, NULL, 49.99, 0.00, 0.00, 0.00, 49.99, 0.00, 0, 'shipped', 'vendor', NULL, 'paid', 'cod', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, '2026-05-03 06:49:07', NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 05:43:42', '2026-05-03 06:49:52', NULL),
(2, 'MB-00000002', 1, NULL, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0, 'pending', 'admin', NULL, 'pending', 'cod', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 05:46:50', '2026-05-03 07:12:10', '2026-05-03 07:12:10'),
(3, 'MB-00000003', 1, NULL, 349.99, 0.00, 0.00, 0.00, 349.99, 0.00, 0, 'pending', 'vendor', NULL, 'pending', 'mtn_momo', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 13:40:09', '2026-05-03 13:42:45', '2026-05-03 13:42:45'),
(4, 'MB-00000004', 1, NULL, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0, 'pending', 'admin', NULL, 'pending', 'mtn_momo', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 13:42:04', '2026-05-03 13:42:47', '2026-05-03 13:42:47'),
(5, 'MB-00000005', 1, NULL, 24.99, 0.00, 0.00, 0.00, 24.99, 0.00, 0, 'pending', 'vendor', NULL, 'pending', 'mtn_momo', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 13:43:30', '2026-05-03 13:47:07', '2026-05-03 13:47:07'),
(6, 'MB-00000006', 1, NULL, 49.99, 0.00, 0.00, 0.00, 49.99, 0.00, 0, 'processing', 'vendor', NULL, 'pending', 'cod', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 13:50:47', '2026-05-03 14:24:14', NULL),
(7, 'MB-00000007', 1, NULL, 24.99, 0.00, 0.00, 0.00, 24.99, 0.00, 0, 'processing', 'vendor', NULL, 'pending', 'card', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-03 14:02:04', '2026-05-03 19:04:48', NULL),
(8, 'MB-00000008', 1, NULL, 49.99, 0.00, 0.00, 0.00, 49.99, 0.00, 0, 'pending', 'vendor', NULL, 'pending', 'cod', 0, NULL, NULL, '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Andrews\",\"last_name\":\"Offei Boateng\",\"phone\":\"+233247525851\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-05 06:23:46', '2026-05-05 06:23:46', NULL),
(9, 'MB-00000009', 3, NULL, 349.99, 0.00, 0.00, 0.00, 349.99, 0.00, 0, 'confirmed', 'vendor', NULL, 'pending', 'cod', 0, NULL, NULL, '{\"first_name\":\"Lois\",\"last_name\":\"Adoma\",\"phone\":\"0506600358\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', '{\"first_name\":\"Lois\",\"last_name\":\"Adoma\",\"phone\":\"0506600358\",\"address_line1\":\"Nana Afia Serwaa Avenue\",\"address_line2\":\"AE-1310-8610\",\"city\":\"Juaben\",\"state\":\"Kumasi\",\"postal_code\":\"AE1310\",\"country\":\"Ghana\"}', NULL, NULL, NULL, NULL, NULL, 0.00, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-05-07 08:29:00', '2026-05-07 08:29:56', NULL);

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

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `variant_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_sku` varchar(255) DEFAULT NULL,
  `warehouse` enum('ghana','china') NOT NULL DEFAULT 'ghana',
  `fulfillment_status` enum('pending','in_transit','arrived','shipped','delivered') NOT NULL DEFAULT 'pending',
  `expected_arrival` date DEFAULT NULL COMMENT 'Expected arrival date for China freight',
  `quantity` int(11) NOT NULL,
  `price` decimal(15,2) NOT NULL COMMENT 'Unit price at time of order',
  `subtotal` decimal(15,2) NOT NULL COMMENT 'quantity * price',
  `vendor_earnings` decimal(15,2) NOT NULL DEFAULT 0.00 COMMENT 'Amount after platform commission',
  `options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Selected variant options' CHECK (json_valid(`options`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_items`
--

INSERT INTO `order_items` (`id`, `order_id`, `vendor_id`, `product_id`, `variant_id`, `product_name`, `product_sku`, `warehouse`, `fulfillment_status`, `expected_arrival`, `quantity`, `price`, `subtotal`, `vendor_earnings`, `options`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 7, NULL, 'Digital Marketing Masterclass', 'F1THV3XP', 'ghana', 'pending', NULL, 1, 49.99, 49.99, 49.99, NULL, '2026-05-03 05:43:42', '2026-05-03 05:43:42'),
(2, 3, 1, 4, NULL, 'Sony WH-1000XM5 Headphones', 'YC93OG2C', 'ghana', 'pending', NULL, 1, 349.99, 349.99, 349.99, NULL, '2026-05-03 13:40:09', '2026-05-03 13:40:09'),
(3, 5, 1, 10, NULL, 'Wireless Charging Pad', 'Q8Y840WJ', 'ghana', 'pending', NULL, 1, 24.99, 24.99, 24.99, NULL, '2026-05-03 13:43:30', '2026-05-03 13:43:30'),
(4, 6, 1, 7, NULL, 'Digital Marketing Masterclass', 'F1THV3XP', 'ghana', 'pending', NULL, 1, 49.99, 49.99, 49.99, NULL, '2026-05-03 13:50:47', '2026-05-03 13:50:47'),
(5, 7, 1, 10, NULL, 'Wireless Charging Pad', 'Q8Y840WJ', 'ghana', 'pending', NULL, 1, 24.99, 24.99, 24.99, NULL, '2026-05-03 14:02:04', '2026-05-03 14:02:04'),
(6, 8, 1, 7, NULL, 'Digital Marketing Masterclass', 'F1THV3XP', 'ghana', 'pending', NULL, 1, 49.99, 49.99, 49.99, NULL, '2026-05-05 06:23:46', '2026-05-05 06:23:46'),
(7, 9, 1, 4, NULL, 'Sony WH-1000XM5 Headphones', 'YC93OG2C', 'ghana', 'pending', NULL, 1, 349.99, 349.99, 349.99, NULL, '2026-05-07 08:29:00', '2026-05-07 08:29:00');

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

--
-- Table structure for table `order_shipments`
--

CREATE TABLE `order_shipments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse` enum('ghana','china') NOT NULL,
  `status` enum('pending','processing','in_transit','out_for_delivery','delivered') NOT NULL DEFAULT 'pending',
  `tracking_number` varchar(255) DEFAULT NULL,
  `carrier` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `shipped_at` date DEFAULT NULL,
  `delivered_at` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `order_shipments`
--

INSERT INTO `order_shipments` (`id`, `order_id`, `warehouse`, `status`, `tracking_number`, `carrier`, `notes`, `shipped_at`, `delivered_at`, `created_at`, `updated_at`) VALUES
(1, 9, 'ghana', 'pending', NULL, NULL, NULL, NULL, NULL, '2026-05-07 08:29:00', '2026-05-07 08:29:00');

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

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `transaction_id` varchar(255) DEFAULT NULL,
  `payment_method` varchar(255) NOT NULL,
  `payment_gateway` enum('stripe','paypal','paystack','flutterwave','manual','cash','mtn_momo','telecash','card') DEFAULT NULL,
  `amount` decimal(15,2) NOT NULL,
  `status` enum('pending','completed','failed','refunded') NOT NULL DEFAULT 'pending',
  `gateway_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`gateway_response`)),
  `receipt_url` varchar(255) DEFAULT NULL,
  `paid_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` (`id`, `order_id`, `customer_id`, `transaction_id`, `payment_method`, `payment_gateway`, `amount`, `status`, `gateway_response`, `receipt_url`, `paid_at`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 'CASH-1777790947', 'cash', 'cash', 49.99, 'completed', '{\"amount_tendered\":49.99,\"change\":0}', NULL, '2026-05-03 06:49:07', '2026-05-03 06:49:07', '2026-05-03 06:49:07');

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

--
-- Table structure for table `payrolls`
--

CREATE TABLE `payrolls` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `payroll_period` varchar(255) NOT NULL,
  `basic_salary` decimal(12,2) NOT NULL,
  `allowances` decimal(12,2) NOT NULL DEFAULT 0.00,
  `deductions` decimal(12,2) NOT NULL DEFAULT 0.00,
  `overtime` decimal(12,2) NOT NULL DEFAULT 0.00,
  `bonus` decimal(12,2) NOT NULL DEFAULT 0.00,
  `gross_salary` decimal(12,2) NOT NULL,
  `tax` decimal(12,2) NOT NULL DEFAULT 0.00,
  `net_salary` decimal(12,2) NOT NULL,
  `status` enum('draft','pending','paid','cancelled') NOT NULL DEFAULT 'draft',
  `payment_date` date DEFAULT NULL,
  `payment_method` enum('bank','cash','mobile_money') DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `performance_reviews`
--

CREATE TABLE `performance_reviews` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `reviewer_id` bigint(20) UNSIGNED NOT NULL,
  `review_period` varchar(255) NOT NULL,
  `rating` int(11) NOT NULL COMMENT 'Rating from 1 to 5',
  `strengths` text DEFAULT NULL,
  `weaknesses` text DEFAULT NULL,
  `goals` text DEFAULT NULL,
  `comments` text DEFAULT NULL,
  `status` enum('draft','submitted','reviewed') NOT NULL DEFAULT 'draft',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'manage users', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(2, 'manage vendors', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(3, 'manage products', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(4, 'manage orders', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(5, 'manage payments', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(6, 'manage coupons', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(7, 'manage reviews', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(8, 'manage cms', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(9, 'manage settings', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(10, 'view analytics', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(11, 'manage promotions', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(12, 'manage promoters', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(13, 'view reports', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(14, 'manage withdrawals', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(15, 'manage own products', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(16, 'manage own orders', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(17, 'view own analytics', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(18, 'request withdrawal', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(19, 'manage own inventory', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(20, 'place orders', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(21, 'write reviews', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(22, 'manage wishlist', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(23, 'chat with promoter', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(24, 'chat with customers', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(25, 'host live sessions', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(26, 'view engagement metrics', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16');

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

--
-- Table structure for table `pickup_hubs`
--

CREATE TABLE `pickup_hubs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text NOT NULL,
  `city` varchar(255) NOT NULL,
  `state` varchar(255) NOT NULL,
  `zip` varchar(255) NOT NULL,
  `country` varchar(255) NOT NULL DEFAULT 'US',
  `latitude` decimal(10,8) DEFAULT NULL,
  `longitude` decimal(11,8) DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `opening_time` time DEFAULT NULL,
  `closing_time` time DEFAULT NULL,
  `operating_days` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `manager_id` bigint(20) UNSIGNED DEFAULT NULL,
  `orders_count` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `pickup_hubs`
--

INSERT INTO `pickup_hubs` (`id`, `name`, `slug`, `code`, `phone`, `email`, `address`, `city`, `state`, `zip`, `country`, `latitude`, `longitude`, `status`, `opening_time`, `closing_time`, `operating_days`, `description`, `image`, `manager_id`, `orders_count`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Accra Central Hub', 'accra-central', 'ACC-001', '+233302123456', 'accra@mebuy.com', '15 Oxford Street, Osu', 'Accra', 'Greater Accra', '00233', 'GH', NULL, NULL, 'active', '08:00:00', '20:00:00', '[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"]', 'Main pickup hub in Accra central business district', NULL, NULL, 0, '2026-05-03 03:29:33', '2026-05-03 03:29:33', NULL),
(2, 'Kumasi Hub', 'kumasi', 'KMS-001', '+233322123456', 'kumasi@mebuy.com', '42 Harper Road, Adum', 'Kumasi', 'Ashanti', '00233', 'GH', NULL, NULL, 'active', '09:00:00', '18:00:00', '[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\"]', 'Kumasi regional pickup point', NULL, NULL, 0, '2026-05-03 03:29:33', '2026-05-03 03:29:33', NULL),
(3, 'Tema Hub', 'tema', 'TMA-001', '+233303123456', 'tema@mebuy.com', '8 Harbour Road, Tema Community 1', 'Tema', 'Greater Accra', '00233', 'GH', NULL, NULL, 'active', '08:00:00', '19:00:00', '[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"]', 'Tema port area pickup hub', NULL, NULL, 0, '2026-05-03 03:29:33', '2026-05-03 03:29:33', NULL);

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

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

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `category_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `sku` varchar(255) DEFAULT NULL,
  `short_description` text DEFAULT NULL,
  `description` longtext DEFAULT NULL,
  `price` decimal(15,2) NOT NULL,
  `compare_price` decimal(15,2) DEFAULT NULL COMMENT 'Original price before discount',
  `cost_price` decimal(15,2) DEFAULT NULL COMMENT 'Vendor cost price',
  `wholesale_price` decimal(15,2) DEFAULT NULL,
  `min_wholesale_quantity` int(11) NOT NULL DEFAULT 10,
  `wholesale_tiers` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`wholesale_tiers`)),
  `stock_quantity` int(11) NOT NULL DEFAULT 0,
  `low_stock_threshold` int(11) NOT NULL DEFAULT 5,
  `stock_status` enum('in_stock','out_of_stock','on_backorder') NOT NULL DEFAULT 'in_stock',
  `warehouse` enum('ghana','china') NOT NULL DEFAULT 'ghana',
  `china_freight_days` int(11) DEFAULT NULL COMMENT 'Estimated days for China freight to arrive in Ghana',
  `track_inventory` tinyint(1) NOT NULL DEFAULT 1,
  `weight` decimal(10,2) DEFAULT NULL,
  `dimensions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'length, width, height' CHECK (json_valid(`dimensions`)),
  `status` enum('draft','pending','published','rejected') NOT NULL DEFAULT 'draft',
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_flash_sale` tinyint(1) NOT NULL DEFAULT 0,
  `flash_sale_price` decimal(15,2) DEFAULT NULL,
  `flash_sale_starts_at` timestamp NULL DEFAULT NULL,
  `flash_sale_ends_at` timestamp NULL DEFAULT NULL,
  `is_digital` tinyint(1) NOT NULL DEFAULT 0,
  `is_todays_deal` tinyint(1) NOT NULL DEFAULT 0,
  `is_catalog` tinyint(1) NOT NULL DEFAULT 0,
  `is_wholesale` tinyint(1) NOT NULL DEFAULT 0,
  `type` varchar(255) NOT NULL DEFAULT 'catalog',
  `digital_files` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`digital_files`)),
  `rating` decimal(3,2) NOT NULL DEFAULT 0.00,
  `reviews_count` int(11) NOT NULL DEFAULT 0,
  `sales_count` int(11) NOT NULL DEFAULT 0,
  `views_count` int(11) NOT NULL DEFAULT 0,
  `tags` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`tags`)),
  `attributes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Product specifications' CHECK (json_valid(`attributes`)),
  `meta` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'SEO meta data' CHECK (json_valid(`meta`)),
  `published_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `products` (`id`, `vendor_id`, `category_id`, `name`, `slug`, `sku`, `short_description`, `description`, `price`, `compare_price`, `cost_price`, `wholesale_price`, `min_wholesale_quantity`, `wholesale_tiers`, `stock_quantity`, `low_stock_threshold`, `stock_status`, `warehouse`, `china_freight_days`, `track_inventory`, `weight`, `dimensions`, `status`, `is_featured`, `is_flash_sale`, `flash_sale_price`, `flash_sale_starts_at`, `flash_sale_ends_at`, `is_digital`, `is_todays_deal`, `is_catalog`, `is_wholesale`, `type`, `digital_files`, `rating`, `reviews_count`, `sales_count`, `views_count`, `tags`, `attributes`, `meta`, `published_at`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'iPhone 15 Pro Max', 'iphone-15-pro-max', 'DGGOI3ZI', 'Latest Apple flagship with A17 Pro chip', '<p>The iPhone 15 Pro Max features the powerful A17 Pro chip, a stunning 6.7-inch Super Retina XDR display, and an advanced camera system with 5x optical zoom. Built with titanium for durability and elegance.</p>', 1199.99, 1299.99, NULL, NULL, 10, NULL, 50, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 1, 1, 839.99, '2026-05-07 04:50:21', '2026-05-10 06:50:21', 0, 1, 0, 0, 'physical', NULL, 4.10, 137, 475, 1913, '[\"apple\",\"smartphone\",\"iphone\"]', NULL, NULL, '2026-03-26 03:38:48', '2026-05-03 03:38:48', '2026-05-07 06:50:21', NULL),
(2, 1, 7, 'Samsung Galaxy S24 Ultra', 'samsung-galaxy-s24-ultra', 'BWJSLXKH', 'Premium Android phone with S Pen', '<p>The Samsung Galaxy S24 Ultra comes with a built-in S Pen, 200MP camera, and the powerful Snapdragon 8 Gen 3 processor. Features a stunning 6.8-inch Dynamic AMOLED display.</p>', 1299.99, 1399.99, NULL, NULL, 10, NULL, 35, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 1, 1, 909.99, '2026-05-07 04:50:21', '2026-05-10 06:50:21', 0, 0, 0, 0, 'physical', NULL, 4.10, 94, 209, 960, '[\"samsung\",\"smartphone\",\"android\"]', NULL, NULL, '2026-03-19 03:38:48', '2026-05-03 03:38:48', '2026-05-07 06:50:21', NULL),
(3, 1, 12, 'MacBook Pro 16\" M3 Max', 'macbook-pro-16-m3-max', '1EI7CJ0F', 'Professional laptop for creatives', '<p>The MacBook Pro 16-inch with M3 Max chip delivers unprecedented performance for professional workflows. Features a stunning Liquid Retina XDR display and up to 22 hours of battery life.</p>', 2499.99, 2799.99, NULL, NULL, 10, NULL, 20, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 1, 1, 1749.99, '2026-05-07 04:50:21', '2026-05-10 06:50:21', 0, 1, 0, 0, 'physical', NULL, 4.30, 160, 499, 1431, '[\"apple\",\"laptop\",\"macbook\"]', NULL, NULL, '2026-04-03 03:38:48', '2026-05-03 03:38:48', '2026-05-07 06:50:21', NULL),
(4, 1, 16, 'Sony WH-1000XM5 Headphones', 'sony-wh-1000xm5-headphones', 'YC93OG2C', 'Industry-leading noise cancellation', '<p>The Sony WH-1000XM5 headphones deliver exceptional sound quality with industry-leading noise cancellation. Features 30-hour battery life and ultra-comfortable design.</p>', 349.99, 399.99, NULL, NULL, 10, NULL, 98, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 0, 1, 244.99, '2026-05-07 04:50:21', '2026-05-10 06:50:21', 0, 1, 0, 0, 'physical', NULL, 5.00, 106, 59, 744, '[\"sony\",\"headphones\",\"audio\"]', NULL, NULL, '2026-02-02 03:38:48', '2026-05-03 03:38:48', '2026-05-07 08:29:00', NULL),
(5, 1, 20, 'Nike Air Max 270', 'nike-air-max-270', 'VARRRAV9', 'Comfortable running shoes', '<p>The Nike Air Max 270 features the largest Max Air unit yet for unmatched comfort. Perfect for running, training, or everyday wear.</p>', 149.99, 179.99, NULL, NULL, 10, NULL, 75, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 'physical', NULL, 4.50, 131, 302, 242, '[\"nike\",\"shoes\",\"running\"]', NULL, NULL, '2026-02-26 03:38:48', '2026-05-03 03:38:48', '2026-05-03 03:38:48', NULL),
(6, 1, 24, 'Organic Skincare Set', 'organic-skincare-set', '4EJ5GL99', 'Complete organic skincare routine', '<p>This premium organic skincare set includes cleanser, toner, serum, and moisturizer. Made with 100% natural ingredients for all skin types.</p>', 89.99, 120.00, NULL, NULL, 10, NULL, 200, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 0, 0, NULL, NULL, NULL, 0, 1, 0, 0, 'physical', NULL, 4.60, 23, 325, 1665, '[\"skincare\",\"organic\",\"beauty\"]', NULL, NULL, '2026-02-26 03:38:48', '2026-05-03 03:38:48', '2026-05-03 03:38:48', NULL),
(7, 1, 28, 'Digital Marketing Masterclass', 'digital-marketing-masterclass', 'F1THV3XP', 'Complete online course for digital marketing', '<p>Learn digital marketing from scratch with this comprehensive course. Covers SEO, social media, email marketing, PPC, and more. Lifetime access with updates.</p>', 49.99, 199.99, NULL, NULL, 10, NULL, 9999, 5, 'in_stock', 'ghana', NULL, 0, NULL, NULL, 'published', 1, 0, NULL, NULL, NULL, 1, 0, 0, 0, 'digital', NULL, 4.30, 184, 126, 1327, '[\"course\",\"digital-marketing\",\"education\"]', NULL, NULL, '2026-04-18 03:39:13', '2026-05-03 03:39:13', '2026-05-05 06:23:22', NULL),
(8, 1, 32, 'Yoga Mat Premium', 'yoga-mat-premium', 'ETX0LFUM', 'Non-slip exercise yoga mat', '<p>Premium 6mm thick yoga mat with non-slip surface. Perfect for yoga, pilates, and general exercise. Includes carrying strap.</p>', 39.99, 59.99, NULL, NULL, 10, NULL, 150, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 'physical', NULL, 4.60, 192, 200, 656, '[\"yoga\",\"fitness\",\"exercise\"]', NULL, NULL, '2026-04-03 03:39:22', '2026-05-03 03:39:22', '2026-05-03 03:54:13', NULL),
(9, 1, 1, 'Smart Watch Ultra', 'smart-watch-ultra', 'U2CSRSUP', 'Advanced fitness and health tracking', '<p>The Smart Watch Ultra features GPS, heart rate monitoring, blood oxygen tracking, and 7-day battery life. Water resistant to 100m.</p>', 299.99, 399.99, NULL, NULL, 10, NULL, 60, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 1, 1, 199.99, '2026-05-07 04:50:21', '2026-05-10 06:50:21', 0, 1, 0, 0, 'physical', NULL, 3.70, 112, 407, 763, '[\"smartwatch\",\"fitness\",\"wearable\"]', NULL, NULL, '2026-03-30 03:39:22', '2026-05-03 03:39:22', '2026-05-07 06:50:21', NULL),
(10, 1, 7, 'Wireless Charging Pad', 'wireless-charging-pad', 'Q8Y840WJ', 'Fast wireless charger for all devices', '<p>15W fast wireless charging pad compatible with all Qi-enabled devices. Slim design with LED indicator and anti-slip surface.</p>', 24.99, 39.99, NULL, NULL, 10, NULL, 298, 5, 'in_stock', 'ghana', NULL, 1, NULL, NULL, 'published', 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 'physical', NULL, 5.00, 72, 235, 995, '[\"charger\",\"wireless\",\"accessories\"]', NULL, NULL, '2026-03-09 03:39:24', '2026-05-03 03:39:24', '2026-05-03 19:03:54', NULL);

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

--
-- Table structure for table `product_attributes`
--

CREATE TABLE `product_attributes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `product_attribute_values`
--

CREATE TABLE `product_attribute_values` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `attribute_id` bigint(20) UNSIGNED NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `value` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `product_images`
--

CREATE TABLE `product_images` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `path` varchar(255) NOT NULL,
  `original_name` varchar(255) DEFAULT NULL,
  `variants` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`variants`)),
  `alt_text` varchar(255) DEFAULT NULL,
  `sort_order` int(11) NOT NULL DEFAULT 0,
  `is_primary` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_images`
--

INSERT INTO `product_images` (`id`, `product_id`, `path`, `original_name`, `variants`, `alt_text`, `sort_order`, `is_primary`, `created_at`, `updated_at`) VALUES
(1, 1, 'products/iphone-15-pro-max-1.jpg', NULL, NULL, 'iPhone 15 Pro Max', 0, 1, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(2, 1, 'products/iphone-15-pro-max-2.jpg', NULL, NULL, 'iPhone 15 Pro Max', 1, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(3, 1, 'products/iphone-15-pro-max-3.jpg', NULL, NULL, 'iPhone 15 Pro Max', 2, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(4, 2, 'products/samsung-galaxy-s24-ultra-1.jpg', NULL, NULL, 'Samsung Galaxy S24 Ultra', 0, 1, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(5, 2, 'products/samsung-galaxy-s24-ultra-2.jpg', NULL, NULL, 'Samsung Galaxy S24 Ultra', 1, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(6, 2, 'products/samsung-galaxy-s24-ultra-3.jpg', NULL, NULL, 'Samsung Galaxy S24 Ultra', 2, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(7, 3, 'products/macbook-pro-16-m3-max-1.jpg', NULL, NULL, 'MacBook Pro 16\" M3 Max', 0, 1, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(8, 3, 'products/macbook-pro-16-m3-max-2.jpg', NULL, NULL, 'MacBook Pro 16\" M3 Max', 1, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(9, 3, 'products/macbook-pro-16-m3-max-3.jpg', NULL, NULL, 'MacBook Pro 16\" M3 Max', 2, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(10, 4, 'products/sony-wh-1000xm5-headphones-1.jpg', NULL, NULL, 'Sony WH-1000XM5 Headphones', 0, 1, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(11, 4, 'products/sony-wh-1000xm5-headphones-2.jpg', NULL, NULL, 'Sony WH-1000XM5 Headphones', 1, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(12, 4, 'products/sony-wh-1000xm5-headphones-3.jpg', NULL, NULL, 'Sony WH-1000XM5 Headphones', 2, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(13, 5, 'products/nike-air-max-270-1.jpg', NULL, NULL, 'Nike Air Max 270', 0, 1, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(14, 5, 'products/nike-air-max-270-2.jpg', NULL, NULL, 'Nike Air Max 270', 1, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(15, 5, 'products/nike-air-max-270-3.jpg', NULL, NULL, 'Nike Air Max 270', 2, 0, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(16, 6, 'products/organic-skincare-set-1.jpg', NULL, NULL, 'Organic Skincare Set', 0, 1, '2026-05-03 03:38:48', '2026-05-03 03:38:48'),
(17, 6, 'products/organic-skincare-set-2.jpg', NULL, NULL, 'Organic Skincare Set', 1, 0, '2026-05-03 03:39:01', '2026-05-03 03:39:01'),
(18, 6, 'products/organic-skincare-set-3.jpg', NULL, NULL, 'Organic Skincare Set', 2, 0, '2026-05-03 03:39:13', '2026-05-03 03:39:13'),
(19, 7, 'products/digital-marketing-masterclass-1.jpg', NULL, NULL, 'Digital Marketing Masterclass', 0, 1, '2026-05-03 03:39:13', '2026-05-03 03:39:13'),
(20, 7, 'products/digital-marketing-masterclass-2.jpg', NULL, NULL, 'Digital Marketing Masterclass', 1, 0, '2026-05-03 03:39:22', '2026-05-03 03:39:22'),
(21, 7, 'products/digital-marketing-masterclass-3.jpg', NULL, NULL, 'Digital Marketing Masterclass', 2, 0, '2026-05-03 03:39:22', '2026-05-03 03:39:22'),
(22, 8, 'products/yoga-mat-premium-1.jpg', NULL, NULL, 'Yoga Mat Premium', 0, 1, '2026-05-03 03:39:22', '2026-05-03 03:39:22'),
(23, 8, 'products/yoga-mat-premium-2.jpg', NULL, NULL, 'Yoga Mat Premium', 1, 0, '2026-05-03 03:39:22', '2026-05-03 03:39:22'),
(24, 8, 'products/yoga-mat-premium-3.jpg', NULL, NULL, 'Yoga Mat Premium', 2, 0, '2026-05-03 03:39:22', '2026-05-03 03:39:22'),
(25, 9, 'products/smart-watch-ultra-1.jpg', NULL, NULL, 'Smart Watch Ultra', 0, 1, '2026-05-03 03:39:24', '2026-05-03 03:39:24'),
(26, 9, 'products/smart-watch-ultra-2.jpg', NULL, NULL, 'Smart Watch Ultra', 1, 0, '2026-05-03 03:39:24', '2026-05-03 03:39:24'),
(27, 9, 'products/smart-watch-ultra-3.jpg', NULL, NULL, 'Smart Watch Ultra', 2, 0, '2026-05-03 03:39:24', '2026-05-03 03:39:24'),
(28, 10, 'products/wireless-charging-pad-1.jpg', NULL, NULL, 'Wireless Charging Pad', 0, 1, '2026-05-03 03:39:24', '2026-05-03 03:39:24'),
(29, 10, 'products/wireless-charging-pad-2.jpg', NULL, NULL, 'Wireless Charging Pad', 1, 0, '2026-05-03 03:39:27', '2026-05-03 03:39:27'),
(30, 10, 'products/wireless-charging-pad-3.jpg', NULL, NULL, 'Wireless Charging Pad', 2, 0, '2026-05-03 03:39:27', '2026-05-03 03:39:27');

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

--
-- Table structure for table `product_variants`
--

CREATE TABLE `product_variants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'Variant name e.g. Size, Color',
  `value` varchar(255) NOT NULL COMMENT 'Variant value e.g. Large, Red',
  `sku` varchar(255) DEFAULT NULL,
  `price` decimal(15,2) DEFAULT NULL COMMENT 'Price override for this variant',
  `stock_quantity` int(11) NOT NULL DEFAULT 0,
  `stock_status` enum('in_stock','out_of_stock','on_backorder') NOT NULL DEFAULT 'in_stock',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `promoter_wallets`
--

CREATE TABLE `promoter_wallets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `balance` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_earned` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_withdrawn` decimal(10,2) NOT NULL DEFAULT 0.00,
  `pending_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `promoter_withdrawals`
--

CREATE TABLE `promoter_withdrawals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `payment_method` varchar(255) NOT NULL,
  `payment_details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`payment_details`)),
  `notes` text DEFAULT NULL,
  `processed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `processed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `referral_commissions`
--

CREATE TABLE `referral_commissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `referrable_type` varchar(255) NOT NULL,
  `referrable_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `order_total` decimal(15,2) NOT NULL,
  `commission_rate` decimal(5,2) NOT NULL DEFAULT 5.00,
  `commission_amount` decimal(15,2) NOT NULL,
  `status` enum('pending','credited','reversed') NOT NULL DEFAULT 'pending',
  `credited_at` timestamp NULL DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `refunds`
--

CREATE TABLE `refunds` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `order_item_id` bigint(20) UNSIGNED DEFAULT NULL,
  `processed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `reason` varchar(255) NOT NULL,
  `notes` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `gateway_refund_id` varchar(255) DEFAULT NULL,
  `gateway_response` varchar(255) DEFAULT NULL,
  `processed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `refund_settings`
--

CREATE TABLE `refund_settings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `auto_approve_under` tinyint(1) NOT NULL DEFAULT 0,
  `auto_approve_amount` decimal(10,2) DEFAULT NULL,
  `require_order_complete` tinyint(1) NOT NULL DEFAULT 0,
  `refund_window_days` int(11) NOT NULL DEFAULT 30,
  `refund_request_time` int(11) NOT NULL DEFAULT 30,
  `refund_policy_agreement` varchar(255) DEFAULT NULL,
  `refund_sticker` varchar(255) DEFAULT NULL,
  `refund_protection_title` varchar(255) DEFAULT NULL,
  `refund_protection_sub_title` varchar(255) DEFAULT NULL,
  `terms_and_conditions` text DEFAULT NULL,
  `allow_partial_refunds` tinyint(1) NOT NULL DEFAULT 1,
  `refund_with_shipping_cost` tinyint(1) NOT NULL DEFAULT 0,
  `default_reason_required` varchar(255) NOT NULL DEFAULT 'product_quality',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `refund_settings`
--

INSERT INTO `refund_settings` (`id`, `auto_approve_under`, `auto_approve_amount`, `require_order_complete`, `refund_window_days`, `refund_request_time`, `refund_policy_agreement`, `refund_sticker`, `refund_protection_title`, `refund_protection_sub_title`, `terms_and_conditions`, `allow_partial_refunds`, `refund_with_shipping_cost`, `default_reason_required`, `created_at`, `updated_at`) VALUES
(1, 0, NULL, 0, 30, 30, NULL, NULL, NULL, NULL, NULL, 1, 0, 'product_quality', NULL, NULL);

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

--
-- Table structure for table `reviews`
--

CREATE TABLE `reviews` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `rating` tinyint(4) NOT NULL COMMENT '1-5 star rating',
  `title` varchar(255) DEFAULT NULL,
  `comment` text DEFAULT NULL,
  `is_approved` tinyint(1) NOT NULL DEFAULT 0,
  `is_verified_purchase` tinyint(1) NOT NULL DEFAULT 0,
  `helpful_count` int(11) NOT NULL DEFAULT 0,
  `images` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`images`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(2, 'vendor', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(3, 'customer', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16'),
(4, 'promoter', 'web', '2026-05-03 03:16:16', '2026-05-03 03:16:16');

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

--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_has_permissions`
--

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(15, 1),
(15, 2),
(16, 1),
(16, 2),
(17, 1),
(17, 2),
(18, 1),
(18, 2),
(19, 1),
(19, 2),
(20, 1),
(20, 3),
(21, 1),
(21, 3),
(22, 1),
(22, 3),
(23, 1),
(23, 3),
(24, 1),
(24, 4),
(25, 1),
(25, 4),
(26, 1),
(26, 4);

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

--
-- Table structure for table `sessions`
--

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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('dS1zOlDloQKaD0nQZS7pFfCcPMS5ZOSwvEImEpYD', 1, '127.0.0.1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', 'eyJfdG9rZW4iOiJvNE03Y3pSbU43VExTeldrTkdFaDhSOFZITU9MRFB3MHB5eTdBZzBoIiwiX2ZsYXNoIjp7Im9sZCI6W10sIm5ldyI6W119LCJjdXJyZW50X2N1cnJlbmN5Ijp7ImlkIjoyLCJjb2RlIjoiR0hTIiwibmFtZSI6IkdoYW5hIENlZGkiLCJzeW1ib2wiOiJHSFx1MjBiNSIsImV4Y2hhbmdlX3JhdGUiOiIxNS41MDAwMDAiLCJmbGFnIjoiXHVkODNjXHVkZGVjXHVkODNjXHVkZGVkIiwiaXNfYWN0aXZlIjp0cnVlLCJpc19kZWZhdWx0IjpmYWxzZSwiY3JlYXRlZF9hdCI6IjIwMjYtMDUtMDNUMDM6MjM6MjEuMDAwMDAwWiIsInVwZGF0ZWRfYXQiOiIyMDI2LTA1LTA2VDIxOjU2OjQ4LjAwMDAwMFoifSwiY3VycmVudF9sYW5ndWFnZSI6eyJpZCI6MSwiY29kZSI6ImVuIiwibmFtZSI6IkVuZ2xpc2giLCJuYXRpdmVfbmFtZSI6IkVuZ2xpc2giLCJmbGFnIjoiXHVkODNjXHVkZGVjXHVkODNjXHVkZGU3IiwiZGlyZWN0aW9uIjoibHRyIiwiaXNfYWN0aXZlIjp0cnVlLCJpc19kZWZhdWx0Ijp0cnVlLCJjcmVhdGVkX2F0IjoiMjAyNi0wNS0wM1QwMzoyMzo0Mi4wMDAwMDBaIiwidXBkYXRlZF9hdCI6IjIwMjYtMDUtMDNUMDM6MjM6NDIuMDAwMDAwWiJ9LCJfcHJldmlvdXMiOnsidXJsIjoiaHR0cDpcL1wvMTI3LjAuMC4xOjgwMDBcL2FkbWluXC9ub3RpZmljYXRpb25zIiwicm91dGUiOiJhZG1pbi5ub3RpZmljYXRpb25zLmluZGV4In0sImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjoxfQ==', 1778163231);

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

--
-- Table structure for table `subscribers`
--

CREATE TABLE `subscribers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `email` varchar(255) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'active',
  `source` varchar(255) NOT NULL DEFAULT 'website',
  `subscribed_at` timestamp NULL DEFAULT NULL,
  `unsubscribed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `vendors`
--

CREATE TABLE `vendors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `slug` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `banner` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `state` varchar(255) DEFAULT NULL,
  `country` varchar(255) DEFAULT NULL,
  `postal_code` varchar(255) DEFAULT NULL,
  `commission_rate` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Platform commission percentage',
  `status` enum('pending','approved','rejected','suspended') NOT NULL DEFAULT 'pending',
  `total_sales` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_earnings` decimal(15,2) NOT NULL DEFAULT 0.00,
  `business_info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`business_info`)),
  `social_links` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`social_links`)),
  `approved_at` timestamp NULL DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vendors`
--

INSERT INTO `vendors` (`id`, `user_id`, `slug`, `name`, `logo`, `banner`, `description`, `phone`, `email`, `address`, `city`, `state`, `country`, `postal_code`, `commission_rate`, `status`, `total_sales`, `balance`, `total_earnings`, `business_info`, `social_links`, `approved_at`, `approved_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 2, 'demo-store', 'Demo Store', NULL, NULL, 'Your trusted online store', '+1234567891', 'vendor@mebuy.com', '123 Vendor Street', 'Accra', NULL, 'GH', NULL, 0.00, 'approved', 0.00, 0.00, 0.00, NULL, NULL, '2026-05-03 03:29:58', NULL, '2026-05-03 03:29:58', '2026-05-03 03:29:58', NULL),
(2, 5, 'techhub-electronics', 'TechHub Electronics', NULL, NULL, 'Premium TechHub Electronics - quality products and excellent service.', NULL, 'techhub@example.com', NULL, NULL, NULL, NULL, NULL, 0.00, 'approved', 12081.00, 0.00, 0.00, NULL, NULL, '2026-04-17 12:39:53', NULL, '2026-05-03 12:39:53', '2026-05-03 12:39:53', NULL),
(3, 6, 'buildpro-supplies', 'BuildPro Supplies', NULL, NULL, 'Premium BuildPro Supplies - quality products and excellent service.', NULL, 'buildpro@example.com', NULL, NULL, NULL, NULL, NULL, 0.00, 'approved', 8554.00, 0.00, 0.00, NULL, NULL, '2026-03-04 12:39:54', NULL, '2026-05-03 12:39:54', '2026-05-03 12:39:54', NULL),
(4, 7, 'stylenest-fashion', 'StyleNest Fashion', NULL, NULL, 'Premium StyleNest Fashion - quality products and excellent service.', NULL, 'stylenest@example.com', NULL, NULL, NULL, NULL, NULL, 0.00, 'approved', 12806.00, 0.00, 0.00, NULL, NULL, '2026-03-16 12:39:54', NULL, '2026-05-03 12:39:54', '2026-05-03 12:39:54', NULL),
(5, 8, 'homeessentials-co', 'HomeEssentials Co', NULL, NULL, 'Premium HomeEssentials Co - quality products and excellent service.', NULL, 'homeessentials@example.com', NULL, NULL, NULL, NULL, NULL, 0.00, 'approved', 4387.00, 0.00, 0.00, NULL, NULL, '2026-01-15 12:39:54', NULL, '2026-05-03 12:39:54', '2026-05-03 12:39:54', NULL);

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

--
-- Table structure for table `vendor_packages`
--

CREATE TABLE `vendor_packages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `duration_days` int(11) NOT NULL DEFAULT 30 COMMENT 'Package duration in days',
  `product_limit` int(11) NOT NULL DEFAULT 0 COMMENT '0 = unlimited',
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `features` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`features`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vendor_packages`
--

INSERT INTO `vendor_packages` (`id`, `name`, `image`, `description`, `price`, `duration_days`, `product_limit`, `is_featured`, `is_active`, `features`, `created_at`, `updated_at`) VALUES
(1, 'Starter', NULL, 'Perfect for new vendors just getting started', 9.99, 30, 10, 0, 1, '[\"Up to 10 products\",\"Basic analytics\",\"Email support\",\"Standard commission rate\"]', '2026-05-03 03:31:11', '2026-05-03 03:31:11'),
(2, 'Professional', NULL, 'Ideal for growing businesses', 29.99, 30, 50, 1, 1, '[\"Up to 50 products\",\"Advanced analytics\",\"Priority support\",\"Reduced commission rate\",\"Featured product placement\",\"Custom storefront\"]', '2026-05-03 03:31:11', '2026-05-03 03:31:11'),
(3, 'Enterprise', NULL, 'For established vendors with large inventories', 99.99, 30, 500, 1, 1, '[\"Up to 500 products\",\"Full analytics suite\",\"Dedicated account manager\",\"Lowest commission rate\",\"Premium product placement\",\"Custom storefront\",\"API access\",\"Bulk import\\/export\"]', '2026-05-03 03:31:11', '2026-05-03 03:31:11'),
(4, 'Annual Pro', NULL, 'Save with annual billing - Professional features', 299.99, 365, 100, 0, 1, '[\"Up to 100 products\",\"Advanced analytics\",\"Priority support\",\"Reduced commission rate\",\"Featured product placement\",\"Custom storefront\",\"Save 17% vs monthly\"]', '2026-05-03 03:31:11', '2026-05-03 03:31:11');

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

--
-- Table structure for table `vendor_package_purchases`
--

CREATE TABLE `vendor_package_purchases` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `package_id` bigint(20) UNSIGNED NOT NULL,
  `transaction_id` varchar(255) DEFAULT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `payment_gateway` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending' COMMENT 'pending, completed, failed, expired, refunded',
  `starts_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `payment_type` varchar(255) NOT NULL DEFAULT 'online' COMMENT 'online, offline, wallet',
  `notes` text DEFAULT NULL,
  `gateway_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`gateway_response`)),
  `paid_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `vendor_withdrawals`
--

CREATE TABLE `vendor_withdrawals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `status` enum('pending','approved','rejected','completed') NOT NULL DEFAULT 'pending',
  `payment_method` varchar(255) NOT NULL COMMENT 'bank_transfer, paypal, etc',
  `payment_details` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT 'Bank account or payment info' CHECK (json_valid(`payment_details`)),
  `notes` text DEFAULT NULL,
  `processed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `processed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `wallets`
--

CREATE TABLE `wallets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_earned` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_withdrawn` decimal(15,2) NOT NULL DEFAULT 0.00,
  `pending_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `wallets`
--

INSERT INTO `wallets` (`id`, `vendor_id`, `balance`, `total_earned`, `total_withdrawn`, `pending_amount`, `created_at`, `updated_at`) VALUES
(1, 1, 0.00, 0.00, 0.00, 0.00, '2026-05-03 19:04:13', '2026-05-03 19:04:13');

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

--
-- Table structure for table `wholesale_products`
--

CREATE TABLE `wholesale_products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `sku` varchar(255) DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `unit` varchar(255) DEFAULT NULL,
  `min_order_quantity` int(11) NOT NULL DEFAULT 1,
  `price` decimal(15,2) NOT NULL,
  `thumbnail` varchar(255) DEFAULT NULL,
  `gallery` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`gallery`)),
  `video_provider` varchar(255) DEFAULT NULL,
  `video_url` varchar(255) DEFAULT NULL,
  `wholesale_prices` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`wholesale_prices`)),
  `current_stock` int(11) NOT NULL DEFAULT 0,
  `low_stock_threshold` int(11) NOT NULL DEFAULT 5,
  `stock_visibility` varchar(255) NOT NULL DEFAULT 'hide_stock',
  `short_description` text DEFAULT NULL,
  `description` longtext DEFAULT NULL,
  `pdf_specification` varchar(255) DEFAULT NULL,
  `cash_on_delivery` tinyint(1) NOT NULL DEFAULT 0,
  `shipping_days` int(11) DEFAULT NULL,
  `is_refundable` tinyint(1) NOT NULL DEFAULT 0,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `todays_deal` tinyint(1) NOT NULL DEFAULT 0,
  `status` varchar(255) NOT NULL DEFAULT 'unpublished',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_description` text DEFAULT NULL,
  `meta_keywords` varchar(255) DEFAULT NULL,
  `meta_image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `wishlists`
--

CREATE TABLE `wishlists` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `addresses`
--
ALTER TABLE `addresses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `addresses_user_id_index` (`user_id`);

--
-- Indexes for table `attendances`
--
ALTER TABLE `attendances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `attendances_employee_id_index` (`employee_id`),
  ADD KEY `attendances_date_index` (`date`);

--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `brands_slug_unique` (`slug`);

--
-- Indexes for table `bulk_sms`
--
ALTER TABLE `bulk_sms`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `campaigns`
--
ALTER TABLE `campaigns`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `campaign_requests`
--
ALTER TABLE `campaign_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `campaign_requests_vendor_id_foreign` (`vendor_id`),
  ADD KEY `campaign_requests_campaign_id_foreign` (`campaign_id`),
  ADD KEY `campaign_requests_approved_by_foreign` (`approved_by`),
  ADD KEY `campaign_requests_product_id_foreign` (`product_id`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `categories_slug_unique` (`slug`),
  ADD KEY `categories_slug_index` (`slug`),
  ADD KEY `categories_parent_id_index` (`parent_id`),
  ADD KEY `categories_is_active_index` (`is_active`);

--
-- Indexes for table `chats`
--
ALTER TABLE `chats`
  ADD PRIMARY KEY (`id`),
  ADD KEY `chats_vendor_id_foreign` (`vendor_id`),
  ADD KEY `chats_product_id_foreign` (`product_id`),
  ADD KEY `chats_promoter_id_index` (`promoter_id`),
  ADD KEY `chats_customer_id_index` (`customer_id`),
  ADD KEY `chats_admin_id_foreign` (`admin_id`);

--
-- Indexes for table `collections`
--
ALTER TABLE `collections`
  ADD PRIMARY KEY (`id`),
  ADD KEY `collections_delivery_man_id_foreign` (`delivery_man_id`),
  ADD KEY `collections_order_id_foreign` (`order_id`);

--
-- Indexes for table `colors`
--
ALTER TABLE `colors`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `commissions`
--
ALTER TABLE `commissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `commissions_delivery_man_id_foreign` (`delivery_man_id`),
  ADD KEY `commissions_order_id_foreign` (`order_id`);

--
-- Indexes for table `coupons`
--
ALTER TABLE `coupons`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `coupons_code_unique` (`code`),
  ADD KEY `coupons_code_index` (`code`),
  ADD KEY `coupons_is_active_index` (`is_active`);

--
-- Indexes for table `currencies`
--
ALTER TABLE `currencies`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `currencies_code_unique` (`code`);

--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `departments_head_id_foreign` (`head_id`);

--
-- Indexes for table `deposits`
--
ALTER TABLE `deposits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `deposits_delivery_man_id_foreign` (`delivery_man_id`);

--
-- Indexes for table `designations`
--
ALTER TABLE `designations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `designations_department_id_foreign` (`department_id`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `employees_employee_code_unique` (`employee_code`),
  ADD UNIQUE KEY `employees_email_unique` (`email`),
  ADD UNIQUE KEY `employees_referral_code_unique` (`referral_code`),
  ADD KEY `employees_user_id_foreign` (`user_id`),
  ADD KEY `employees_supervisor_id_foreign` (`supervisor_id`),
  ADD KEY `employees_employee_code_index` (`employee_code`),
  ADD KEY `employees_email_index` (`email`),
  ADD KEY `employees_department_id_index` (`department_id`),
  ADD KEY `employees_designation_id_index` (`designation_id`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `holidays`
--
ALTER TABLE `holidays`
  ADD PRIMARY KEY (`id`),
  ADD KEY `holidays_date_index` (`date`);

--
-- Indexes for table `hrm_jobs`
--
ALTER TABLE `hrm_jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `hrm_jobs_designation_id_foreign` (`designation_id`),
  ADD KEY `hrm_jobs_department_id_index` (`department_id`),
  ADD KEY `hrm_jobs_status_index` (`status`);

--
-- Indexes for table `hrm_job_applications`
--
ALTER TABLE `hrm_job_applications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `hrm_job_applications_job_id_index` (`job_id`),
  ADD KEY `hrm_job_applications_status_index` (`status`);

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indexes for table `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `languages`
--
ALTER TABLE `languages`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `languages_code_unique` (`code`);

--
-- Indexes for table `leaves`
--
ALTER TABLE `leaves`
  ADD PRIMARY KEY (`id`),
  ADD KEY `leaves_approved_by_foreign` (`approved_by`),
  ADD KEY `leaves_employee_id_index` (`employee_id`),
  ADD KEY `leaves_status_index` (`status`);

--
-- Indexes for table `leave_balances`
--
ALTER TABLE `leave_balances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `leave_balances_employee_id_index` (`employee_id`),
  ADD KEY `leave_balances_year_index` (`year`);

--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `messages_chat_id_index` (`chat_id`),
  ADD KEY `messages_sender_id_index` (`sender_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`),
  ADD KEY `notifications_notifiable_id_index` (`notifiable_id`),
  ADD KEY `notifications_notifiable_type_index` (`notifiable_type`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `orders_order_number_unique` (`order_number`),
  ADD KEY `orders_cancelled_by_foreign` (`cancelled_by`),
  ADD KEY `orders_order_number_index` (`order_number`),
  ADD KEY `orders_customer_id_index` (`customer_id`),
  ADD KEY `orders_status_index` (`status`),
  ADD KEY `orders_payment_status_index` (`payment_status`),
  ADD KEY `orders_promoter_id_foreign` (`promoter_id`),
  ADD KEY `orders_coupon_id_foreign` (`coupon_id`),
  ADD KEY `orders_pickup_hub_id_foreign` (`pickup_hub_id`);

--
-- Indexes for table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_items_variant_id_foreign` (`variant_id`),
  ADD KEY `order_items_order_id_index` (`order_id`),
  ADD KEY `order_items_vendor_id_index` (`vendor_id`),
  ADD KEY `order_items_product_id_index` (`product_id`);

--
-- Indexes for table `order_shipments`
--
ALTER TABLE `order_shipments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_shipments_order_id_foreign` (`order_id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payments_customer_id_foreign` (`customer_id`),
  ADD KEY `payments_order_id_index` (`order_id`),
  ADD KEY `payments_transaction_id_index` (`transaction_id`),
  ADD KEY `payments_status_index` (`status`);

--
-- Indexes for table `payrolls`
--
ALTER TABLE `payrolls`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payrolls_employee_id_index` (`employee_id`),
  ADD KEY `payrolls_payroll_period_index` (`payroll_period`),
  ADD KEY `payrolls_status_index` (`status`);

--
-- Indexes for table `performance_reviews`
--
ALTER TABLE `performance_reviews`
  ADD PRIMARY KEY (`id`),
  ADD KEY `performance_reviews_employee_id_index` (`employee_id`),
  ADD KEY `performance_reviews_reviewer_id_index` (`reviewer_id`),
  ADD KEY `performance_reviews_status_index` (`status`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indexes for table `pickup_hubs`
--
ALTER TABLE `pickup_hubs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `pickup_hubs_slug_unique` (`slug`),
  ADD UNIQUE KEY `pickup_hubs_code_unique` (`code`),
  ADD KEY `pickup_hubs_manager_id_foreign` (`manager_id`),
  ADD KEY `pickup_hubs_slug_index` (`slug`),
  ADD KEY `pickup_hubs_status_index` (`status`),
  ADD KEY `pickup_hubs_city_index` (`city`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `products_slug_unique` (`slug`),
  ADD UNIQUE KEY `products_sku_unique` (`sku`),
  ADD KEY `products_slug_index` (`slug`),
  ADD KEY `products_vendor_id_index` (`vendor_id`),
  ADD KEY `products_category_id_index` (`category_id`),
  ADD KEY `products_status_index` (`status`),
  ADD KEY `products_is_featured_index` (`is_featured`),
  ADD KEY `products_sku_index` (`sku`);

--
-- Indexes for table `product_attributes`
--
ALTER TABLE `product_attributes`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `product_attribute_values`
--
ALTER TABLE `product_attribute_values`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_attribute_values_attribute_id_foreign` (`attribute_id`),
  ADD KEY `product_attribute_values_category_id_foreign` (`category_id`);

--
-- Indexes for table `product_images`
--
ALTER TABLE `product_images`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_images_product_id_index` (`product_id`);

--
-- Indexes for table `product_variants`
--
ALTER TABLE `product_variants`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_variants_product_id_index` (`product_id`);

--
-- Indexes for table `promoter_wallets`
--
ALTER TABLE `promoter_wallets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `promoter_wallets_user_id_unique` (`user_id`);

--
-- Indexes for table `promoter_withdrawals`
--
ALTER TABLE `promoter_withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promoter_withdrawals_user_id_foreign` (`user_id`),
  ADD KEY `promoter_withdrawals_processed_by_foreign` (`processed_by`);

--
-- Indexes for table `referral_commissions`
--
ALTER TABLE `referral_commissions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `referral_commissions_referrable_type_referrable_id_index` (`referrable_type`,`referrable_id`),
  ADD KEY `referral_commissions_order_id_foreign` (`order_id`),
  ADD KEY `referral_commissions_customer_id_foreign` (`customer_id`),
  ADD KEY `referral_commissions_referrable_type_index` (`referrable_type`),
  ADD KEY `referral_commissions_referrable_id_index` (`referrable_id`),
  ADD KEY `referral_commissions_status_index` (`status`);

--
-- Indexes for table `refunds`
--
ALTER TABLE `refunds`
  ADD PRIMARY KEY (`id`),
  ADD KEY `refunds_order_item_id_foreign` (`order_item_id`),
  ADD KEY `refunds_processed_by_foreign` (`processed_by`),
  ADD KEY `refunds_status_index` (`status`),
  ADD KEY `refunds_customer_id_index` (`customer_id`),
  ADD KEY `refunds_order_id_index` (`order_id`);

--
-- Indexes for table `refund_settings`
--
ALTER TABLE `refund_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `reviews`
--
ALTER TABLE `reviews`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `reviews_customer_id_product_id_order_id_unique` (`customer_id`,`product_id`,`order_id`),
  ADD KEY `reviews_order_id_foreign` (`order_id`),
  ADD KEY `reviews_product_id_index` (`product_id`),
  ADD KEY `reviews_vendor_id_index` (`vendor_id`),
  ADD KEY `reviews_customer_id_index` (`customer_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indexes for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `subscribers`
--
ALTER TABLE `subscribers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `subscribers_email_unique` (`email`);

--
-- Indexes for table `vendors`
--
ALTER TABLE `vendors`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendors_slug_unique` (`slug`),
  ADD KEY `vendors_user_id_foreign` (`user_id`),
  ADD KEY `vendors_approved_by_foreign` (`approved_by`),
  ADD KEY `vendors_slug_index` (`slug`),
  ADD KEY `vendors_status_index` (`status`);

--
-- Indexes for table `vendor_packages`
--
ALTER TABLE `vendor_packages`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `vendor_package_purchases`
--
ALTER TABLE `vendor_package_purchases`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendor_package_purchases_transaction_id_unique` (`transaction_id`),
  ADD KEY `vendor_package_purchases_vendor_id_foreign` (`vendor_id`),
  ADD KEY `vendor_package_purchases_package_id_foreign` (`package_id`);

--
-- Indexes for table `vendor_withdrawals`
--
ALTER TABLE `vendor_withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendor_withdrawals_processed_by_foreign` (`processed_by`),
  ADD KEY `vendor_withdrawals_vendor_id_index` (`vendor_id`),
  ADD KEY `vendor_withdrawals_status_index` (`status`);

--
-- Indexes for table `wallets`
--
ALTER TABLE `wallets`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `wallets_vendor_id_unique` (`vendor_id`);

--
-- Indexes for table `wholesale_products`
--
ALTER TABLE `wholesale_products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `wholesale_products_slug_unique` (`slug`);

--
-- Indexes for table `wishlists`
--
ALTER TABLE `wishlists`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `wishlists_user_id_product_id_unique` (`user_id`,`product_id`),
  ADD KEY `wishlists_product_id_foreign` (`product_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `addresses`
--
ALTER TABLE `addresses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `attendances`
--
ALTER TABLE `attendances`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `bulk_sms`
--
ALTER TABLE `bulk_sms`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `campaigns`
--
ALTER TABLE `campaigns`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `campaign_requests`
--
ALTER TABLE `campaign_requests`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT for table `chats`
--
ALTER TABLE `chats`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `collections`
--
ALTER TABLE `collections`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `colors`
--
ALTER TABLE `colors`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `commissions`
--
ALTER TABLE `commissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `coupons`
--
ALTER TABLE `coupons`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `currencies`
--
ALTER TABLE `currencies`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `deposits`
--
ALTER TABLE `deposits`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `designations`
--
ALTER TABLE `designations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `employees`
--
ALTER TABLE `employees`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `holidays`
--
ALTER TABLE `holidays`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hrm_jobs`
--
ALTER TABLE `hrm_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `hrm_job_applications`
--
ALTER TABLE `hrm_job_applications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `languages`
--
ALTER TABLE `languages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `leaves`
--
ALTER TABLE `leaves`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `leave_balances`
--
ALTER TABLE `leave_balances`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101;

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `order_items`
--
ALTER TABLE `order_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `order_shipments`
--
ALTER TABLE `order_shipments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `payrolls`
--
ALTER TABLE `payrolls`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `performance_reviews`
--
ALTER TABLE `performance_reviews`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT for table `pickup_hubs`
--
ALTER TABLE `pickup_hubs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `product_attributes`
--
ALTER TABLE `product_attributes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_attribute_values`
--
ALTER TABLE `product_attribute_values`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `product_images`
--
ALTER TABLE `product_images`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `product_variants`
--
ALTER TABLE `product_variants`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promoter_wallets`
--
ALTER TABLE `promoter_wallets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promoter_withdrawals`
--
ALTER TABLE `promoter_withdrawals`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `referral_commissions`
--
ALTER TABLE `referral_commissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `refunds`
--
ALTER TABLE `refunds`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `refund_settings`
--
ALTER TABLE `refund_settings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `reviews`
--
ALTER TABLE `reviews`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `subscribers`
--
ALTER TABLE `subscribers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vendors`
--
ALTER TABLE `vendors`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `vendor_packages`
--
ALTER TABLE `vendor_packages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `vendor_package_purchases`
--
ALTER TABLE `vendor_package_purchases`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vendor_withdrawals`
--
ALTER TABLE `vendor_withdrawals`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `wallets`
--
ALTER TABLE `wallets`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `wholesale_products`
--
ALTER TABLE `wholesale_products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `wishlists`
--
ALTER TABLE `wishlists`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `addresses`
--
ALTER TABLE `addresses`
  ADD CONSTRAINT `addresses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `attendances`
--
ALTER TABLE `attendances`
  ADD CONSTRAINT `attendances_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `campaign_requests`
--
ALTER TABLE `campaign_requests`
  ADD CONSTRAINT `campaign_requests_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `campaign_requests_campaign_id_foreign` FOREIGN KEY (`campaign_id`) REFERENCES `campaigns` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `campaign_requests_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `campaign_requests_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `chats`
--
ALTER TABLE `chats`
  ADD CONSTRAINT `chats_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chats_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chats_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `chats_promoter_id_foreign` FOREIGN KEY (`promoter_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `chats_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `collections`
--
ALTER TABLE `collections`
  ADD CONSTRAINT `collections_delivery_man_id_foreign` FOREIGN KEY (`delivery_man_id`) REFERENCES `delivery_men` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `collections_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `commissions`
--
ALTER TABLE `commissions`
  ADD CONSTRAINT `commissions_delivery_man_id_foreign` FOREIGN KEY (`delivery_man_id`) REFERENCES `delivery_men` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `commissions_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `departments`
--
ALTER TABLE `departments`
  ADD CONSTRAINT `departments_head_id_foreign` FOREIGN KEY (`head_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `deposits`
--
ALTER TABLE `deposits`
  ADD CONSTRAINT `deposits_delivery_man_id_foreign` FOREIGN KEY (`delivery_man_id`) REFERENCES `delivery_men` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `designations`
--
ALTER TABLE `designations`
  ADD CONSTRAINT `designations_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employees`
--
ALTER TABLE `employees`
  ADD CONSTRAINT `employees_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `employees_designation_id_foreign` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `employees_supervisor_id_foreign` FOREIGN KEY (`supervisor_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `employees_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `hrm_jobs`
--
ALTER TABLE `hrm_jobs`
  ADD CONSTRAINT `hrm_jobs_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `hrm_jobs_designation_id_foreign` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `hrm_job_applications`
--
ALTER TABLE `hrm_job_applications`
  ADD CONSTRAINT `hrm_job_applications_job_id_foreign` FOREIGN KEY (`job_id`) REFERENCES `hrm_jobs` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `leaves`
--
ALTER TABLE `leaves`
  ADD CONSTRAINT `leaves_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `leaves_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `leave_balances`
--
ALTER TABLE `leave_balances`
  ADD CONSTRAINT `leave_balances_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
  ADD CONSTRAINT `messages_chat_id_foreign` FOREIGN KEY (`chat_id`) REFERENCES `chats` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `messages_sender_id_foreign` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `orders_cancelled_by_foreign` FOREIGN KEY (`cancelled_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `orders_coupon_id_foreign` FOREIGN KEY (`coupon_id`) REFERENCES `coupons` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `orders_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `orders_pickup_hub_id_foreign` FOREIGN KEY (`pickup_hub_id`) REFERENCES `pickup_hubs` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `orders_promoter_id_foreign` FOREIGN KEY (`promoter_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `order_items`
--
ALTER TABLE `order_items`
  ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `order_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `order_items_variant_id_foreign` FOREIGN KEY (`variant_id`) REFERENCES `product_variants` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `order_items_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `order_shipments`
--
ALTER TABLE `order_shipments`
  ADD CONSTRAINT `order_shipments_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payments_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payrolls`
--
ALTER TABLE `payrolls`
  ADD CONSTRAINT `payrolls_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `performance_reviews`
--
ALTER TABLE `performance_reviews`
  ADD CONSTRAINT `performance_reviews_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `performance_reviews_reviewer_id_foreign` FOREIGN KEY (`reviewer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `pickup_hubs`
--
ALTER TABLE `pickup_hubs`
  ADD CONSTRAINT `pickup_hubs_manager_id_foreign` FOREIGN KEY (`manager_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`),
  ADD CONSTRAINT `products_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `product_attribute_values`
--
ALTER TABLE `product_attribute_values`
  ADD CONSTRAINT `product_attribute_values_attribute_id_foreign` FOREIGN KEY (`attribute_id`) REFERENCES `product_attributes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_attribute_values_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `product_images`
--
ALTER TABLE `product_images`
  ADD CONSTRAINT `product_images_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `product_variants`
--
ALTER TABLE `product_variants`
  ADD CONSTRAINT `product_variants_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `promoter_wallets`
--
ALTER TABLE `promoter_wallets`
  ADD CONSTRAINT `promoter_wallets_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `promoter_withdrawals`
--
ALTER TABLE `promoter_withdrawals`
  ADD CONSTRAINT `promoter_withdrawals_processed_by_foreign` FOREIGN KEY (`processed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `promoter_withdrawals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `referral_commissions`
--
ALTER TABLE `referral_commissions`
  ADD CONSTRAINT `referral_commissions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `referral_commissions_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `refunds`
--
ALTER TABLE `refunds`
  ADD CONSTRAINT `refunds_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `refunds_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `refunds_order_item_id_foreign` FOREIGN KEY (`order_item_id`) REFERENCES `order_items` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `refunds_processed_by_foreign` FOREIGN KEY (`processed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `reviews`
--
ALTER TABLE `reviews`
  ADD CONSTRAINT `reviews_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reviews_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `reviews_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reviews_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendors`
--
ALTER TABLE `vendors`
  ADD CONSTRAINT `vendors_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `vendors_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendor_package_purchases`
--
ALTER TABLE `vendor_package_purchases`
  ADD CONSTRAINT `vendor_package_purchases_package_id_foreign` FOREIGN KEY (`package_id`) REFERENCES `vendor_packages` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `vendor_package_purchases_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendor_withdrawals`
--
ALTER TABLE `vendor_withdrawals`
  ADD CONSTRAINT `vendor_withdrawals_processed_by_foreign` FOREIGN KEY (`processed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `vendor_withdrawals_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `wallets`
--
ALTER TABLE `wallets`
  ADD CONSTRAINT `wallets_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `wishlists`
--
ALTER TABLE `wishlists`
  ADD CONSTRAINT `wishlists_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `wishlists_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

