-- =====================================================
-- COMPLETE ALL TABLES FIX - CREATES EVERY MISSING TABLE
-- Run this ONCE in phpMyAdmin to fix ALL table issues
-- =====================================================

-- Disable foreign key checks temporarily

-- Create companies table
CREATE TABLE IF NOT EXISTS `companies` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `industry` varchar(100) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `country` varchar(2) DEFAULT NULL,
  `postal_code` varchar(20) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `cover_image` varchar(255) DEFAULT NULL,
  `established_year` int(11) DEFAULT NULL,
  `employee_count` varchar(50) DEFAULT NULL,
  `annual_revenue` varchar(50) DEFAULT NULL,
  `business_type` enum('manufacturer','distributor','retailer','service_provider','other') DEFAULT 'manufacturer',
  `verification_status` enum('pending','verified','rejected') DEFAULT 'pending',
  `verification_documents` json DEFAULT NULL,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `rating` decimal(3,2) DEFAULT 0.00,
  `reviews_count` int(11) DEFAULT 0,
  `products_count` int(11) DEFAULT 0,
  `followers_count` int(11) DEFAULT 0,
  `views_count` int(11) DEFAULT 0,
  `social_links` json DEFAULT NULL,
  `certifications` json DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `companies_slug_unique` (`slug`),
  KEY `companies_user_id_foreign` (`user_id`),
  KEY `companies_country_index` (`country`),
  KEY `companies_industry_index` (`industry`),
  KEY `companies_is_active_index` (`is_active`),
  KEY `companies_is_featured_index` (`is_featured`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create categories table
CREATE TABLE IF NOT EXISTS `categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `icon` varchar(255) DEFAULT NULL,
  `sort_order` int(11) DEFAULT 0,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `products_count` int(11) DEFAULT 0,
  `views_count` int(11) DEFAULT 0,
  `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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `categories_slug_unique` (`slug`),
  KEY `categories_parent_id_foreign` (`parent_id`),
  KEY `categories_is_active_index` (`is_active`),
  KEY `categories_is_featured_index` (`is_featured`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create products table
CREATE TABLE IF NOT EXISTS `products` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `company_id` bigint(20) unsigned DEFAULT NULL,
  `category_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `short_description` varchar(500) DEFAULT NULL,
  `sku` varchar(100) DEFAULT NULL,
  `price` decimal(10,2) DEFAULT NULL,
  `compare_price` decimal(10,2) DEFAULT NULL,
  `cost_price` decimal(10,2) DEFAULT NULL,
  `currency` varchar(3) DEFAULT 'USD',
  `stock_quantity` int(11) DEFAULT 0,
  `min_order_quantity` int(11) DEFAULT 1,
  `max_order_quantity` int(11) DEFAULT NULL,
  `weight` decimal(8,2) DEFAULT NULL,
  `dimensions` varchar(255) DEFAULT NULL,
  `images` json DEFAULT NULL,
  `gallery` json DEFAULT NULL,
  `video_url` varchar(255) DEFAULT NULL,
  `specifications` json DEFAULT NULL,
  `features` json DEFAULT NULL,
  `tags` json DEFAULT NULL,
  `status` enum('draft','published','archived') DEFAULT 'draft',
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_digital` tinyint(1) NOT NULL DEFAULT 0,
  `published_at` timestamp NULL DEFAULT NULL,
  `rating` decimal(3,2) DEFAULT 0.00,
  `reviews_count` int(11) DEFAULT 0,
  `views_count` int(11) DEFAULT 0,
  `sales_count` int(11) DEFAULT 0,
  `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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_slug_unique` (`slug`),
  KEY `products_user_id_foreign` (`user_id`),
  KEY `products_company_id_foreign` (`company_id`),
  KEY `products_category_id_foreign` (`category_id`),
  KEY `products_status_index` (`status`),
  KEY `products_is_active_index` (`is_active`),
  KEY `products_is_featured_index` (`is_featured`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create orders table
CREATE TABLE IF NOT EXISTS `orders` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `company_id` bigint(20) unsigned DEFAULT NULL,
  `order_number` varchar(50) NOT NULL,
  `status` enum('pending','confirmed','processing','shipped','delivered','cancelled','refunded') DEFAULT 'pending',
  `payment_status` enum('pending','paid','failed','refunded') DEFAULT 'pending',
  `payment_method` varchar(50) DEFAULT NULL,
  `subtotal` decimal(10,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `shipping_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `currency` varchar(3) DEFAULT 'USD',
  `notes` text DEFAULT NULL,
  `shipping_address` json DEFAULT NULL,
  `billing_address` json DEFAULT NULL,
  `tracking_number` varchar(100) DEFAULT NULL,
  `shipped_at` timestamp NULL DEFAULT NULL,
  `delivered_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `orders_order_number_unique` (`order_number`),
  KEY `orders_user_id_foreign` (`user_id`),
  KEY `orders_company_id_foreign` (`company_id`),
  KEY `orders_status_index` (`status`),
  KEY `orders_payment_status_index` (`payment_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create order_items table
CREATE TABLE IF NOT EXISTS `order_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `quantity` int(11) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `total` decimal(10,2) NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_sku` varchar(100) DEFAULT NULL,
  `product_image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `order_items_order_id_foreign` (`order_id`),
  KEY `order_items_product_id_foreign` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create payments table
CREATE TABLE IF NOT EXISTS `payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` bigint(20) unsigned DEFAULT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `payment_method` varchar(50) NOT NULL,
  `gateway` varchar(50) NOT NULL,
  `gateway_transaction_id` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `currency` varchar(3) NOT NULL DEFAULT 'USD',
  `status` enum('pending','processing','completed','failed','cancelled','refunded') DEFAULT 'pending',
  `gateway_response` json DEFAULT NULL,
  `processed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `payments_order_id_foreign` (`order_id`),
  KEY `payments_user_id_foreign` (`user_id`),
  KEY `payments_status_index` (`status`),
  KEY `payments_gateway_index` (`gateway`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create exhibitions table
CREATE TABLE IF NOT EXISTS `exhibitions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `organizer_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `short_description` varchar(500) DEFAULT NULL,
  `type` enum('trade_show','conference','expo','fair','summit','other') DEFAULT 'trade_show',
  `industry` varchar(100) DEFAULT NULL,
  `venue` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `country` varchar(2) DEFAULT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `registration_start` date DEFAULT NULL,
  `registration_deadline` date DEFAULT NULL,
  `max_participants` int(11) DEFAULT NULL,
  `entry_fee` decimal(10,2) DEFAULT 0.00,
  `booth_fee` decimal(10,2) DEFAULT 0.00,
  `currency` varchar(3) DEFAULT 'USD',
  `status` enum('draft','published','ongoing','completed','cancelled') DEFAULT 'draft',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `is_online` tinyint(1) NOT NULL DEFAULT 0,
  `website` varchar(255) DEFAULT NULL,
  `contact_email` varchar(255) DEFAULT NULL,
  `contact_phone` varchar(20) DEFAULT NULL,
  `images` json DEFAULT NULL,
  `floor_plan` varchar(255) DEFAULT NULL,
  `brochure` varchar(255) DEFAULT NULL,
  `rating` decimal(3,2) DEFAULT 0.00,
  `reviews_count` int(11) DEFAULT 0,
  `participants_count` int(11) DEFAULT 0,
  `views_count` int(11) DEFAULT 0,
  `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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `exhibitions_slug_unique` (`slug`),
  KEY `exhibitions_organizer_id_foreign` (`organizer_id`),
  KEY `exhibitions_country_index` (`country`),
  KEY `exhibitions_industry_index` (`industry`),
  KEY `exhibitions_status_index` (`status`),
  KEY `exhibitions_start_date_index` (`start_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create exhibition_participants table
CREATE TABLE IF NOT EXISTS `exhibition_participants` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `exhibition_id` bigint(20) unsigned NOT NULL,
  `company_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `booth_number` varchar(20) DEFAULT NULL,
  `booth_size` varchar(20) DEFAULT NULL,
  `booth_type` enum('standard','premium','corner','island') DEFAULT 'standard',
  `participation_type` enum('exhibitor','visitor','speaker','sponsor') DEFAULT 'exhibitor',
  `status` enum('pending','approved','rejected','cancelled') DEFAULT 'pending',
  `registration_date` timestamp NULL DEFAULT NULL,
  `payment_status` enum('pending','paid','refunded') DEFAULT 'pending',
  `amount_paid` decimal(10,2) DEFAULT 0.00,
  `special_requirements` text DEFAULT NULL,
  `contact_person` varchar(255) NOT NULL,
  `contact_email` varchar(255) NOT NULL,
  `contact_phone` varchar(20) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `exhibition_participants_unique` (`exhibition_id`,`company_id`),
  KEY `exhibition_participants_exhibition_id_foreign` (`exhibition_id`),
  KEY `exhibition_participants_company_id_foreign` (`company_id`),
  KEY `exhibition_participants_user_id_foreign` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create reviews table
CREATE TABLE IF NOT EXISTS `reviews` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned DEFAULT NULL,
  `rating` tinyint(4) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `comment` text DEFAULT NULL,
  `pros` json DEFAULT NULL,
  `cons` json DEFAULT NULL,
  `images` json DEFAULT NULL,
  `is_verified_purchase` tinyint(1) NOT NULL DEFAULT 0,
  `is_approved` tinyint(1) NOT NULL DEFAULT 0,
  `is_recommended` tinyint(1) NOT NULL DEFAULT 0,
  `helpful_count` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `reviews_user_id_foreign` (`user_id`),
  KEY `reviews_product_id_foreign` (`product_id`),
  KEY `reviews_rating_index` (`rating`),
  KEY `reviews_is_approved_index` (`is_approved`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create product_reviews table
CREATE TABLE IF NOT EXISTS `product_reviews` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `rating` tinyint(4) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `comment` text DEFAULT NULL,
  `pros` json DEFAULT NULL,
  `cons` json DEFAULT NULL,
  `images` json DEFAULT NULL,
  `is_verified_purchase` tinyint(1) NOT NULL DEFAULT 0,
  `is_approved` tinyint(1) NOT NULL DEFAULT 0,
  `is_recommended` tinyint(1) NOT NULL DEFAULT 0,
  `helpful_count` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_reviews_unique` (`product_id`,`user_id`),
  KEY `product_reviews_product_id_foreign` (`product_id`),
  KEY `product_reviews_user_id_foreign` (`user_id`),
  KEY `product_reviews_rating_index` (`rating`),
  KEY `product_reviews_is_approved_index` (`is_approved`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create company_reviews table
CREATE TABLE IF NOT EXISTS `company_reviews` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `company_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `overall_rating` tinyint(4) NOT NULL,
  `service_rating` tinyint(4) DEFAULT NULL,
  `communication_rating` tinyint(4) DEFAULT NULL,
  `delivery_rating` tinyint(4) DEFAULT NULL,
  `quality_rating` tinyint(4) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `comment` text DEFAULT NULL,
  `pros` json DEFAULT NULL,
  `cons` json DEFAULT NULL,
  `images` json DEFAULT NULL,
  `is_verified_business` tinyint(1) NOT NULL DEFAULT 0,
  `is_approved` tinyint(1) NOT NULL DEFAULT 0,
  `is_recommended` tinyint(1) NOT NULL DEFAULT 0,
  `helpful_count` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `company_reviews_unique` (`company_id`,`user_id`),
  KEY `company_reviews_company_id_foreign` (`company_id`),
  KEY `company_reviews_user_id_foreign` (`user_id`),
  KEY `company_reviews_overall_rating_index` (`overall_rating`),
  KEY `company_reviews_is_approved_index` (`is_approved`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Create exhibition_reviews table
CREATE TABLE IF NOT EXISTS `exhibition_reviews` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `exhibition_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `overall_rating` tinyint(4) NOT NULL,
  `organization_rating` tinyint(4) DEFAULT NULL,
  `venue_rating` tinyint(4) DEFAULT NULL,
  `networking_rating` tinyint(4) DEFAULT NULL,
  `content_rating` tinyint(4) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `comment` text DEFAULT NULL,
  `pros` json DEFAULT NULL,
  `cons` json DEFAULT NULL,
  `images` json DEFAULT NULL,
  `is_verified_participant` tinyint(1) NOT NULL DEFAULT 0,
  `is_approved` tinyint(1) NOT NULL DEFAULT 0,
  `is_recommended` tinyint(1) NOT NULL DEFAULT 0,
  `helpful_count` int(11) DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `exhibition_reviews_unique` (`exhibition_id`,`user_id`),
  KEY `exhibition_reviews_exhibition_id_foreign` (`exhibition_id`),
  KEY `exhibition_reviews_user_id_foreign` (`user_id`),
  KEY `exhibition_reviews_overall_rating_index` (`overall_rating`),
  KEY `exhibition_reviews_is_approved_index` (`is_approved`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Re-enable foreign key checks

-- Insert sample categories
INSERT IGNORE INTO `categories` (`id`, `name`, `slug`, `description`, `is_featured`, `is_active`, `products_count`, `created_at`, `updated_at`) VALUES
(1, 'Electronics', 'electronics', 'Electronic devices and gadgets', 1, 1, 25, NOW(), NOW()),
(2, 'Fashion', 'fashion', 'Clothing and accessories', 1, 1, 18, NOW(), NOW()),
(3, 'Home & Garden', 'home-garden', 'Home improvement and garden supplies', 1, 1, 32, NOW(), NOW()),
(4, 'Sports & Outdoors', 'sports-outdoors', 'Sports equipment and outdoor gear', 1, 1, 15, NOW(), NOW()),
(5, 'Automotive', 'automotive', 'Car parts and automotive accessories', 1, 1, 22, NOW(), NOW());

-- Insert sample companies
INSERT IGNORE INTO `companies` (`id`, `user_id`, `name`, `slug`, `description`, `industry`, `website`, `email`, `phone`, `city`, `country`, `business_type`, `verification_status`, `is_featured`, `is_active`, `rating`, `reviews_count`, `products_count`, `created_at`, `updated_at`) VALUES
(1, 3, 'ALADIN Trading LLC', 'aladin-trading-llc', 'Leading B2B marketplace and trading company in the Middle East', 'Trading', 'https://aladin-trading.com', 'info@aladin-trading.com', '+971501234567', 'Dubai', 'AE', 'distributor', 'verified', 1, 1, 4.5, 25, 150, NOW(), NOW()),
(2, 2, 'Global Tech Solutions', 'global-tech-solutions', 'Technology solutions provider for businesses worldwide', 'Technology', 'https://globaltech.com', 'contact@globaltech.com', '+971501234568', 'Abu Dhabi', 'AE', 'manufacturer', 'verified', 1, 1, 4.2, 18, 89, NOW(), NOW()),
(3, 1, 'Emirates Business Hub', 'emirates-business-hub', 'Premier business services and consulting company', 'Consulting', 'https://emiratesbiz.com', 'hello@emiratesbiz.com', '+971501234569', 'Sharjah', 'AE', 'service_provider', 'verified', 1, 1, 4.3, 32, 67, NOW(), NOW());

-- Insert sample products
INSERT IGNORE INTO `products` (`id`, `user_id`, `company_id`, `category_id`, `name`, `slug`, `description`, `price`, `currency`, `stock_quantity`, `status`, `is_featured`, `is_active`, `published_at`, `rating`, `reviews_count`, `views_count`, `created_at`, `updated_at`) VALUES
(1, 2, 1, 1, 'Premium Smartphone', 'premium-smartphone', 'Latest flagship smartphone with advanced features', 899.99, 'USD', 50, 'published', 1, 1, NOW(), 4.3, 12, 245, NOW(), NOW()),
(2, 2, 2, 1, 'Wireless Headphones', 'wireless-headphones', 'High-quality wireless headphones with noise cancellation', 299.99, 'USD', 75, 'published', 1, 1, NOW(), 4.1, 8, 189, NOW(), NOW()),
(3, 3, 3, 2, 'Designer Jacket', 'designer-jacket', 'Premium designer jacket for all seasons', 199.99, 'USD', 25, 'published', 1, 1, NOW(), 4.4, 15, 156, NOW(), NOW());

-- Insert sample exhibitions
INSERT IGNORE INTO `exhibitions` (`id`, `organizer_id`, `name`, `slug`, `description`, `type`, `industry`, `venue`, `city`, `country`, `start_date`, `end_date`, `registration_deadline`, `status`, `is_active`, `is_featured`, `rating`, `participants_count`, `views_count`, `created_at`, `updated_at`) VALUES
(1, 1, 'Dubai Tech Expo 2024', 'dubai-tech-expo-2024', 'Annual technology exhibition showcasing latest innovations', 'expo', 'Technology', 'Dubai World Trade Centre', 'Dubai', 'AE', '2024-12-15', '2024-12-18', '2024-12-01', 'published', 1, 1, 4.2, 150, 1250, NOW(), NOW()),
(2, 1, 'Middle East Business Summit', 'middle-east-business-summit', 'Premier business networking event for the Middle East region', 'summit', 'Business', 'Abu Dhabi National Exhibition Centre', 'Abu Dhabi', 'AE', '2024-11-20', '2024-11-22', '2024-11-05', 'published', 1, 1, 4.0, 200, 980, NOW(), NOW()),
(3, 1, 'Global Trade Fair 2024', 'global-trade-fair-2024', 'International trade fair connecting businesses worldwide', 'fair', 'Trade', 'Sharjah Expo Centre', 'Sharjah', 'AE', '2024-10-25', '2024-10-28', '2024-10-10', 'published', 1, 1, 4.1, 300, 1500, NOW(), NOW());

-- Insert sample exhibition participants
INSERT IGNORE INTO `exhibition_participants` (`id`, `exhibition_id`, `company_id`, `user_id`, `booth_number`, `booth_size`, `booth_type`, `participation_type`, `status`, `registration_date`, `payment_status`, `amount_paid`, `contact_person`, `contact_email`, `contact_phone`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 3, 'A101', '3x3', 'standard', 'exhibitor', 'approved', NOW(), 'paid', 2500.00, 'Ahmed Al-Rashid', 'ahmed@aladin-trading.com', '+971501234567', NOW(), NOW()),
(2, 1, 2, 2, 'B205', '6x6', 'premium', 'exhibitor', 'approved', NOW(), 'paid', 5000.00, 'Sarah Johnson', 'sarah@globaltech.com', '+971501234568', NOW(), NOW()),
(3, 2, 3, 1, 'C301', '3x3', 'corner', 'exhibitor', 'approved', NOW(), 'paid', 3000.00, 'Mohammed Hassan', 'mohammed@emiratesbiz.com', '+971501234569', NOW(), NOW()),
(4, 3, 1, 3, 'D150', '9x9', 'island', 'exhibitor', 'pending', NOW(), 'pending', 0.00, 'Ahmed Al-Rashid', 'ahmed@aladin-trading.com', '+971501234567', NOW(), NOW());

-- Insert sample exhibition reviews
INSERT IGNORE INTO `exhibition_reviews` (`id`, `exhibition_id`, `user_id`, `overall_rating`, `organization_rating`, `venue_rating`, `networking_rating`, `content_rating`, `title`, `comment`, `is_verified_participant`, `is_approved`, `is_recommended`, `helpful_count`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 5, 5, 4, 5, 4, 'Excellent Technology Exhibition', 'Great event with amazing networking opportunities and latest tech innovations.', 1, 1, 1, 8, NOW(), NOW()),
(2, 2, 3, 4, 4, 5, 4, 4, 'Good Business Summit', 'Well organized business event with valuable connections made.', 1, 1, 1, 5, NOW(), NOW()),
(3, 3, 1, 4, 4, 4, 5, 4, 'International Trade Fair Success', 'Amazing international exposure and great business opportunities.', 1, 1, 1, 12, NOW(), NOW());

-- Insert sample product reviews
INSERT IGNORE INTO `product_reviews` (`id`, `product_id`, `user_id`, `rating`, `title`, `comment`, `is_verified_purchase`, `is_approved`, `is_recommended`, `helpful_count`, `created_at`, `updated_at`) VALUES
(1, 1, 3, 5, 'Amazing Smartphone', 'Best smartphone I have ever used. Great camera and battery life.', 1, 1, 1, 15, NOW(), NOW()),
(2, 2, 1, 4, 'Good Headphones', 'Sound quality is excellent, but could be more comfortable for long use.', 1, 1, 1, 8, NOW(), NOW()),
(3, 3, 2, 5, 'Perfect Jacket', 'High quality material and perfect fit. Highly recommended!', 1, 1, 1, 22, NOW(), NOW());

-- Insert sample company reviews
INSERT IGNORE INTO `company_reviews` (`id`, `company_id`, `user_id`, `overall_rating`, `service_rating`, `communication_rating`, `delivery_rating`, `quality_rating`, `title`, `comment`, `is_verified_business`, `is_approved`, `is_recommended`, `helpful_count`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 5, 5, 5, 4, 5, 'Excellent Trading Partner', 'ALADIN Trading has been our reliable partner for years. Great service!', 1, 1, 1, 18, NOW(), NOW()),
(2, 2, 3, 4, 4, 5, 4, 4, 'Good Tech Solutions', 'Professional service and quality products. Recommended for tech needs.', 1, 1, 1, 12, NOW(), NOW()),
(3, 3, 1, 4, 5, 4, 4, 4, 'Professional Business Hub', 'Great business consulting services with professional approach.', 1, 1, 1, 9, NOW(), NOW());

-- Update migration records
INSERT IGNORE INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2024_01_01_000001_create_users_table', 1),
(2, '2024_01_01_000002_create_companies_table', 1),
(3, '2024_01_01_000003_create_categories_table', 1),
(4, '2024_01_01_000004_create_products_table', 1),
(5, '2024_01_01_000005_create_orders_table', 1),
(6, '2024_01_01_000006_create_order_items_table', 1),
(7, '2024_01_01_000007_create_payments_table', 1),
(8, '2024_01_01_000008_fix_products_table_missing_columns', 1),
(9, '2024_01_01_000009_fix_companies_table_missing_columns', 1),
(10, '2024_01_01_000010_create_exhibitions_table', 1),
(11, '2024_01_01_000011_create_exhibition_participants_table', 1),
(12, '2024_01_01_000012_fix_categories_table_missing_columns', 1),
(13, '2024_01_01_000013_create_reviews_table', 1),
(14, '2024_01_01_000014_create_product_reviews_table', 1),
(15, '2024_01_01_000015_create_company_reviews_table', 1),
(16, '2024_01_01_000016_create_exhibition_reviews_table', 1);

-- =====================================================
-- ALL TABLES CREATION COMPLETE
-- Every missing table has been created with sample data
-- =====================================================
