-- Users Table
CREATE TABLE `users` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `status` int DEFAULT NULL,
  `mobile` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `email` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `password` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `country_code` varchar(5) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `roleId` int DEFAULT NULL COMMENT '1 for Mobile\r\n2 for Web\r\n3 for Admin',
  `planid` int DEFAULT NULL COMMENT 'which plan is selected by user',
  `plan_duration` int DEFAULT NULL,
  `mId` int DEFAULT NULL,
  `sId` int DEFAULT NULL,
  `wId` int DEFAULT NULL,
  `compId` int DEFAULT NULL,
  `token` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `refcode` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `verify` int DEFAULT '0',
  `date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `trn_date` datetime DEFAULT NULL,
  `ofon` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `secure` int DEFAULT '0',
  `googlecode` varchar(200) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `country_symble` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `headkey` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `bodykey` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `contentKey` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `UserName` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `usr_status` int DEFAULT '0' COMMENT 'user block 1 \r\n0 for not block',
  `optn1` varchar(8) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'for otp',
  `optn2` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `mobile` (`mobile`),
  UNIQUE KEY `UserName` (`UserName`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Category Table
CREATE TABLE `categories` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the category',
  `name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Category name',
  `slug` varchar(150) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL-friendly unique name for category',
  `parent_id` bigint DEFAULT NULL COMMENT 'Parent category ID (for subcategories)',
  `status` tinyint DEFAULT '1' COMMENT '1 = Active, 0 = Inactive',
  `opt1` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  KEY `parent_id` (`parent_id`),
  CONSTRAINT `categories_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Products Table
CREATE TABLE `products` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the product',
  `name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Product name',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Detailed product description',
  `slug` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL-friendly unique name for product',
  `category_id` bigint DEFAULT NULL COMMENT 'Category ID the product belongs to',
  `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'Original product price',
  `discount_price` decimal(10,2) DEFAULT '0.00' COMMENT 'Discounted price (if applicable)',
  `stock_quantity` int DEFAULT '0' COMMENT 'Available stock quantity',
  `sku` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Unique stock keeping unit identifier',
  `status` tinyint DEFAULT '1' COMMENT '1 = Active, 0 = Inactive',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When product was created',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last update timestamp',
  `purity` int DEFAULT NULL COMMENT 'For Product Purity',
  `gender` int DEFAULT NULL COMMENT 'kids - 0\r\nmen - 1\r\nunisex - 2\r\nwomen - 3',
  `size` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Product size (e.g., S, M, L, XL or custom like 18mm, 20mm)',
  `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  UNIQUE KEY `sku` (`sku`),
  KEY `category_id` (`category_id`),
  CONSTRAINT `products_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Addresses Table
CREATE TABLE `addresses` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique address ID',
  `user_id` bigint NOT NULL COMMENT 'ID of the user who owns the address',
  `full_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Recipient full name',
  `mobile` varchar(20) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Recipient contact number',
  `address_line1` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Primary street address',
  `address_line2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Additional address details (optional)',
  `city` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'City name',
  `state` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'State or province name',
  `country` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Country name',
  `pincode` varchar(10) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Postal code',
  `is_default` tinyint DEFAULT '0' COMMENT '1 = Default address for user',
  `opt1` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `addresses_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Banners Table
CREATE TABLE `banners` (
  `banner_id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the banner',
  `banner_type` tinyint NOT NULL COMMENT 'Type of banner: 0=both, 1=mobile, 2=web',
  `position` tinyint NOT NULL COMMENT 'Position of banner on UI:\nFor Web View\n0 - top\n1 - middle\n2- bottom_left\n3 - bottom_right\n\nFor App View\n0 - top1\n1 - top2\n2 - top3\n3 - top4\n4 - middle1\n5 - middle2_up_left\n6 - middle2_up_right\n7 - middle2_down_left\n8 - middle2_down_right\n9 - bottom1\n10 - bottom2\n11 - bottom3',
  `status` tinyint NOT NULL DEFAULT '1' COMMENT 'Status of the banner: 1=active, 0=inactive',
  `image_url` varchar(500) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Path of the banner image',
  `redirect_url` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'URL to redirect when banner is clicked',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Record creation timestamp',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Record last update timestamp',
  `opt1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`banner_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Cart Table
  CREATE TABLE `cart` (
    `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the cart item',
    `user_id` bigint DEFAULT NULL COMMENT 'ID of the user who added the product, NULL if guest',
    `guest_token` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Unique identifier for guest users (stored in cookies)',
    `is_guest` tinyint DEFAULT '1' COMMENT 'TRUE if this cart belongs to a guest user',
    `product_id` bigint NOT NULL COMMENT 'ID of the product added to the cart',
    `quantity` int DEFAULT '1' COMMENT 'Quantity of the product in cart',
    `added_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the product was added to cart',
    `size` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Selected size of the product (S, M, L, XL, etc.)',
    `opt2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
    `opt3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
    `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
    `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
    PRIMARY KEY (`id`),
    KEY `user_id` (`user_id`),
    KEY `product_id` (`product_id`),
    KEY `idx_guest_token` (`guest_token`),
    CONSTRAINT `cart_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
    CONSTRAINT `cart_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
  ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


-- Orders Table
CREATE TABLE `orders` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique order ID',
  `user_id` bigint NOT NULL COMMENT 'ID of the user who placed the order',
  `transaction_id` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Unique transaction ID for the order',
  `total_amount` decimal(10,2) NOT NULL COMMENT 'Total order amount',
  `status` tinyint DEFAULT 0 COMMENT 'Current order status: 0-pending, 1-confirmed, 2-shipped, 3-out_for_delivery, 4-delivered, 5-cancelled, 6-returned',
  `payment_method` tinyint DEFAULT 0 COMMENT 'Payment method used: 0-cod, 1-online, 2-wallet, 3-upi, 4-card',
  `payment_status` tinyint DEFAULT 0 COMMENT 'Payment status: 0-pending, 1-paid, 2-failed, 3-refunded',
  `shipping_address_id` bigint DEFAULT NULL COMMENT 'Reference to shipping address',
  `billing_address_id` bigint DEFAULT NULL COMMENT 'Reference to billing address',
  `expected_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
  `delivered_at` timestamp NULL DEFAULT NULL COMMENT 'Actual delivery timestamp',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Order creation timestamp',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last update timestamp',
  `deleted_at` timestamp NULL DEFAULT NULL COMMENT 'Soft delete timestamp',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_status` (`status`),
  CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


-- Order Item Table
CREATE TABLE `order_items` (
  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the order item',
  `order_id` BIGINT NOT NULL COMMENT 'ID of the order this item belongs to',
  `product_id` BIGINT NOT NULL COMMENT 'ID of the purchased product',
  `product_name` VARCHAR(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Snapshot of product name',
  `product_sku` VARCHAR(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Product SKU at order time',
  `quantity` INT DEFAULT 1 COMMENT 'Quantity of the product ordered',
  `price` DECIMAL(10,2) NOT NULL COMMENT 'Price per unit at purchase time',
  `discount` DECIMAL(10,2) DEFAULT 0.00 COMMENT 'Discount per unit (if any)',
  `subtotal` DECIMAL(10,2) GENERATED ALWAYS AS (`quantity` * (`price` - `discount`)) STORED COMMENT 'Subtotal for this item',
  PRIMARY KEY (`id`),
  KEY `idx_order_id` (`order_id`),
  KEY `idx_product_id` (`product_id`),
  CONSTRAINT `order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE,
  CONSTRAINT `order_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Payments Table
CREATE TABLE `payments` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique payment ID',
  `payer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'Name of the person making the payment',
  `order_id` bigint NOT NULL COMMENT 'Order ID related to this payment',
  `transaction_id` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Unique transaction ID generated from function',
  `txn_id` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Unique transaction ID from payment gateway',
  `amount` decimal(10,2) NOT NULL COMMENT 'Amount paid',
  `payment_gateway` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Name of the payment gateway used',
  `status` tinyint DEFAULT 0 COMMENT 'Payment status: 0-pending, 1-success, 2-failed',
  `paid_at` timestamp NULL DEFAULT NULL COMMENT 'Timestamp when payment was completed',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `opt1` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  KEY `order_id` (`order_id`),
  CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- UPI Transactions Table
CREATE TABLE `upitxn` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uid` bigint unsigned DEFAULT NULL,
  `amt` decimal(18,4) DEFAULT NULL,
  `qr` text,
  `type` int DEFAULT NULL,
  `status` int DEFAULT '0',
  `jsp` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100007930370 DEFAULT CHARSET=latin1;

-- Product Images Table
CREATE TABLE `product_images` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the image record',
  `product_id` bigint NOT NULL COMMENT 'ID of the product the image belongs to',
  `image_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL/path of the product image',
  `opt1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  KEY `product_id` (`product_id`),
  CONSTRAINT `product_images_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Product Reviews Table
CREATE TABLE `product_reviews` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique review ID',
  `product_id` bigint NOT NULL COMMENT 'ID of the reviewed product',
  `user_id` bigint NOT NULL COMMENT 'ID of the user who left the review',
  `rating` tinyint NOT NULL COMMENT 'Star rating from 1 to 5',
  `comment` text COLLATE utf8mb4_general_ci COMMENT 'User review text',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the review was submitted',
  `opt1` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  KEY `product_id` (`product_id`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `product_reviews_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `product_reviews_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Wishlist Table
CREATE TABLE `wishlist` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Unique ID for the wishlist item',
  `user_id` bigint DEFAULT NULL COMMENT 'ID of the user who added the product to wishlist',
  `guest_token` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Unique identifier for guest users (stored in cookies)',
  `product_id` bigint NOT NULL COMMENT 'ID of the product in wishlist',
  `added_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the product was added to wishlist',
  `opt1` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_user_product` (`user_id`,`product_id`),
  KEY `product_id` (`product_id`),
  CONSTRAINT `wishlist_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `wishlist_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Pages Table
CREATE TABLE `pages` (
  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT 'Unique page ID',
  `slug` VARCHAR(100) NOT NULL UNIQUE COMMENT 'URL-friendly identifier (e.g. about-us, privacy-policy)',
  `title` VARCHAR(255) NOT NULL COMMENT 'Page title (About Us, Privacy Policy, etc.)',
  `content_html` LONGTEXT NOT NULL COMMENT 'HTML content of the page',
  `is_active` TINYINT DEFAULT 1 COMMENT '1 = Active, 0 = Inactive',
  `opt1` VARCHAR(255) DEFAULT NULL COMMENT 'Optional field for future use',
  `opt2` VARCHAR(255) DEFAULT NULL COMMENT 'Optional field for future use',
  `opt3` VARCHAR(255) DEFAULT NULL COMMENT 'Optional field for future use',
  `opt4` VARCHAR(255) DEFAULT NULL COMMENT 'Optional field for future use',
  `opt5` VARCHAR(255) DEFAULT NULL COMMENT 'Optional field for future use',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
