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

START TRANSACTION;



--
-- Database: `talaah_updated`
--

DELIMITER $$
--
-- Procedures
--
CREATE DEFINER=`cpses_taawstqajk`@`localhost` PROCEDURE `sp_charge_balance` (IN `p_receiver_id` BIGINT, IN `p_amount` DECIMAL(20,5), IN `p_number` VARCHAR(50))   BEGIN
  INSERT INTO payments
    (payment_number, payment_type, amount, receiver_id, created_at, updated_at)
  VALUES
    (p_number, 'charge', p_amount, p_receiver_id, NOW(), NOW());
END$$

CREATE DEFINER=`cpses_taawstqajk`@`localhost` PROCEDURE `sp_create_order_and_payment` (IN `p_sender_id` BIGINT, IN `p_price` DECIMAL(20,5), IN `p_order_number` VARCHAR(50) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci, IN `p_payment_number` VARCHAR(50) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci, IN `p_count` DECIMAL(12,4), IN `p_game_id` INT, IN `p_product_id` INT, IN `p_gamer_data` TEXT CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci, IN `p_uuid` VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci, IN `p_method` VARCHAR(50) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci, IN `p_note` TEXT CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci, IN `p_note_type` VARCHAR(10))   BEGIN
  DECLARE v_payment_id BIGINT;
  DECLARE v_order_id BIGINT;
  -- Set default value for note_type if NULL or empty
  IF p_note_type IS NULL OR p_note_type = '' THEN
    SET p_note_type = 'both';
  END IF;
  -- Validate note_type parameter
  IF p_note_type NOT IN ('both', 'system', 'user') THEN
    SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Invalid note_type. Must be one of: both, system, user';
  END IF;
  -- Create payment first (without order_id initially)
  INSERT INTO payments
    (payment_number, payment_type, amount, sender_id, created_at, updated_at)
  VALUES
    (p_payment_number, 'order', p_price, p_sender_id, NOW(), NOW());
  -- Get payment ID safely using SELECT with unique payment_number and explicit collation
  SELECT id INTO v_payment_id 
  FROM payments 
  WHERE payment_number COLLATE utf8mb4_unicode_ci = p_payment_number COLLATE utf8mb4_unicode_ci 
    AND sender_id = p_sender_id 
  LIMIT 1;
  -- Create order with payment_id reference (without note field)
  INSERT INTO orders
    (`order_number`,`count`,`game_id`,`product_id`,`gamer_data`,`uuid`,`price`,`user_id`,`status`,`method`,`payment_id`,`created_at`,`updated_at`)
  VALUES
    (p_order_number, p_count, p_game_id, p_product_id, p_gamer_data, p_uuid, p_price, p_sender_id, 'processing', p_method, v_payment_id, NOW(), NOW());
  -- Get order ID safely using SELECT with payment_id as unique reference
  SELECT id INTO v_order_id 
  FROM orders 
  WHERE payment_id = v_payment_id AND user_id = p_sender_id 
  LIMIT 1;
  -- Update payment with the confirmed order_id
  UPDATE payments SET order_id = v_order_id WHERE id = v_payment_id;
  -- Insert note into order_notes table if note is provided
  IF p_note IS NOT NULL AND p_note != '' THEN
    INSERT INTO order_notes
      (order_id, note, type, created_at, updated_at)
    VALUES
      (v_order_id, p_note, p_note_type, NOW(), NOW());
  END IF;
END$$

CREATE DEFINER=`cpses_taawstqajk`@`localhost` PROCEDURE `sp_refund_balance` (IN `p_receiver_id` BIGINT, IN `p_order_id` BIGINT, IN `p_amount` DECIMAL(20,5), IN `p_number` VARCHAR(50))   BEGIN
  INSERT INTO payments
    (payment_number, payment_type, amount, receiver_id, order_id, created_at, updated_at)
  VALUES
    (p_number, 'refund', p_amount, p_receiver_id, p_order_id, NOW(), NOW());
END$$

CREATE DEFINER=`cpses_taawstqajk`@`localhost` PROCEDURE `sp_transfer_balance` (IN `p_sender_id` BIGINT, IN `p_receiver_id` BIGINT, IN `p_amount` DECIMAL(20,5), IN `p_number` VARCHAR(50))   BEGIN
  INSERT INTO payments
    (payment_number, payment_type, amount, sender_id, receiver_id, created_at, updated_at)
  VALUES
    (p_number, 'transfer', p_amount, p_sender_id, p_receiver_id, NOW(), NOW());
END$$

CREATE DEFINER=`cpses_taawstqajk`@`localhost` PROCEDURE `sp_withdraw_balance` (IN `p_sender_id` BIGINT, IN `p_amount` DECIMAL(20,5), IN `p_number` VARCHAR(50))   BEGIN
  INSERT INTO payments
    (payment_number, payment_type, amount, sender_id, created_at, updated_at)
  VALUES
    (p_number, 'withdraw', p_amount, p_sender_id, NOW(), NOW());
END$$

DELIMITER ;

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

--
-- Table structure for table `admins`
--

CREATE TABLE `admins` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `device_key` varchar(255) DEFAULT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `is_super_admin` tinyint(1) NOT NULL DEFAULT 0,
  `google2fa_secret` text DEFAULT NULL,
  `google2fa_enabled` tinyint(4) NOT NULL DEFAULT 0,
  `google2fa_enabled_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 `admins`
--

INSERT INTO `admins` (`id`, `name`, `email`, `password`, `isActive`, `device_key`, `remember_token`, `is_super_admin`, `google2fa_secret`, `google2fa_enabled`, `google2fa_enabled_at`, `created_at`, `updated_at`) VALUES
(1, 'Test Admin', 'aaa15107@gmail.com', '$2y$10$msM57q2jyXi/H/ukc2ZOmeA9wkB4f.XAQlVP84G/GXRFB6u4G29Na', 1, NULL, 'IcBRGG5Fsc4HncojOOMY8SLaBYZWqIwNlvtZoRbzYQiv5Z2vbTbWZjvPKyI7', 1, 'HM3BVTYSP5DUEGHENIWFAWTR6EYGPCYC', 1, '2026-02-04 14:03:59', '2026-01-31 01:48:16', '2026-02-04 14:03:59'),
(2, 'انس', 'anas@gmail.com', '$2y$10$XapwpYVcbCbxo955wJv.iuPsPzMwXtEpOaFadVZGROiO8RlDAOIxS', 1, NULL, NULL, 1, '3YYQNZIC3QFEPR7SPS7VJF54YCR3Y3QZ', 1, '2026-02-04 14:14:08', '2026-02-04 14:11:46', '2026-02-04 14:14:08'),
(5, 'خليل', 'khalil@gmail.com', '$2y$10$vn0qoQVs3nUTjwBuU4hODeGCwSMv76AEj4uGDnOOx8Lu3qbKvT3EO', 1, NULL, NULL, 0, 'LIEJM7HLEQXHHKJBGQRPAHOZQ4I7HDKN', 1, '2026-03-13 00:32:07', '2026-03-12 23:17:08', '2026-03-13 00:32:07'),
(6, 'يوسف مصمم', 'mega0osta@gmail.com', '$2y$10$vJaKdskzi9I8ObA18zF8/OIjFRLE9uftMFoRGrLgiesFJ9sZnOrM.', 1, NULL, NULL, 0, 'EZTCNRPE43IWTEPWTOD2HUQPVHXU4XKQ', 1, '2026-03-14 14:29:39', '2026-03-14 13:23:00', '2026-03-14 14:29:39'),
(7, 'm.khalil', 'khalildev20@gmail.com', '$2y$10$2sJtWRjE0yEqZCxGBpm.kOnnR9mHHWV39p5GlSgO44XScXq9/LQ5C', 1, NULL, NULL, 0, 'AL6SSZ2C4S4FY6RB5MKHGTQQSORFF2IH', 1, '2026-03-16 22:59:21', '2026-03-16 22:58:06', '2026-03-16 22:59:21');

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

--
-- Table structure for table `admin_game_product_permissions`
--

CREATE TABLE `admin_game_product_permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `admin_id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `permission_type` enum('allow','deny') NOT NULL DEFAULT 'allow',
  `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 `ad_images`
--

CREATE TABLE `ad_images` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `image_path` varchar(255) NOT NULL,
  `link_url` varchar(255) DEFAULT NULL,
  `sort` int(11) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `agents`
--

CREATE TABLE `agents` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'اسم الوكيل',
  `phone` varchar(255) DEFAULT NULL COMMENT 'رقم الهاتف',
  `address` varchar(255) DEFAULT NULL COMMENT 'العنوان',
  `note` text DEFAULT NULL COMMENT 'ملاحظات',
  `image` varchar(255) DEFAULT NULL COMMENT 'صورة الوكيل',
  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'حالة الوكيل (1=نشط, 0=غير نشط)',
  `isactive` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'حالة الظهور (1=ظاهر, 0=مخفي)',
  `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 `api_configs`
--

CREATE TABLE `api_configs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'اسم الإعداد',
  `key` varchar(255) NOT NULL COMMENT 'مفتاح الإعداد',
  `value` text DEFAULT NULL COMMENT 'قيمة الإعداد',
  `type` varchar(255) NOT NULL DEFAULT 'string' COMMENT 'نوع البيانات: string, json, boolean, number',
  `description` text DEFAULT NULL COMMENT 'وصف الإعداد',
  `is_active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'هل الإعداد نشط',
  `is_encrypted` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'هل القيمة مشفرة',
  `category` varchar(255) DEFAULT NULL COMMENT 'فئة الإعداد',
  `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 `bans`
--

CREATE TABLE `bans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_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;

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

--
-- Table structure for table `blocked_external_ids`
--

CREATE TABLE `blocked_external_ids` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `player_id` varchar(50) NOT NULL,
  `admin_id` bigint(20) UNSIGNED DEFAULT NULL,
  `block_type` varchar(32) NOT NULL DEFAULT 'dynamic',
  `note` 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 `card_operations`
--

CREATE TABLE `card_operations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `virtual_card_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `operation_type` enum('create','recharge','freeze','unfreeze','terminate') NOT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `amount_usd` decimal(10,2) DEFAULT NULL,
  `status` enum('pending','completed','failed') NOT NULL DEFAULT 'pending',
  `external_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`external_response`)),
  `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 `categories`
--

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `isAvailable` tinyint(1) NOT NULL DEFAULT 1,
  `is_featured` tinyint(1) NOT NULL DEFAULT 0,
  `sort_order` int(11) 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;

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

--
-- Table structure for table `charge_methods`
--

CREATE TABLE `charge_methods` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `isAutomatic` tinyint(1) NOT NULL DEFAULT 0,
  `note` text DEFAULT NULL,
  `title_1` varchar(255) DEFAULT NULL,
  `title_2` varchar(255) DEFAULT NULL,
  `title_3` varchar(255) DEFAULT NULL,
  `rotating_titles` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`rotating_titles`)),
  `currency_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('tax','discount','none') NOT NULL DEFAULT 'none',
  `percent` decimal(5,2) NOT NULL DEFAULT 0.00,
  `hasOperationNumber` tinyint(1) NOT NULL DEFAULT 0,
  `max` decimal(15,6) NOT NULL,
  `min` decimal(10,2) NOT NULL,
  `requires_verified` 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;

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

--
-- Table structure for table `charge_method_attachments`
--

CREATE TABLE `charge_method_attachments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `charge_method_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'اسم الحقل',
  `placeholder` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'النص المساعد',
  `input_type` enum('text','number','select','file') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'نوع الإدخال',
  `is_required` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'هل الحقل مطلوب',
  `min` int(11) DEFAULT NULL COMMENT 'الحد الأدنى للأرقام',
  `max` int(11) DEFAULT NULL COMMENT 'الحد الأقصى للأرقام',
  `options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'خيارات القائمة المنسدلة',
  `order` int(11) NOT NULL DEFAULT 0 COMMENT 'ترتيب الحقل',
  `is_active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'حالة الحقل',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `chat_messages`
--

CREATE TABLE `chat_messages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `ticket_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `sender_type` varchar(10) NOT NULL,
  `sender_id` bigint(20) UNSIGNED NOT NULL,
  `message` 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;

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

--
-- Table structure for table `chat_message_attachments`
--

CREATE TABLE `chat_message_attachments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `chat_message_id` bigint(20) UNSIGNED NOT NULL,
  `original_name` varchar(255) NOT NULL,
  `mime_type` varchar(120) DEFAULT NULL,
  `size` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `path` 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 `chat_tickets`
--

CREATE TABLE `chat_tickets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'open',
  `closed_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 `codes`
--

CREATE TABLE `codes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'الكود الفعلي',
  `groub_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('active','used','disabled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active' COMMENT 'حالة الكود',
  `used_at` timestamp NULL DEFAULT NULL COMMENT 'تاريخ الاستخدام',
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'بيانات إضافية',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `complaints`
--

CREATE TABLE `complaints` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `admin_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('complaint','suggestion') NOT NULL,
  `subject` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `status` enum('pending','under_review','resolved','rejected') NOT NULL DEFAULT 'pending',
  `admin_response` 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 `credit_requests`
--

CREATE TABLE `credit_requests` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `method_id` bigint(20) UNSIGNED NOT NULL,
  `payment_id` bigint(20) UNSIGNED DEFAULT NULL,
  `currency_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,6) NOT NULL,
  `final_amount` decimal(15,6) DEFAULT NULL,
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `operation_number` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `attachment_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `status` enum('pending','approved','rejected') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `crypto_deposit_addresses`
--

CREATE TABLE `crypto_deposit_addresses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `network` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `symbol` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `meta` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `currencies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `symbol` varchar(10) NOT NULL,
  `sellPrice` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `purchasePrice` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `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`, `name`, `symbol`, `sellPrice`, `purchasePrice`, `created_at`, `updated_at`) VALUES
(1, 'USD', '$', 10.00000, 20.00000, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(2, 'LS', 'ل.س', 10.00000, 20.00000, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(3, 'LR', 'ل.ل', 10.00000, 20.00000, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(4, 'EG', 'ج.م', 10.00000, 20.00000, '2026-01-31 01:48:16', '2026-01-31 01:48:16');

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

--
-- Table structure for table `daily_export_reports`
--

CREATE TABLE `daily_export_reports` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `report_date` date NOT NULL,
  `type` enum('orders','payments','combined') NOT NULL DEFAULT 'combined',
  `file_name` varchar(255) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  `file_size` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `orders_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `payments_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `total_orders_amount` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `total_payments_amount` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `status` enum('pending','generating','completed','failed') NOT NULL DEFAULT 'pending',
  `error_message` text DEFAULT NULL,
  `generated_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 `device_tokens`
--

CREATE TABLE `device_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_type` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `token` varchar(500) NOT NULL,
  `device_type` enum('android','ios','web') NOT NULL DEFAULT 'android',
  `device_name` varchar(255) DEFAULT NULL,
  `app_version` varchar(255) DEFAULT NULL,
  `last_used_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 `device_tokens`
--

INSERT INTO `device_tokens` (`id`, `user_type`, `user_id`, `token`, `device_type`, `device_name`, `app_version`, `last_used_at`, `created_at`, `updated_at`) VALUES
(856, 'App\\Models\\User', 12, 'fFxnY5dcSZ6o8LUEaV_rvy:APA91bGnJ_9NvAWuorXUy5y2uaWMPQn9SpjQlExLhhChk9rw85kHaHJUpsk4t29f46HOG8Cy5JbgFodwIzxd5RyCdSnF0MiGadJJWlmuu0N97mf4cVOytG4', 'android', 'Android', '1.32', '2026-03-26 19:44:19', '2026-02-17 21:46:43', '2026-03-26 19:44:19'),
(857, 'App\\Models\\User', 6, 'eQPLBLnBSxm4XOlkl7RqCN:APA91bGXKicbxTKXO1LhHMqSEPKBeTgvjEmoC9GE---RpCsiTyF-LxkgSAP9WsC_Uk8dkcOYQkonjclsPubLNjllhD3bdPqhvrfFu8tcv0UB3u_VmXzYMP8', 'android', 'Android', '1.32', '2026-02-19 21:10:18', '2026-02-19 21:10:18', '2026-02-19 21:10:18'),
(858, 'App\\Models\\User', 6, 'dLbfanDyTWqLMCKIa8VJbt:APA91bE6zfbe1MIsUVfx_RVPQuS5GVEvGZgfjY1E8cHmCjHAMovxyTkeuxPIqXo6vWieIHkOyL_Oo-M2F9-0EH6uSl8VMRIRI8pVXjl1AU1b8bYY1Te1KE8', 'android', 'Android', '1.32', '2026-02-24 11:07:02', '2026-02-24 11:07:02', '2026-02-24 11:07:02'),
(859, 'App\\Models\\User', 10, 'cvESjT0uRfyIybj3v-KhUJ:APA91bHdu-OP_kweb5CjqkzYFKKdSUPmTXOf6xuW8SrP5BjFemvsYFHgk-CAT08Jf41Qsjf37RuaO-ziSKl3cFenMsEklqZ7GDNcmAp-b9drQ66Kn-_8lyI', 'android', 'Android', '1.32', '2026-03-13 21:28:08', '2026-03-13 21:28:08', '2026-03-13 21:28:08'),
(860, 'App\\Models\\User', 7, 'el8QGJcdQhWeI-4TIHJKIP:APA91bFVMTDE3Upk3JtqgnryoRq5fzI4QKwKijLS2002JtdAJpMd9BYCNFYBnQLBj1PZ0ga7cCZn4oHd7iEpQ2U5bsfYxhz2O8wSu1kl20hu0TJLLoQiaSA', 'android', 'Android', '1.32', '2026-03-15 00:45:48', '2026-03-15 00:32:08', '2026-03-15 00:45:48'),
(861, 'App\\Models\\User', 11, 'fWFNE_s8T4mzZ0KtiUJFzl:APA91bEZgtEClLnEEsXHP0279qQVvMP_2rvtEeZYGxRX1thZU0CAOWDQVQ4h-hivKfgHLoMnryfF0MpXPuRv1LP4gr7uU306M3yJKp26Dp3h3NCbOmJtFLU', 'android', 'Android', '1.32', '2026-03-25 19:38:52', '2026-03-25 19:38:52', '2026-03-25 19:38:52');

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

--
-- Table structure for table `discounts`
--

CREATE TABLE `discounts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `percent` decimal(10,5) 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 `externalsites`
--

CREATE TABLE `externalsites` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('site','script','internalScript') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'site',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `api_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `admin_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `products_endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `products_http_method` enum('GET','POST') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'GET',
  `order_endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `order_http_method` enum('GET','POST') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'POST',
  `status_endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status_http_method` enum('GET','POST') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'GET',
  `balance_endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `balance_http_method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `balance_rule` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `headers` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `externalsites`
--

INSERT INTO `externalsites` (`id`, `name`, `type`, `is_active`, `balance`, `api_url`, `admin_name`, `products_endpoint`, `products_http_method`, `order_endpoint`, `order_http_method`, `status_endpoint`, `status_http_method`, `balance_endpoint`, `balance_http_method`, `balance_rule`, `headers`, `token`, `created_at`, `updated_at`) VALUES
(1, 'sw_games_LS', 'site', 1, 0.00, 'https://www.sw-games.net/api/fastapi', 'sw_games_LS', 'products', 'GET', 'requestorder/{product_id}/params?qty={qty}&uuid={uuid}&Player_ID={player_id}', 'GET', 'checkorders?order_ids=', 'GET', 'balance', 'GET', 'SWGames', '{\"api-token\":\"%token%\",\"Accept\":\"application\\/json\"}', '9yl9u92jnw4447nwqg5181z4s', '2026-03-10 23:03:23', '2026-03-10 23:03:23'),
(2, 'sw_games_D', 'site', 1, 0.00, 'https://www.sw-games.net/api/fastapi', 'sw_games_D', 'products', 'GET', 'requestorder/{product_id}/params?qty={qty}&uuid={uuid}&Player_ID={player_id}', 'GET', 'checkorders?order_ids=', 'GET', 'balance', 'GET', 'SWGames', '{\"apiToken\":\"%token%\",\"Accept\":\"application\\/json\"}', 'azfnb5bh8ar4448idn0gu1pc3', '2026-03-10 23:04:46', '2026-03-17 22:43:55');

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

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

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) DEFAULT 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_general_ci;

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

--
-- Table structure for table `features`
--

CREATE TABLE `features` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `scope` varchar(255) NOT NULL,
  `value` text 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 `feature_flags`
--

CREATE TABLE `feature_flags` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `activate_for_everyone` tinyint(1) NOT NULL DEFAULT 0,
  `rollout_percentage` tinyint(3) UNSIGNED DEFAULT NULL,
  `conditions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`conditions`)),
  `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 `feature_flag_logs`
--

CREATE TABLE `feature_flag_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `feature_flag_id` bigint(20) UNSIGNED NOT NULL,
  `admin_id` bigint(20) UNSIGNED NOT NULL,
  `action` enum('created','updated','deleted','toggled','user_activated','user_deactivated') NOT NULL,
  `changes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`changes`)),
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `games`
--

CREATE TABLE `games` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `parent_id` bigint(20) UNSIGNED DEFAULT NULL,
  `script_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `unit` varchar(100) DEFAULT NULL,
  `slug` varchar(255) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `product_image` varchar(255) DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED NOT NULL,
  `currency_id` bigint(20) UNSIGNED NOT NULL,
  `description` text DEFAULT NULL,
  `admin_description` text DEFAULT NULL,
  `gamer_query` tinyint(1) NOT NULL DEFAULT 0,
  `sort` int(11) NOT NULL DEFAULT 0,
  `isVisible` tinyint(1) NOT NULL DEFAULT 1,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `isPrivate` tinyint(1) NOT NULL DEFAULT 0,
  `isAutomatic` tinyint(1) NOT NULL DEFAULT 0,
  `requires_verified` 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;



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

--
-- Table structure for table `groubcodes`
--

CREATE TABLE `groubcodes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL COMMENT 'اسم المجموعة',
  `description` text DEFAULT NULL COMMENT 'وصف المجموعة',
  `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 `identity_verifications`
--

CREATE TABLE `identity_verifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `front_image` varchar(255) DEFAULT NULL,
  `back_image` varchar(255) DEFAULT NULL,
  `selfie_image` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `admin_notes` text DEFAULT NULL,
  `reviewed_at` timestamp NULL DEFAULT NULL,
  `reviewed_by` bigint(20) UNSIGNED 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` tinyint(3) 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 `levels`
--

CREATE TABLE `levels` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `key` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `benefits` text DEFAULT NULL,
  `required_points` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `tier_order` smallint(5) UNSIGNED NOT NULL,
  `discount_percent` tinyint(3) UNSIGNED DEFAULT NULL,
  `icon_class` 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 `levels`
--

INSERT INTO `levels` (`id`, `key`, `name`, `description`, `benefits`, `required_points`, `tier_order`, `discount_percent`, `icon_class`, `created_at`, `updated_at`) VALUES
(10, 'new', 'مستخدم جديد', 'ابدأ رحلتك معنا', 'دعم فني أساسي\nخصم 5% على أول عملية شراء', 0, 1, 5, 'bi bi-person-fill', '2026-01-31 01:48:19', '2026-01-31 01:48:19'),
(11, 'bronze', 'البرونزي', 'مستخدم نشط ومتفاعل', 'خصم 7%\nدعم فني سريع\nنقاط مضاعفة', 300, 2, 7, 'bi bi-award-fill', '2026-01-31 01:48:19', '2026-01-31 01:48:19'),
(12, 'silver', 'الفضي', 'مستخدم متقدم ومميز', 'خصم 10%\nدعم فني متميز\nعروض حصرية', 500, 3, 10, 'bi bi-star-fill', '2026-01-31 01:48:19', '2026-01-31 01:48:19'),
(13, 'gold', 'الذهبي VIP', 'عضوية ذهبية مميزة', 'خصم 15%\nدعم فني فوري\nهدايا شهرية\nأولوية في الطلبات', 800, 4, 15, 'bi bi-star-half', '2026-01-31 01:48:19', '2026-01-31 01:48:19'),
(14, 'platinum', 'البلاتيني VIP', 'تجربة استثنائية للاعبين المتميزين', 'خصم 20%\nدعم شخصي\nهدايا حصرية\nمنتجات مميزة', 1200, 5, 20, 'bi bi-gem', '2026-01-31 01:48:19', '2026-01-31 01:48:19'),
(15, 'diamond', 'الماسي VIP', 'مستوى النخبة من اللاعبين', 'خصم 25%\nدعم على مدار الساعة\nهدايا فاخرة\nوصول مبكر للمنتجات', 2000, 6, 25, 'bi bi-trophy-fill', '2026-01-31 01:48:19', '2026-01-31 01:48:19'),
(16, 'legendary', 'الأسطوري VIP', 'المستوى الأعلى والأكثر تميزًا', 'خصم 30%\nمدير حساب شخصي\nهدايا حصرية فاخرة\nصلاحيات خاصة\nتجربة VIP كاملة', 3000, 7, 30, 'bi bi-stars', '2026-01-31 01:48:19', '2026-01-31 01:48:19');

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

--
-- Table structure for table `merchants`
--

CREATE TABLE `merchants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'اسم التاجر',
  `business_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'اسم النشاط التجاري',
  `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'البريد الإلكتروني',
  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'رقم الهاتف',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'العنوان',
  `tax_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'الرقم الضريبي',
  `commercial_register` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'السجل التجاري',
  `credit_limit` decimal(20,5) NOT NULL DEFAULT 0.00000 COMMENT 'الحد الائتماني',
  `current_balance` decimal(20,5) NOT NULL DEFAULT 0.00000 COMMENT 'الرصيد الحالي',
  `commission_rate` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'معدل العمولة (%)',
  `api_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'مفتاح API',
  `api_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'سر API',
  `is_active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'هل التاجر نشط',
  `auto_approve` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'الموافقة التلقائية',
  `allowed_services` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'الخدمات المسموحة',
  `webhook_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'رابط الـ Webhook',
  `callback_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'رابط الإرجاع',
  `verified_at` timestamp NULL DEFAULT NULL COMMENT 'تاريخ التحقق',
  `verified_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- 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
(107, '2026_02_01_190907_create_feature_flags_table', 1),
(108, '2026_02_01_191048_create_feature_flag_logs_table', 2),
(109, '2022_11_01_000001_create_features_table', 3),
(110, '2026_02_03_185146_add_referral_code_to_users_table', 4),
(111, '2026_02_02_180532_create_promotions_table', 5),
(112, '2026_02_03_185214_create_referrals_table', 6),
(113, '2026_02_06_162448_create_daily_export_reports_table', 7),
(114, '2026_02_07_000000_create_popup_ads_table', 8),
(115, '2026_02_08_161550_add_category_id_to_ad_images_table', 9),
(116, '2026_02_09_000000_create_complaints_table', 10),
(117, '2026_01_22_211512_add_rotating_titles_to_charge_methods', 11),
(118, '2026_01_26_034850_create_virtual_cards_table', 12),
(119, '2026_01_26_034919_create_card_operations_table', 13),
(120, '2026_03_05_171247_add_slug_to_categories_table', 14),
(121, '2026_02_23_000000_add_slug_to_categories_and_games_tables', 15),
(122, '2026_02_23_100000_add_unit_to_games_table', 16),
(123, '2026_02_05_164517_add_site_column_to_permissions_table', 17),
(124, '2026_01_31_151404_add_contact_fields_to_users_table', 18),
(125, '2026_02_02_162035_add_terms_content_to_settings_table', 19),
(126, '2026_02_16_184603_create_vendor_blocked_charge_methods_table', 20),
(127, '2026_02_16_160548_create_order_response_requests_table', 21),
(128, '2026_03_14_032021_add_style_to_users_table', 22);

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

--
-- 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
(10, 'App\\Models\\Admin', 1),
(10, 'App\\Models\\Admin', 2),
(10, 'App\\Models\\Admin', 5),
(18, 'App\\Models\\Admin', 6),
(10, 'App\\Models\\Admin', 7);

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

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

CREATE TABLE `notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('info','error','warning') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'info',
  `sender_type` enum('admin','vendor','system') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `sender_id` bigint(20) UNSIGNED DEFAULT NULL,
  `recipient_id` bigint(20) UNSIGNED NOT NULL,
  `recipient_type` enum('user','vendor') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `vendor_app_id` bigint(20) UNSIGNED DEFAULT NULL,
  `related_model_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `related_model_id` bigint(20) UNSIGNED DEFAULT NULL,
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `is_required` tinyint(1) NOT NULL DEFAULT 0,
  `read_at` timestamp NULL DEFAULT NULL,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `notification_analytics`
--

CREATE TABLE `notification_analytics` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `notification_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `vendor_app_id` bigint(20) UNSIGNED DEFAULT NULL,
  `channel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'database, broadcast, firebase, email',
  `sent_at` timestamp NULL DEFAULT NULL,
  `delivered_at` timestamp NULL DEFAULT NULL,
  `opened_at` timestamp NULL DEFAULT NULL,
  `clicked_at` timestamp NULL DEFAULT NULL,
  `dismissed_at` timestamp NULL DEFAULT NULL,
  `email_opened` tinyint(1) NOT NULL DEFAULT 0,
  `email_clicked` tinyint(1) NOT NULL DEFAULT 0,
  `email_open_count` int(11) NOT NULL DEFAULT 0,
  `click_count` int(11) NOT NULL DEFAULT 0,
  `device_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'android, ios, web',
  `user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `ip_address` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `sent_time` time DEFAULT NULL COMMENT 'Time of day sent',
  `ai_optimized` tinyint(1) NOT NULL DEFAULT 0,
  `ai_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'AI optimization data',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `notification_email_logs`
--

CREATE TABLE `notification_email_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `notification_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `to_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` enum('pending','sent','failed','bounced') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `sent_at` timestamp NULL DEFAULT NULL,
  `delivered_at` timestamp NULL DEFAULT NULL,
  `opened_at` timestamp NULL DEFAULT NULL,
  `clicked_at` timestamp NULL DEFAULT NULL,
  `bounced_at` timestamp NULL DEFAULT NULL,
  `open_count` int(11) NOT NULL DEFAULT 0,
  `click_count` int(11) NOT NULL DEFAULT 0,
  `tracking_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `retry_count` int(11) NOT NULL DEFAULT 0,
  `last_retry_at` timestamp NULL DEFAULT NULL,
  `message_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email service provider message ID',
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `operations`
--

CREATE TABLE `operations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `externalProduct_id` int(11) DEFAULT NULL,
  `uuid` char(36) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `gamer_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `externalSite_id` int(11) DEFAULT NULL,
  `status` enum('pending','completed','failed','cancelled','error') NOT NULL DEFAULT 'pending',
  `externalPrice` decimal(15,4) DEFAULT NULL,
  `chargeCode` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `externalOrder_id` varchar(50) DEFAULT NULL,
  `localDevice` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `count` decimal(12,4) NOT NULL,
  `game_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `gamer_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `uuid` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `price` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('processing','completed','cancelled','pending','awaiting_response') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'processing',
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `payment_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `orders_uuid`
--

CREATE TABLE `orders_uuid` (
  `id` int(11) NOT NULL,
  `order_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Table structure for table `order_appeals`
--

CREATE TABLE `order_appeals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `user_note` text NOT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `video_url` varchar(255) DEFAULT NULL,
  `status` enum('pending','accepted','rejected') NOT NULL DEFAULT 'pending',
  `admin_note` text DEFAULT NULL,
  `admin_id` bigint(20) UNSIGNED DEFAULT NULL,
  `reviewed_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 `order_codes`
--

CREATE TABLE `order_codes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(255) NOT NULL,
  `type` enum('internal','external') NOT NULL DEFAULT 'external',
  `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 `order_notes`
--

CREATE TABLE `order_notes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `note` text NOT NULL COMMENT 'نص الملاحظة',
  `type` enum('both','system','user') NOT NULL DEFAULT 'both' COMMENT 'نوع الملاحظة',
  `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 `order_reports`
--

CREATE TABLE `order_reports` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `order_number` varchar(255) DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_name` varchar(255) DEFAULT NULL,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `game_name` varchar(255) DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_name` varchar(255) DEFAULT NULL,
  `balance_before` varchar(255) DEFAULT NULL,
  `price` varchar(255) DEFAULT NULL,
  `external_price` varchar(255) DEFAULT NULL,
  `balance_after` varchar(255) DEFAULT NULL,
  `count` decimal(12,4) NOT NULL DEFAULT 1.0000,
  `gamer_data` text DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `method` varchar(255) DEFAULT NULL,
  `order_created_at` timestamp NULL DEFAULT NULL,
  `operations_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `operations_status` text DEFAULT NULL,
  `site_names` text DEFAULT NULL,
  `operations_notes` text DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `vendor_name` varchar(255) DEFAULT NULL,
  `vendor_profit` varchar(255) DEFAULT NULL,
  `currency_id` bigint(20) UNSIGNED DEFAULT NULL,
  `currency_symbol` varchar(255) DEFAULT NULL,
  `report_date` date 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 `order_response_requests`
--

CREATE TABLE `order_response_requests` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `admin_id` bigint(20) UNSIGNED DEFAULT NULL,
  `admin_note` text NOT NULL,
  `client_reply` text DEFAULT NULL,
  `previous_status` varchar(30) NOT NULL,
  `auto_action` enum('none','cancel','complete') NOT NULL DEFAULT 'none',
  `auto_action_hours` int(10) UNSIGNED DEFAULT NULL,
  `auto_action_at` timestamp NULL DEFAULT NULL,
  `status` enum('pending','replied','expired','executed') NOT NULL DEFAULT 'pending',
  `replied_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 `order_response_requests`
--

INSERT INTO `order_response_requests` (`id`, `order_id`, `admin_id`, `admin_note`, `client_reply`, `previous_status`, `auto_action`, `auto_action_hours`, `auto_action_at`, `status`, `replied_at`, `created_at`, `updated_at`) VALUES
(2, 1, 1, 'ghhgg', 'تيست', 'processing', 'none', NULL, NULL, 'replied', '2026-03-13 18:42:42', '2026-03-13 18:42:12', '2026-03-13 18:42:42'),
(3, 2, 1, 'عاوز  الايميل بتاعك', NULL, 'processing', 'none', NULL, NULL, 'pending', NULL, '2026-03-13 18:53:23', '2026-03-13 18:53:23'),
(4, 1, 1, 'بي', 'تيست', 'pending', 'none', NULL, NULL, 'replied', '2026-03-13 19:01:39', '2026-03-13 18:55:40', '2026-03-13 19:01:39'),
(5, 7, 2, 'test', 'test', 'processing', 'none', NULL, NULL, 'replied', '2026-03-17 06:40:34', '2026-03-16 23:04:49', '2026-03-17 06:40:34'),
(6, 7, 2, 'test test test', NULL, 'pending', 'none', NULL, NULL, 'pending', NULL, '2026-03-17 06:41:48', '2026-03-17 06:41:48');

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

--
-- Table structure for table `password_resets`
--

CREATE TABLE `password_resets` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `payment_number` varchar(255) NOT NULL,
  `payment_type` enum('charge','withdraw','transfer','refund','order') NOT NULL,
  `amount` decimal(20,5) NOT NULL,
  `sender_id` bigint(20) UNSIGNED DEFAULT NULL,
  `receiver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `sender_balance_before` decimal(20,5) DEFAULT NULL,
  `sender_balance_after` decimal(20,5) DEFAULT NULL,
  `receiver_balance_before` decimal(20,5) DEFAULT NULL,
  `receiver_balance_after` decimal(20,5) 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;

--
-- Triggers `payments`
--
DELIMITER $$
CREATE TRIGGER `trg_payments_before_insert` BEFORE INSERT ON `payments` FOR EACH ROW BEGIN
  DECLARE min_allowed DECIMAL(20,5);
  DECLARE sb DECIMAL(20,5);
  DECLARE rb DECIMAL(20,5);
  DECLARE sa DECIMAL(20,5);
  DECLARE ra DECIMAL(20,5);
  DECLARE rate DECIMAL(20,5);
  DECLARE deduct_amount DECIMAL(20,5);

  IF NEW.payment_type IN ('charge','refund') THEN
    SELECT balance, min_balance
      INTO rb, min_allowed
    FROM users
    WHERE id = NEW.receiver_id
    FOR UPDATE;
    SET ra = rb + NEW.amount;

    UPDATE users SET balance = ra WHERE id = NEW.receiver_id;
    SET NEW.receiver_balance_before = rb;
    SET NEW.receiver_balance_after  = ra;

  ELSEIF NEW.payment_type = 'withdraw' THEN
    SELECT balance, min_balance
      INTO sb, min_allowed
    FROM users
    WHERE id = NEW.sender_id
    FOR UPDATE;
    SET sa = sb - ABS(NEW.amount);
    IF sa < min_allowed THEN
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Insufficient funds for withdrawal';
    END IF;
    UPDATE users SET balance = sa WHERE id = NEW.sender_id;
    SET NEW.sender_balance_before = sb;
    SET NEW.sender_balance_after  = sa;

  ELSEIF NEW.payment_type = 'transfer' THEN
    SELECT COALESCE(transfer_rate, 0), balance, min_balance
      INTO rate, sb, min_allowed
    FROM users
    WHERE id = NEW.sender_id
    FOR UPDATE;
    IF rate > 0 THEN
      SET deduct_amount = NEW.amount * (1 - (rate / 100));
    ELSE
      SET deduct_amount = NEW.amount;
    END IF;
    SET sa = sb - deduct_amount;
    IF sa < min_allowed THEN
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Insufficient funds for transfer';
    END IF;
    UPDATE users SET balance = sa WHERE id = NEW.sender_id;

    SELECT balance
      INTO rb
    FROM users
    WHERE id = NEW.receiver_id
    FOR UPDATE;
    SET ra = rb + NEW.amount;
    UPDATE users SET balance = ra WHERE id = NEW.receiver_id;

    SET NEW.sender_balance_before   = sb;
    SET NEW.sender_balance_after    = sa;
    SET NEW.receiver_balance_before = rb;
    SET NEW.receiver_balance_after  = ra;

    ELSEIF NEW.payment_type = 'order' THEN
      -- خصم قيمة الطلب من المرسل مع التحقق من الحد الأدنى ثم تحديث الرصيد
      SELECT balance, min_balance
        INTO sb, min_allowed
      FROM users
      WHERE id = NEW.sender_id
      FOR UPDATE;
      SET sa = sb - NEW.amount;
      IF sa < min_allowed THEN
        SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Insufficient funds for order';
      END IF;
      UPDATE users SET balance = sa WHERE id = NEW.sender_id;
      SET NEW.sender_balance_before = sb;
      SET NEW.sender_balance_after  = sa;
  END IF;
END
$$
DELIMITER ;

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

--
-- 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,
  `site` varchar(20) DEFAULT NULL COMMENT 'Site code if permission is site-specific, null for all sites',
  `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`, `site`, `created_at`, `updated_at`) VALUES
(185, 'credit_requests_view', 'admin', NULL, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(186, 'credit_requests_create', 'admin', NULL, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(187, 'credit_requests_edit', 'admin', NULL, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(188, 'credit_requests_delete', 'admin', NULL, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(189, 'credit_requests_approve', 'admin', NULL, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(190, 'credit_requests_reject', 'admin', NULL, '2026-01-31 01:48:16', '2026-01-31 01:48:16'),
(191, 'credit_requests_auto_approve', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(192, 'credit_requests_export', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(193, 'credit_requests_bulk_process', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(194, 'credit_requests_statistics', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(195, 'credit_requests_submit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(196, 'credit_requests_cancel', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(197, 'credit_requests_view_own', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(198, 'admins_view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(199, 'admins_create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(200, 'admins.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(201, 'admins.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(202, 'admins.activate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(203, 'admins.deactivate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(204, 'users.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(205, 'users.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(206, 'users.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(207, 'users.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(208, 'users.activate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(209, 'users.deactivate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(210, 'users.balance.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(211, 'users.balance.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(212, 'orders.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(213, 'orders.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(214, 'orders.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(215, 'orders.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(216, 'orders.approve', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(217, 'orders.reject', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(218, 'orders.process', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(219, 'games.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(220, 'games.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(221, 'games.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(222, 'games.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(223, 'games.activate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(224, 'games.deactivate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(225, 'categories.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(226, 'categories.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(227, 'categories.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(228, 'categories.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(229, 'categories.activate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(230, 'categories.deactivate', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(231, 'currencies.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(232, 'currencies.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(233, 'currencies.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(234, 'currencies.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(235, 'payments.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(236, 'payments.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(237, 'payments.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(238, 'payments.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(239, 'payments.approve', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(240, 'payments.reject', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(241, 'reports.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(242, 'reports.financial', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(243, 'reports.users', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(244, 'reports.orders', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(245, 'reports.export', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(246, 'settings.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(247, 'settings.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(248, 'settings.system', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(249, 'permissions.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(250, 'permissions.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(251, 'permissions.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(252, 'permissions.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(253, 'roles.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(254, 'roles.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(255, 'roles.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(256, 'roles.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(257, 'roles.assign', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(258, 'dashboard.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(259, 'dashboard.analytics', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(260, 'content.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(261, 'content.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(262, 'content.edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(263, 'content.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(264, 'notifications.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(265, 'notifications.send', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(266, 'notifications.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(267, 'logs.view', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(268, 'logs.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(269, 'backup.create', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(270, 'backup.download', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(271, 'backup.delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(272, 'view dashboard', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(273, 'view categories', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(274, 'add categories', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(275, 'view users', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(276, 'create users', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(277, 'view groups', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(278, 'view ban', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(279, 'view private/games', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(280, 'view discounts', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(281, 'view taxes', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(282, 'add games', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(283, 'view games', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(284, 'view products', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(285, 'add products', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(286, 'view profits', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(287, 'viewwait orders', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(288, 'viewall orders', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(289, 'view chargeMethod', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(290, 'add chargeMethod', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(291, 'view payment operations', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(292, 'view agents', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(293, 'add agents', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(294, 'view banners', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(295, 'view currencies', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(296, 'view admins', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(297, 'view roles', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(298, 'view settings', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(299, 'orders_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(300, 'orders_waiting', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(301, 'orders_operations', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(302, 'orders_detail', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(303, 'orders_accept', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(304, 'orders_reject', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(305, 'orders_resend', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(306, 'orders_transactions', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(307, 'operations_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(308, 'operations_resend', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(309, 'operations_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(310, 'users_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(311, 'users_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(312, 'users_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(313, 'users_addBalance', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(314, 'vendors_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(315, 'vendors_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(316, 'vendors_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(317, 'admins_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(318, 'admins_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(319, 'codes_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(320, 'codes_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(321, 'codes_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(322, 'games_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(323, 'games_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(324, 'games_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(325, 'games_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(326, 'products_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(327, 'products_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(328, 'products_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(329, 'products_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(330, 'external_sites_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(331, 'external_sites_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(332, 'external_sites_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(333, 'external_sites_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(334, 'categories_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(335, 'categories_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(336, 'categories_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(337, 'categories_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(338, 'sync_prices_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(339, 'sync_prices_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(340, 'sync_prices_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(341, 'sync_prices_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(342, 'requests_balance_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(343, 'requests_balance_accept', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(344, 'requests_balance_reject', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(345, 'charge_methods_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(346, 'charge_methods_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(347, 'charge_methods_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(348, 'charge_methods_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(349, 'payments_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(350, 'settings_show', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(351, 'settings_add', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(352, 'settings_delete', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(353, 'settings_edit', 'admin', NULL, '2026-01-31 01:48:17', '2026-01-31 01:48:17'),
(354, 'roles_show', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(355, 'roles_add', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(356, 'roles_edit', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(357, 'employeesPermissions_show', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(358, 'employeesPermissions_add', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(359, 'employeesPermissions_edit', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(360, 'employeesPermissions_delete', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(361, 'reports_financial', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(362, 'tasks_update', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(363, 'tasks_show', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(364, 'add_blocked_external_id', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(365, 'levels.view', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(366, 'levels.edit', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(367, 'currencies_show', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(368, 'manage maintenance', 'admin', NULL, '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(369, 'dashboard_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(370, 'dashboard_analytics', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(371, 'orders_accept_after_reject', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(372, 'orders_reject_after_accept', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(373, 'appeals_show', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(374, 'appeals_accept', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(375, 'appeals_reject', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(376, 'order_codes_show', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(377, 'users_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(378, 'users_activate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(379, 'users_deactivate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(380, 'users_balance_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(381, 'users_balance_edit', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(382, 'admins_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(383, 'admins_activate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(384, 'admins_deactivate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(385, 'agents_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(386, 'agents_add', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(387, 'games_activate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(388, 'games_deactivate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(389, 'categories_activate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(390, 'categories_deactivate', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(391, 'private_games_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(392, 'payments_create', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(393, 'payments_edit', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(394, 'payments_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(395, 'payments_approve', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(396, 'payments_reject', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(397, 'payment_operations_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(398, 'currencies_create', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(399, 'currencies_edit', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(400, 'currencies_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(401, 'profits_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(402, 'discounts_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(403, 'taxes_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(404, 'settings_system', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(405, 'roles_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(406, 'roles_assign', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(407, 'permissions_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(408, 'permissions_create', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(409, 'permissions_edit', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(410, 'permissions_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(411, 'reports_users', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(412, 'reports_orders', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(413, 'reports_export', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(414, 'logs_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(415, 'logs_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(416, 'levels_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(417, 'levels_edit', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(418, 'groups_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(419, 'content_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(420, 'content_create', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(421, 'content_edit', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(422, 'content_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(423, 'notifications_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(424, 'notifications_send', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(425, 'notifications_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(426, 'banners_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(427, 'backup_create', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(428, 'backup_download', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(429, 'backup_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(430, 'maintenance_manage', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(431, 'ban_view', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(432, 'blocked_external_ids_show', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(433, 'blocked_external_ids_add', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(434, 'blocked_external_ids_delete', 'admin', NULL, '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(435, 'virtual_cards_dashboard', 'admin', 'sw', '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(436, 'virtual_cards_show', 'admin', 'sw', '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(437, 'virtual_cards_operations', 'admin', 'sw', '2026-03-11 22:51:52', '2026-03-11 22:51:52'),
(438, 'games_images_edit', 'admin', NULL, '2026-03-11 22:58:45', '2026-03-11 22:58:45'),
(439, 'products_images_edit', 'admin', NULL, '2026-03-11 22:58:45', '2026-03-11 22:58:45');

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

--
-- Table structure for table `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `popup_ads`
--

CREATE TABLE `popup_ads` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `image_path` varchar(255) NOT NULL,
  `link_url` varchar(2048) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `priority` int(11) NOT NULL DEFAULT 0,
  `target_audience` enum('all','non_managed') NOT NULL DEFAULT 'all',
  `starts_at` timestamp NULL DEFAULT NULL,
  `ends_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 `privates`
--

CREATE TABLE `privates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_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;

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

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

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `note` text DEFAULT NULL,
  `isPrivate` tinyint(1) NOT NULL DEFAULT 0,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `isVisible` tinyint(1) NOT NULL DEFAULT 1,
  `price` decimal(25,14) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `game_id` bigint(20) UNSIGNED NOT NULL,
  `isCard` tinyint(1) NOT NULL DEFAULT 0,
  `min_value` int(11) DEFAULT NULL,
  `max_value` int(11) DEFAULT NULL,
  `type` enum('single','bundle') NOT NULL DEFAULT 'single',
  `storage_id` bigint(20) DEFAULT NULL,
  `device` 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 `products_codes`
--

CREATE TABLE `products_codes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `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 `product_bundle_items`
--

CREATE TABLE `product_bundle_items` (
  `bundle_id` bigint(20) UNSIGNED NOT NULL,
  `item_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` int(10) UNSIGNED 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 `profit_rates`
--

CREATE TABLE `profit_rates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `one` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `two` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `three` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `four` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `five` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `six` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `seven` decimal(10,5) NOT NULL DEFAULT 0.00000,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED 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 `promotions`
--

CREATE TABLE `promotions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `promotable_type` varchar(255) NOT NULL,
  `promotable_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('offer','discount') NOT NULL,
  `label` varchar(50) NOT NULL,
  `is_active` 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 `pulse_aggregates`
--

CREATE TABLE `pulse_aggregates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `bucket` int(10) UNSIGNED NOT NULL,
  `period` mediumint(8) UNSIGNED NOT NULL,
  `type` varchar(255) NOT NULL,
  `key` mediumtext NOT NULL,
  `key_hash` binary(16) GENERATED ALWAYS AS (unhex(md5(`key`))) VIRTUAL,
  `aggregate` varchar(255) NOT NULL,
  `value` decimal(20,2) NOT NULL,
  `count` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pulse_entries`
--

CREATE TABLE `pulse_entries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `timestamp` int(10) UNSIGNED NOT NULL,
  `type` varchar(255) NOT NULL,
  `key` mediumtext NOT NULL,
  `key_hash` binary(16) GENERATED ALWAYS AS (unhex(md5(`key`))) VIRTUAL,
  `value` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pulse_values`
--

CREATE TABLE `pulse_values` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `timestamp` int(10) UNSIGNED NOT NULL,
  `type` varchar(255) NOT NULL,
  `key` mediumtext NOT NULL,
  `key_hash` binary(16) GENERATED ALWAYS AS (unhex(md5(`key`))) VIRTUAL,
  `value` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `referrals`
--

CREATE TABLE `referrals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `inviter_id` bigint(20) UNSIGNED NOT NULL,
  `invitee_id` bigint(20) UNSIGNED NOT NULL,
  `referral_type` enum('vendor','user') NOT NULL,
  `vendor_id` bigint(20) UNSIGNED 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 `resellers`
--

CREATE TABLE `resellers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `business_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'اسم النشاط التجاري',
  `contact_person` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'الشخص المسؤول',
  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'رقم الهاتف',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'العنوان',
  `credit_limit` decimal(20,5) NOT NULL DEFAULT 0.00000 COMMENT 'الحد الائتماني',
  `current_credit` decimal(20,5) NOT NULL DEFAULT 0.00000 COMMENT 'الائتمان الحالي',
  `commission_rate` decimal(5,2) NOT NULL DEFAULT 2.00 COMMENT 'معدل العمولة',
  `total_profit` decimal(15,2) NOT NULL DEFAULT 0.00 COMMENT 'إجمالي الربح',
  `can_add_markup` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'صلاحية إضافة نسبة ربح',
  `can_add_balance` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'صلاحية إضافة رصيد للمستخدمين',
  `max_markup_percentage` decimal(5,2) NOT NULL DEFAULT 50.00 COMMENT 'أقصى نسبة ربح مسموحة',
  `is_active` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'حالة النشاط',
  `auto_approve_orders` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'الموافقة التلقائية على الطلبات',
  `allowed_games` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'الألعاب المسموحة للريسيلر',
  `approved_at` timestamp NULL DEFAULT NULL COMMENT 'تاريخ الموافقة',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_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
(10, 'super admin', 'admin', '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(14, 'devplep', 'admin', '2026-01-31 01:48:18', '2026-01-31 01:48:18'),
(18, 'مصمم الصور', 'admin', '2026-03-11 23:03:18', '2026-03-11 23:03:18');

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

--
-- 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
(185, 10),
(186, 10),
(187, 10),
(188, 10),
(189, 10),
(190, 10),
(191, 10),
(192, 10),
(193, 10),
(194, 10),
(195, 10),
(196, 10),
(197, 10),
(198, 10),
(199, 10),
(200, 10),
(201, 10),
(202, 10),
(203, 10),
(204, 10),
(205, 10),
(206, 10),
(207, 10),
(208, 10),
(209, 10),
(210, 10),
(211, 10),
(212, 10),
(213, 10),
(214, 10),
(215, 10),
(216, 10),
(217, 10),
(218, 10),
(219, 10),
(220, 10),
(221, 10),
(222, 10),
(223, 10),
(224, 10),
(225, 10),
(226, 10),
(227, 10),
(228, 10),
(229, 10),
(230, 10),
(231, 10),
(232, 10),
(233, 10),
(234, 10),
(235, 10),
(236, 10),
(237, 10),
(238, 10),
(239, 10),
(240, 10),
(241, 10),
(242, 10),
(243, 10),
(244, 10),
(245, 10),
(246, 10),
(247, 10),
(248, 10),
(249, 10),
(250, 10),
(251, 10),
(252, 10),
(253, 10),
(254, 10),
(255, 10),
(256, 10),
(257, 10),
(258, 10),
(259, 10),
(260, 10),
(261, 10),
(262, 10),
(263, 10),
(264, 10),
(265, 10),
(266, 10),
(267, 10),
(268, 10),
(269, 10),
(270, 10),
(271, 10),
(272, 10),
(273, 10),
(274, 10),
(275, 10),
(276, 10),
(277, 10),
(278, 10),
(279, 10),
(280, 10),
(281, 10),
(282, 10),
(283, 10),
(284, 10),
(285, 10),
(286, 10),
(287, 10),
(288, 10),
(289, 10),
(290, 10),
(291, 10),
(292, 10),
(293, 10),
(294, 10),
(295, 10),
(296, 10),
(297, 10),
(298, 10),
(299, 10),
(300, 10),
(301, 10),
(302, 10),
(303, 10),
(304, 10),
(305, 10),
(306, 10),
(307, 10),
(308, 10),
(309, 10),
(310, 10),
(311, 10),
(312, 10),
(313, 10),
(314, 10),
(315, 10),
(316, 10),
(317, 10),
(318, 10),
(319, 10),
(320, 10),
(321, 10),
(322, 10),
(323, 10),
(324, 10),
(325, 10),
(326, 10),
(327, 10),
(328, 10),
(329, 10),
(330, 10),
(331, 10),
(332, 10),
(333, 10),
(334, 10),
(335, 10),
(336, 10),
(337, 10),
(338, 10),
(339, 10),
(340, 10),
(341, 10),
(342, 10),
(343, 10),
(344, 10),
(345, 10),
(346, 10),
(347, 10),
(348, 10),
(349, 10),
(350, 10),
(351, 10),
(352, 10),
(353, 10),
(354, 10),
(355, 10),
(356, 10),
(357, 10),
(358, 10),
(359, 10),
(360, 10),
(361, 10),
(362, 10),
(363, 10),
(364, 10),
(365, 10),
(366, 10),
(367, 10),
(368, 10),
(299, 14),
(300, 14),
(301, 14),
(302, 14),
(303, 14),
(304, 14),
(305, 14),
(306, 14),
(361, 14),
(362, 14),
(363, 14),
(322, 18),
(326, 18),
(369, 18),
(438, 18),
(439, 18);

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

--
-- Table structure for table `scheduled_notifications`
--

CREATE TABLE `scheduled_notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('info','warning','error') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'info',
  `is_required` tinyint(1) NOT NULL DEFAULT 0,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Additional data payload',
  `recipient_type` enum('user','vendor','all_users','all_vendors','custom') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'user',
  `recipient_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Specific user/vendor ID if not broadcast',
  `recipient_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Array of IDs for custom targeting',
  `vendor_app_id` bigint(20) UNSIGNED DEFAULT NULL,
  `channels` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Channels to use: ["database","broadcast","firebase"]',
  `send_email` tinyint(1) NOT NULL DEFAULT 0,
  `scheduled_at` timestamp NOT NULL,
  `status` enum('pending','processing','sent','failed','cancelled') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `sent_at` timestamp NULL DEFAULT NULL,
  `recipients_count` int(11) NOT NULL DEFAULT 0,
  `sent_count` int(11) NOT NULL DEFAULT 0,
  `failed_count` int(11) NOT NULL DEFAULT 0,
  `campaign_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'Admin user who created this',
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `service_toggles`
--

CREATE TABLE `service_toggles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `service_key` varchar(255) NOT NULL,
  `display_name_ar` varchar(255) NOT NULL,
  `display_name_en` varchar(255) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `maintenance_message_ar` text DEFAULT NULL,
  `maintenance_message_en` text DEFAULT NULL,
  `toggled_by` bigint(20) UNSIGNED DEFAULT NULL,
  `toggled_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 `service_toggles`
--

INSERT INTO `service_toggles` (`id`, `service_key`, `display_name_ar`, `display_name_en`, `is_active`, `maintenance_message_ar`, `maintenance_message_en`, `toggled_by`, `toggled_at`, `created_at`, `updated_at`) VALUES
(7, 'orders', 'الطلبات', 'Orders', 1, 'خدمة الطلبات متوقفة مؤقتاً للصيانة. يرجى المحاولة لاحقاً.', 'Orders service is temporarily unavailable for maintenance. Please try again later.', NULL, NULL, '2026-03-26 00:26:35', '2026-03-26 00:26:35'),
(8, 'balance_transfer', 'تحويل الرصيد', 'Balance Transfer', 1, 'خدمة تحويل الرصيد متوقفة مؤقتاً للصيانة. يرجى المحاولة لاحقاً.', 'Balance transfer service is temporarily unavailable for maintenance. Please try again later.', NULL, NULL, '2026-03-26 00:26:35', '2026-03-26 00:26:35'),
(9, 'balance_request', 'طلب رصيد', 'Balance Request', 1, 'خدمة طلب الرصيد متوقفة مؤقتاً للصيانة. يرجى المحاولة لاحقاً.', 'Balance request service is temporarily unavailable for maintenance. Please try again later.', NULL, NULL, '2026-03-26 00:26:35', '2026-03-26 00:26:35'),
(10, 'payments', 'المدفوعات', 'Payments', 1, 'خدمة المدفوعات متوقفة مؤقتاً للصيانة. يرجى المحاولة لاحقاً.', 'Payments service is temporarily unavailable for maintenance. Please try again later.', NULL, NULL, '2026-03-26 00:26:35', '2026-03-26 00:26:35'),
(11, 'registration', 'التسجيل', 'Registration', 1, 'خدمة التسجيل متوقفة مؤقتاً للصيانة. يرجى المحاولة لاحقاً.', 'Registration service is temporarily unavailable for maintenance. Please try again later.', NULL, NULL, '2026-03-26 00:26:35', '2026-03-26 00:26:35'),
(12, 'credit_requests', 'طلبات الشحن', 'Credit Requests', 1, 'خدمة طلبات الشحن متوقفة مؤقتاً للصيانة. يرجى المحاولة لاحقاً.', 'Credit requests service is temporarily unavailable for maintenance. Please try again later.', NULL, NULL, '2026-03-26 00:26:35', '2026-03-26 00:26:35');

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

--
-- 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` text NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `whats_app` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'رقم الواتساب للموقع',
  `game_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'معرفات الألعاب المتاحة',
  `product_ids` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'معرفات المنتجات المتاحة',
  `telegram` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'رابط التليجرام للموقع',
  `terms_content` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `verification_guidelines` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'إرشادات التوثيق للمستخدمين'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` (`id`, `whats_app`, `game_ids`, `product_ids`, `telegram`, `terms_content`, `created_at`, `updated_at`, `verification_guidelines`) VALUES
(1, '', '\"[]\"', '\"[]\"', '', '', '2026-03-12 22:21:15', '2026-03-12 22:21:15', '');

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

--
-- Table structure for table `sync_prices`
--

CREATE TABLE `sync_prices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `internal_id` bigint(20) UNSIGNED NOT NULL,
  `external_site_id` bigint(20) UNSIGNED NOT NULL,
  `external_id` varchar(255) NOT NULL,
  `external_name` varchar(255) DEFAULT NULL,
  `external_price` decimal(30,20) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `is_sync_status` tinyint(1) NOT NULL DEFAULT 0,
  `type` enum('price_only','execution_only','price_and_execution') NOT NULL,
  `count` int(11) 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;

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

--
-- Table structure for table `syriatel_sms_messages`
--

CREATE TABLE `syriatel_sms_messages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `operation_number` varchar(255) NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `message` text DEFAULT NULL,
  `processed` tinyint(1) NOT NULL DEFAULT 0,
  `credit_request_id` bigint(20) UNSIGNED 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 `taxs`
--

CREATE TABLE `taxs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `percent` decimal(10,5) 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 `trackorders`
--

CREATE TABLE `trackorders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `order_id` bigint(20) UNSIGNED NOT NULL,
  `orignalPrice` decimal(20,5) NOT NULL,
  `profitRate` decimal(20,5) 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 `transactions`
--

CREATE TABLE `transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'معرف البائع (vendor)',
  `order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `type` enum('order','charge','withdrawal','transfer','refund') NOT NULL DEFAULT 'order' COMMENT 'نوع العملية',
  `balance_before` decimal(25,12) NOT NULL COMMENT 'الرصيد قبل العملية',
  `balance_after` decimal(25,12) NOT NULL COMMENT 'الرصيد بعد العملية',
  `basic_price` decimal(25,12) DEFAULT NULL COMMENT 'السعر الأساسي',
  `sell_price` decimal(25,12) DEFAULT NULL COMMENT 'سعر البيع للعملة',
  `purchase_price` decimal(25,12) DEFAULT NULL COMMENT 'سعر الشراء للعملة',
  `currency_id` bigint(20) UNSIGNED DEFAULT NULL,
  `price_after_rate` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد تطبيق نسبة الربح',
  `vendor_percent` decimal(25,12) NOT NULL DEFAULT 0.000000000000 COMMENT 'نسبة البائع',
  `price_after_user_tax` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد ضريبة المستخدم',
  `price_after_game_tax` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد ضريبة اللعبة',
  `price_after_product_tax` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد ضريبة المنتج',
  `price_after_user_discount` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد خصم المستخدم',
  `price_after_game_discount` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد خصم اللعبة',
  `price_after_product_discount` decimal(25,12) DEFAULT NULL COMMENT 'السعر بعد خصم المنتج',
  `final_price` decimal(25,12) DEFAULT NULL COMMENT 'السعر النهائي',
  `total_price` decimal(25,12) DEFAULT NULL COMMENT 'السعر الإجمالي',
  `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 `updates`
--

CREATE TABLE `updates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` enum('update','suggestion','bug_fix','feature','improvement') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'update',
  `priority` enum('low','medium','high','urgent') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'medium',
  `status` enum('pending','in_progress','completed','cancelled','on_hold') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
  `assigned_to` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `due_date` date DEFAULT NULL,
  `notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `tags` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `backup_email` varchar(255) DEFAULT NULL,
  `referral_code` varchar(16) DEFAULT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `balance` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `old_balance` decimal(20,5) DEFAULT NULL,
  `min_balance` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `old_min_balance` decimal(20,5) DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'يشير إلى Vendor إذا كان تابع له',
  `is_vendor` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'هل هو Vendor؟',
  `isApi` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'dynamic',
  `is_verified` tinyint(1) NOT NULL DEFAULT 0,
  `is_code_banned` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'حظر إرسال أكواد التحقق عبر البريد',
  `mobile` varchar(255) DEFAULT NULL,
  `whatsapp` varchar(20) DEFAULT NULL,
  `telegram` varchar(100) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `style` tinyint(4) DEFAULT NULL,
  `currency_id` bigint(20) UNSIGNED NOT NULL COMMENT 'يشير إلى العملة المستخدمة',
  `api_token` varchar(80) DEFAULT NULL,
  `webhook_url` varchar(250) DEFAULT NULL,
  `login_method` varchar(255) DEFAULT NULL,
  `mobil2fa` varchar(255) DEFAULT NULL,
  `google2fa_secret` text DEFAULT NULL,
  `pin_code` varchar(255) DEFAULT NULL,
  `canRequestBalance` tinyint(1) NOT NULL DEFAULT 0,
  `canTransferBalance` tinyint(1) NOT NULL DEFAULT 0,
  `profit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `profit_rate` enum('one','two','three','four','five','six','seven') NOT NULL DEFAULT 'seven' COMMENT 'معدل الربح المستخدم',
  `transfer_rate` decimal(5,2) DEFAULT NULL,
  `store` varchar(255) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT 1,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `redenomination_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `google2fa_enabled` tinyint(1) NOT NULL DEFAULT 0,
  `google2fa_enabled_at` timestamp NULL DEFAULT NULL,
  `biometric_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'هل مفعل التحقق بالبصمة',
  `biometric_public_key` text DEFAULT NULL COMMENT 'المفتاح العام للبصمة',
  `biometric_verified_at` timestamp NULL DEFAULT NULL COMMENT 'وقت آخر تحقق بالبصمة',
  `terms_accepted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `name`, `email`, `backup_email`, `referral_code`, `email_verified_at`, `password`, `balance`, `old_balance`, `min_balance`, `old_min_balance`, `vendor_id`, `is_vendor`, `isApi`, `is_verified`, `is_code_banned`, `mobile`, `whatsapp`, `telegram`, `image`, `style`, `currency_id`, `api_token`, `webhook_url`, `login_method`, `mobil2fa`, `google2fa_secret`, `pin_code`, `canRequestBalance`, `canTransferBalance`, `profit_id`, `profit_rate`, `transfer_rate`, `store`, `isActive`, `remember_token`, `created_at`, `updated_at`, `redenomination_at`, `deleted_at`, `google2fa_enabled`, `google2fa_enabled_at`, `biometric_enabled`, `biometric_public_key`, `biometric_verified_at`, `terms_accepted_at`) VALUES
(3, 'sw', 'aaa15107@gmail.com', NULL, NULL, NULL, '$2y$10$bP/0VdiZPcgzX4AdRVQ51ulz.NuEoqACn.EZxFm0oaw2FdHVRyxRK', 7.00000, NULL, 0.00000, NULL, NULL, 1, 1, 0, 0, '0109205774', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, '$2y$10$oU1vvhHQjUGOnyJBB6KC2.TL4hwYah7DbTLnpWCkHkodZrVZWUD9i', 1, 1, NULL, 'one', 0.00, 'a', 1, NULL, '2026-02-11 15:38:28', '2026-03-14 00:28:23', NULL, NULL, 0, NULL, 0, NULL, NULL, '2026-02-23 18:18:56'),
(4, 'adawe2', 'adawe2@m.com', NULL, NULL, NULL, '$2y$10$6K0rJoKUhSElqmkWHxgrW.G84eG6mfuIN72iLtF7YJnCRRj5P4hFi', 0.00000, NULL, 0.00000, NULL, NULL, 1, 1, 0, 0, '0101011', NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 'one', 0.00, '1010', 1, NULL, '2026-02-11 15:38:43', '2026-02-11 15:39:17', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
(5, 'adawe', 'adawe@mega.com', NULL, NULL, NULL, '$2y$10$lvdetUeDAFI2twtKVOGx1eh9fwTMSF2yohhwMq/1caiU.CmkHExDu', 0.00000, NULL, 0.00000, NULL, 86, 0, 1, 0, 0, '7010427078ff', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, 'seven', NULL, NULL, 1, NULL, '2026-02-12 02:00:01', '2026-02-12 02:00:01', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
(6, 'khaliltest', 'khalilalhraky@gmail.com', NULL, NULL, '2026-02-16 21:12:51', '$2y$10$VShOMBPnwPFxmbCbNIB9qOzVwJfdkg./jIycoAQxXFUiGSHR0R8HK', 10900.00000, NULL, 0.00000, NULL, 87, 0, 1, 0, 0, '0965383583', NULL, NULL, 'users/6/avatar/khaliltest-e353d981-75fb-4bfc-ad52-9571ae8a39f5.jpg', 3, 2, NULL, NULL, NULL, NULL, NULL, '$2y$10$kGpaCKZZ0gaDsrK9GQwUdeTjXlInPF5IvkrZA8eUicqBIb1SWGAoW', 0, 1, NULL, 'seven', NULL, 'test', 1, NULL, '2026-02-12 02:21:32', '2026-03-17 05:59:07', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
(7, 'ANAS ALHLABI', 'anasns122@hotmail.com', NULL, NULL, NULL, '$2y$10$Fbxt/Nk7iN89why1a6DQ9OHkZdvncJbgFGTacoQHHqOCu45XAb8UO', 0.00000, NULL, 0.00000, NULL, NULL, 0, 1, 0, 0, '2263094818', NULL, NULL, NULL, 2, 2, NULL, NULL, NULL, NULL, NULL, '$2y$10$1Po/m4v/X7/f0gnuwHa7CeBSdc3sOXmwhalPhUWqrszcCongmWOFy', 1, 1, NULL, 'one', 0.00, 'mega', 1, NULL, '2026-02-17 22:20:56', '2026-03-25 16:36:52', NULL, NULL, 0, NULL, 0, NULL, NULL, '2026-02-17 22:22:52'),
(8, 'فواتيري', 'Alnooor.tel24@gmail.com', NULL, NULL, NULL, '$2y$10$O2bSd5XyOvRMMr2HlXaU4.pVq/651nk3DW7vm5Fx3tLHdMXhaQMje', 0.00000, NULL, 0.00000, NULL, NULL, 1, 1, 0, 0, '094040080', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, '$2y$10$omqAYrMBTXt1oKfEiK/AU.G5ogWXg.zRJ3rmmwYeHZNx7PWEGcPt6', 0, 0, NULL, 'one', 0.00, 'فواتيري تطبيق', 1, NULL, '2026-02-23 18:13:35', '2026-02-23 18:25:35', NULL, NULL, 0, NULL, 0, NULL, NULL, '2026-02-23 18:23:43'),
(9, 'test', 'test@test.com', NULL, NULL, NULL, '$2y$10$c2P8yoPlwDq2eao4TggZc.RCpEDcielRxRfJ22MB7xLSNxJyF84wi', 3.00000, NULL, 0.00000, NULL, 86, 0, 1, 0, 0, '095475743421', NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, NULL, 'seven', NULL, NULL, 1, NULL, '2026-03-08 21:47:02', '2026-03-25 23:13:50', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
(10, 'Test1', 'Test1@test.com', NULL, NULL, NULL, '$2y$10$LXTGIQBwQy8lrEW6cwDvE.8lCYwo3RYVsOvFqDVVjh/A1BdsCPnk6', 0.00000, NULL, 0.00000, NULL, 87, 0, 1, 0, 0, '09658787878', NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, 'seven', NULL, NULL, 1, NULL, '2026-03-13 21:28:06', '2026-03-13 21:28:06', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
(11, 'يوسف', 'mega0osta@gmail.com', NULL, NULL, NULL, '$2y$10$OOFwJ9VOBxiCT4ZBm0o2SukEDB5FT2ym7LBrgnpRbEJ1JYQ46veay', 0.00000, NULL, 0.00000, NULL, NULL, 0, 1, 0, 0, '0982981056', NULL, NULL, NULL, 3, 2, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, 'one', 0.00, 'مصمم', 1, NULL, '2026-03-25 19:25:42', '2026-03-25 19:39:30', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
(12, 'khlel', 'khlel@gmail.com', NULL, NULL, NULL, '$2y$10$2ARoPn13HcnSCzY5DTaGBedqg3aHSUaSF/bUplOZaaJBTP0wJj4Rm', 100.00000, NULL, 0.00000, NULL, 87, 0, 1, 0, 0, '0957853421', NULL, NULL, NULL, 3, 2, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, 'seven', NULL, NULL, 1, NULL, '2026-03-26 19:44:18', '2026-03-26 20:01:25', NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);

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

--
-- Table structure for table `usertype`
--

CREATE TABLE `usertype` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `profitRate` decimal(20,5) NOT NULL DEFAULT 0.00000,
  `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 `user_game_players`
--

CREATE TABLE `user_game_players` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED NOT NULL,
  `gamer_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `gamer_data_hash` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_logs`
--

CREATE TABLE `user_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `loggable_type` varchar(255) DEFAULT NULL,
  `loggable_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `session_id` varchar(100) NOT NULL,
  `personal_access_token_id` bigint(20) UNSIGNED DEFAULT NULL,
  `device_type` varchar(255) NOT NULL DEFAULT 'web',
  `device_name` varchar(255) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `browser` varchar(255) DEFAULT NULL,
  `browser_version` varchar(255) DEFAULT NULL,
  `operating_system` varchar(255) DEFAULT NULL,
  `os_version` varchar(255) DEFAULT NULL,
  `ip_address` varchar(45) NOT NULL,
  `country` varchar(255) DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `region` varchar(255) DEFAULT NULL,
  `latitude` decimal(10,8) DEFAULT NULL,
  `longitude` decimal(11,8) DEFAULT NULL,
  `login_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `logout_at` timestamp NULL DEFAULT NULL,
  `last_activity_at` timestamp NULL DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `force_logout` tinyint(1) NOT NULL DEFAULT 0,
  `logout_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 `user_notification_preferences`
--

CREATE TABLE `user_notification_preferences` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `email_enabled` tinyint(1) NOT NULL DEFAULT 1,
  `push_enabled` tinyint(1) NOT NULL DEFAULT 1,
  `sms_enabled` tinyint(1) NOT NULL DEFAULT 0,
  `enabled_types` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'Array of notification types user wants to receive',
  `preferred_start_time` time DEFAULT '08:00:00',
  `preferred_end_time` time DEFAULT '22:00:00',
  `respect_quiet_hours` tinyint(1) NOT NULL DEFAULT 0,
  `language` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ar',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_order_summaries`
--

CREATE TABLE `user_order_summaries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `currency_id` bigint(20) UNSIGNED DEFAULT NULL,
  `total_price` decimal(30,10) NOT NULL DEFAULT 0.0000000000,
  `total_points` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `last_order_id` bigint(20) UNSIGNED 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;

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

--
-- Table structure for table `vendorpercents`
--

CREATE TABLE `vendorpercents` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `percent` decimal(10,5) 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 `vendors`
--

CREATE TABLE `vendors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `canDisable` tinyint(1) NOT NULL DEFAULT 0,
  `canAdduser` tinyint(1) NOT NULL DEFAULT 0,
  `canPostAds` tinyint(1) NOT NULL DEFAULT 0,
  `support_link` text DEFAULT NULL,
  `manage_link` text DEFAULT NULL,
  `vendor_app_id` int(11) 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 `vendors_settings`
--

CREATE TABLE `vendors_settings` (
  `id` int(11) NOT NULL,
  `version` int(11) NOT NULL,
  `app_num` varchar(10) NOT NULL,
  `token` varchar(100) NOT NULL,
  `vendor_id` int(11) NOT NULL,
  `currency_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `vendor_apps`
--

CREATE TABLE `vendor_apps` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `appToken` varchar(255) NOT NULL,
  `appName` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `app_logo` varchar(255) DEFAULT NULL COMMENT 'Path to app logo for web/email',
  `app_icon` varchar(255) DEFAULT NULL COMMENT 'Path to app icon for web',
  `notification_icon` varchar(255) DEFAULT NULL COMMENT 'Path to notification icon for mobile push',
  `app_color` varchar(7) NOT NULL DEFAULT '#3b82f6' COMMENT 'Primary color in hex format',
  `deep_link_scheme` varchar(255) DEFAULT NULL COMMENT 'Deep link scheme (e.g., vendorapp1://)',
  `firebase_server_key` text DEFAULT NULL COMMENT 'Firebase config (server_key, sender_id, app_id, package_name/bundle_id) - encrypted JSON',
  `manage_link` varchar(250) DEFAULT NULL,
  `support_link` varchar(250) 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 `vendor_apps`
--

INSERT INTO `vendor_apps` (`id`, `appToken`, `appName`, `description`, `app_logo`, `app_icon`, `notification_icon`, `app_color`, `deep_link_scheme`, `firebase_server_key`, `manage_link`, `support_link`, `created_at`, `updated_at`) VALUES
(23, 'fcc5ca60b6b46296052a8c3bc99d834c', 'mega', 'التطبيق الاساسي', NULL, NULL, NULL, '#3b82f6', NULL, NULL, 'https://node.mega-game.net/admin/vendor-apps/create', 'https://node.mega-game.net/admin/vendor-apps/create', '2026-02-11 15:24:03', '2026-02-11 15:24:03');

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

--
-- Table structure for table `vendor_app_versions`
--

CREATE TABLE `vendor_app_versions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_app_id` bigint(20) UNSIGNED NOT NULL,
  `version` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `isMandatory` tinyint(1) NOT NULL DEFAULT 0,
  `changelog` text 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 `vendor_app_versions`
--

INSERT INTO `vendor_app_versions` (`id`, `vendor_app_id`, `version`, `url`, `isMandatory`, `changelog`, `created_at`, `updated_at`) VALUES
(4, 23, '1.0', 'https://node.mega-game.net/admin/vendor-apps/23/versions/create', 0, '1.01.01.0', '2026-02-11 15:24:50', '2026-02-11 15:24:50');

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

--
-- Table structure for table `vendor_blocked_charge_methods`
--

CREATE TABLE `vendor_blocked_charge_methods` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `charge_method_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;

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

--
-- Table structure for table `vendor_images`
--

CREATE TABLE `vendor_images` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `game_id` bigint(20) UNSIGNED NOT NULL,
  `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 `virtual_cards`
--

CREATE TABLE `virtual_cards` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` char(36) NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `external_id` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `balance` decimal(10,2) NOT NULL DEFAULT 0.00,
  `status` enum('active','frozen','terminated') NOT NULL DEFAULT 'active',
  `card_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`card_data`)),
  `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 `websockets_statistics_entries`
--

CREATE TABLE `websockets_statistics_entries` (
  `id` int(10) UNSIGNED NOT NULL,
  `app_id` varchar(255) NOT NULL,
  `peak_connection_count` int(11) NOT NULL,
  `websocket_message_count` int(11) NOT NULL,
  `api_message_count` 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 `whitelist_ips`
--

CREATE TABLE `whitelist_ips` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` 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;

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `admin_game_product_permissions`
--
ALTER TABLE `admin_game_product_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `admin_game_product_unique` (`admin_id`,`game_id`,`product_id`),
  ADD KEY `admin_game_product_permissions_game_id_foreign` (`game_id`),
  ADD KEY `admin_game_product_permissions_product_id_foreign` (`product_id`),
  ADD KEY `admin_game_product_permissions_admin_id_game_id_index` (`admin_id`,`game_id`),
  ADD KEY `admin_game_product_permissions_admin_id_product_id_index` (`admin_id`,`product_id`),
  ADD KEY `admin_game_product_permissions_admin_id_permission_type_index` (`admin_id`,`permission_type`);

--
-- Indexes for table `ad_images`
--
ALTER TABLE `ad_images`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ad_images_sort_index` (`sort`),
  ADD KEY `ad_images_is_active_index` (`is_active`),
  ADD KEY `ad_images_vendor_id_foreign` (`vendor_id`),
  ADD KEY `ad_images_category_id_foreign` (`category_id`);

--
-- Indexes for table `agents`
--
ALTER TABLE `agents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `agents_status_isactive_index` (`status`,`isactive`),
  ADD KEY `agents_name_index` (`name`),
  ADD KEY `agents_phone_index` (`phone`);

--
-- Indexes for table `api_configs`
--
ALTER TABLE `api_configs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `api_configs_key_unique` (`key`);

--
-- Indexes for table `bans`
--
ALTER TABLE `bans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `bans_game_id_foreign` (`game_id`),
  ADD KEY `bans_product_id_foreign` (`product_id`),
  ADD KEY `bans_user_id_foreign` (`user_id`);

--
-- Indexes for table `blocked_external_ids`
--
ALTER TABLE `blocked_external_ids`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `blocked_external_ids_player_id_unique` (`player_id`),
  ADD KEY `blocked_external_ids_admin_id_index` (`admin_id`);

--
-- Indexes for table `card_operations`
--
ALTER TABLE `card_operations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_card_operations_virtual_card_id` (`virtual_card_id`),
  ADD KEY `idx_card_operations_user_id` (`user_id`),
  ADD KEY `idx_card_operations_order_id` (`order_id`),
  ADD KEY `idx_card_operations_operation_type` (`operation_type`);

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

--
-- Indexes for table `charge_methods`
--
ALTER TABLE `charge_methods`
  ADD PRIMARY KEY (`id`),
  ADD KEY `charge_methods_currency_id_foreign` (`currency_id`);

--
-- Indexes for table `charge_method_attachments`
--
ALTER TABLE `charge_method_attachments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `charge_method_attachments_charge_method_id_order_index` (`charge_method_id`,`order`),
  ADD KEY `charge_method_attachments_charge_method_id_is_active_index` (`charge_method_id`,`is_active`);

--
-- Indexes for table `chat_messages`
--
ALTER TABLE `chat_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `chat_messages_user_id_created_at_index` (`user_id`,`created_at`),
  ADD KEY `chat_messages_ticket_id_index` (`ticket_id`);

--
-- Indexes for table `chat_message_attachments`
--
ALTER TABLE `chat_message_attachments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `chat_message_attachments_chat_message_id_index` (`chat_message_id`);

--
-- Indexes for table `chat_tickets`
--
ALTER TABLE `chat_tickets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `chat_tickets_user_id_status_index` (`user_id`,`status`);

--
-- Indexes for table `codes`
--
ALTER TABLE `codes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `codes_code_unique` (`code`),
  ADD KEY `codes_code_index` (`code`),
  ADD KEY `codes_groub_id_index` (`groub_id`),
  ADD KEY `codes_status_index` (`status`),
  ADD KEY `codes_groub_id_status_index` (`groub_id`,`status`),
  ADD KEY `id` (`id`,`groub_id`);

--
-- Indexes for table `complaints`
--
ALTER TABLE `complaints`
  ADD PRIMARY KEY (`id`),
  ADD KEY `complaints_admin_id_foreign` (`admin_id`),
  ADD KEY `complaints_user_id_status_index` (`user_id`,`status`),
  ADD KEY `complaints_type_status_index` (`type`,`status`);

--
-- Indexes for table `credit_requests`
--
ALTER TABLE `credit_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `credit_requests_user_id_foreign` (`user_id`),
  ADD KEY `credit_requests_updated_by_foreign` (`updated_by`),
  ADD KEY `credit_requests_method_id_foreign` (`method_id`),
  ADD KEY `credit_requests_payment_id_foreign` (`payment_id`),
  ADD KEY `credit_requests_currency_id_foreign` (`currency_id`);

--
-- Indexes for table `crypto_deposit_addresses`
--
ALTER TABLE `crypto_deposit_addresses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `crypto_deposit_addresses_address_unique` (`address`),
  ADD KEY `crypto_deposit_addresses_user_id_network_symbol_index` (`user_id`,`network`,`symbol`);

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

--
-- Indexes for table `daily_export_reports`
--
ALTER TABLE `daily_export_reports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `daily_export_reports_report_date_unique` (`report_date`),
  ADD KEY `daily_export_reports_status_index` (`status`),
  ADD KEY `daily_export_reports_created_at_index` (`created_at`);

--
-- Indexes for table `device_tokens`
--
ALTER TABLE `device_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `device_tokens_token_unique` (`token`),
  ADD KEY `device_tokens_user_type_user_id_index` (`user_type`,`user_id`),
  ADD KEY `device_tokens_user_id_user_type_index` (`user_id`,`user_type`),
  ADD KEY `device_tokens_last_used_at_index` (`last_used_at`);

--
-- Indexes for table `discounts`
--
ALTER TABLE `discounts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `discounts_user_id_foreign` (`user_id`),
  ADD KEY `discounts_game_id_foreign` (`game_id`),
  ADD KEY `discounts_product_id_foreign` (`product_id`);

--
-- Indexes for table `externalsites`
--
ALTER TABLE `externalsites`
  ADD PRIMARY KEY (`id`),
  ADD KEY `externalsites_is_active_index` (`is_active`);

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

--
-- Indexes for table `features`
--
ALTER TABLE `features`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `features_name_scope_unique` (`name`,`scope`);

--
-- Indexes for table `feature_flags`
--
ALTER TABLE `feature_flags`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `feature_flags_name_unique` (`name`),
  ADD KEY `idx_name` (`name`),
  ADD KEY `idx_is_active` (`is_active`);

--
-- Indexes for table `feature_flag_logs`
--
ALTER TABLE `feature_flag_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `feature_flag_logs_admin_id_foreign` (`admin_id`),
  ADD KEY `idx_feature_flag_id` (`feature_flag_id`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `games`
--
ALTER TABLE `games`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `games_slug_unique` (`slug`),
  ADD KEY `games_category_id_foreign` (`category_id`),
  ADD KEY `games_currency_id_foreign` (`currency_id`),
  ADD KEY `games_parent_id_foreign` (`parent_id`),
  ADD KEY `games_script_id_foreign` (`script_id`);

--
-- Indexes for table `game_atachments`
--
ALTER TABLE `game_atachments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `game_atachments_game_id_foreign` (`game_id`);

--
-- Indexes for table `groubcodes`
--
ALTER TABLE `groubcodes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `groubcodes_name_unique` (`name`),
  ADD KEY `groubcodes_name_index` (`name`);

--
-- Indexes for table `identity_verifications`
--
ALTER TABLE `identity_verifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `identity_verifications_reviewed_by_foreign` (`reviewed_by`),
  ADD KEY `identity_verifications_user_id_status_index` (`user_id`,`status`);

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

--
-- Indexes for table `levels`
--
ALTER TABLE `levels`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `levels_key_unique` (`key`),
  ADD UNIQUE KEY `levels_tier_order_unique` (`tier_order`),
  ADD KEY `levels_required_points_index` (`required_points`);

--
-- Indexes for table `merchants`
--
ALTER TABLE `merchants`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `merchants_email_unique` (`email`),
  ADD UNIQUE KEY `merchants_api_key_unique` (`api_key`),
  ADD KEY `merchants_verified_by_foreign` (`verified_by`);

--
-- 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 `idx_recipient` (`recipient_id`,`recipient_type`),
  ADD KEY `idx_sender` (`sender_type`,`sender_id`),
  ADD KEY `idx_unread` (`recipient_id`,`is_read`),
  ADD KEY `idx_required` (`recipient_id`,`is_required`,`is_read`),
  ADD KEY `idx_created_at` (`created_at`),
  ADD KEY `idx_type_created` (`type`,`created_at`),
  ADD KEY `idx_vendor_app` (`vendor_app_id`),
  ADD KEY `idx_recipient_app` (`recipient_id`,`vendor_app_id`);

--
-- Indexes for table `notification_analytics`
--
ALTER TABLE `notification_analytics`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notification_analytics_notification_id_index` (`notification_id`),
  ADD KEY `notification_analytics_user_id_index` (`user_id`),
  ADD KEY `notification_analytics_vendor_app_id_index` (`vendor_app_id`),
  ADD KEY `notification_analytics_channel_index` (`channel`),
  ADD KEY `notification_analytics_opened_at_index` (`opened_at`),
  ADD KEY `notification_analytics_clicked_at_index` (`clicked_at`),
  ADD KEY `notification_analytics_user_id_opened_at_index` (`user_id`,`opened_at`),
  ADD KEY `notification_analytics_vendor_app_id_channel_index` (`vendor_app_id`,`channel`);

--
-- Indexes for table `notification_email_logs`
--
ALTER TABLE `notification_email_logs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `notification_email_logs_tracking_id_unique` (`tracking_id`),
  ADD KEY `notification_email_logs_notification_id_index` (`notification_id`),
  ADD KEY `notification_email_logs_user_id_index` (`user_id`),
  ADD KEY `notification_email_logs_status_index` (`status`),
  ADD KEY `notification_email_logs_tracking_id_index` (`tracking_id`),
  ADD KEY `notification_email_logs_sent_at_index` (`sent_at`),
  ADD KEY `notification_email_logs_status_retry_count_index` (`status`,`retry_count`);

--
-- Indexes for table `operations`
--
ALTER TABLE `operations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `operations_status_index` (`status`),
  ADD KEY `operations_user_id_index` (`user_id`),
  ADD KEY `operations_game_id_index` (`game_id`),
  ADD KEY `operations_product_id_index` (`product_id`),
  ADD KEY `operations_order_id_index` (`order_id`),
  ADD KEY `operations_created_at_index` (`created_at`),
  ADD KEY `operations_status_created_at_index` (`status`,`created_at`),
  ADD KEY `operations_user_status_index` (`user_id`,`status`),
  ADD KEY `operations_external_order_id_index` (`externalOrder_id`),
  ADD KEY `operations_game_status_created_at_index` (`game_id`,`status`,`created_at`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `orders_uuid_unique` (`uuid`),
  ADD KEY `orders_user_id_foreign` (`user_id`),
  ADD KEY `orders_game_id_foreign` (`game_id`),
  ADD KEY `orders_product_id_foreign` (`product_id`),
  ADD KEY `game_id` (`game_id`,`product_id`,`user_id`),
  ADD KEY `status` (`status`),
  ADD KEY `order_number` (`order_number`),
  ADD KEY `orders_status_product_id_id_index` (`status`,`product_id`,`id`),
  ADD KEY `orders_created_at_game_id_index` (`created_at`,`game_id`),
  ADD KEY `orders_analytics_idx` (`status`,`created_at`),
  ADD KEY `orders_status_product_idx` (`status`,`product_id`,`created_at`),
  ADD KEY `orders_status_game_idx` (`status`,`game_id`,`created_at`),
  ADD KEY `orders_status_user_idx` (`status`,`user_id`,`created_at`);

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

--
-- Indexes for table `order_appeals`
--
ALTER TABLE `order_appeals`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `order_appeals_order_id_unique` (`order_id`),
  ADD KEY `order_appeals_user_id_foreign` (`user_id`),
  ADD KEY `order_appeals_admin_id_foreign` (`admin_id`),
  ADD KEY `order_appeals_status_index` (`status`);

--
-- Indexes for table `order_codes`
--
ALTER TABLE `order_codes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_codes_order_id_index` (`order_id`),
  ADD KEY `order_codes_code_index` (`code`),
  ADD KEY `order_codes_created_at_index` (`created_at`);

--
-- Indexes for table `order_notes`
--
ALTER TABLE `order_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_notes_order_id_type_index` (`order_id`,`type`);

--
-- Indexes for table `order_reports`
--
ALTER TABLE `order_reports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `order_reports_order_id_unique` (`order_id`),
  ADD KEY `order_reports_user_id_index` (`user_id`),
  ADD KEY `order_reports_vendor_id_index` (`vendor_id`),
  ADD KEY `order_reports_game_id_index` (`game_id`),
  ADD KEY `order_reports_product_id_index` (`product_id`),
  ADD KEY `order_reports_status_index` (`status`),
  ADD KEY `order_reports_order_created_at_index` (`order_created_at`),
  ADD KEY `order_reports_report_date_index` (`report_date`);

--
-- Indexes for table `order_response_requests`
--
ALTER TABLE `order_response_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_response_requests_admin_id_foreign` (`admin_id`),
  ADD KEY `order_response_requests_order_id_index` (`order_id`),
  ADD KEY `order_response_requests_status_index` (`status`),
  ADD KEY `order_response_requests_auto_action_at_index` (`auto_action_at`);

--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
  ADD KEY `password_resets_email_index` (`email`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payments_payment_number_unique` (`payment_number`),
  ADD KEY `payments_sender_id_foreign` (`sender_id`),
  ADD KEY `payments_receiver_id_foreign` (`receiver_id`),
  ADD KEY `payments_order_id_foreign` (`order_id`);

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

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

--
-- Indexes for table `popup_ads`
--
ALTER TABLE `popup_ads`
  ADD PRIMARY KEY (`id`),
  ADD KEY `popup_ads_is_active_index` (`is_active`),
  ADD KEY `popup_ads_priority_index` (`priority`);

--
-- Indexes for table `privates`
--
ALTER TABLE `privates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `privates_game_id_foreign` (`game_id`),
  ADD KEY `privates_product_id_foreign` (`product_id`),
  ADD KEY `privates_user_id_foreign` (`user_id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `products_game_id_foreign` (`game_id`),
  ADD KEY `id` (`id`,`isActive`,`game_id`);

--
-- Indexes for table `products_codes`
--
ALTER TABLE `products_codes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `products_codes_product_id_unique` (`product_id`);

--
-- Indexes for table `product_bundle_items`
--
ALTER TABLE `product_bundle_items`
  ADD PRIMARY KEY (`bundle_id`,`item_id`),
  ADD KEY `product_bundle_items_item_id_foreign` (`item_id`);

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

--
-- Indexes for table `promotions`
--
ALTER TABLE `promotions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `promotions_promotable_type_promotable_id_unique` (`promotable_type`,`promotable_id`),
  ADD KEY `promotions_promotable_type_promotable_id_index` (`promotable_type`,`promotable_id`);

--
-- Indexes for table `pulse_aggregates`
--
ALTER TABLE `pulse_aggregates`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `pulse_aggregates_bucket_period_type_aggregate_key_hash_unique` (`bucket`,`period`,`type`,`aggregate`,`key_hash`),
  ADD KEY `pulse_aggregates_period_bucket_index` (`period`,`bucket`),
  ADD KEY `pulse_aggregates_type_index` (`type`),
  ADD KEY `pulse_aggregates_period_type_aggregate_bucket_index` (`period`,`type`,`aggregate`,`bucket`);

--
-- Indexes for table `pulse_entries`
--
ALTER TABLE `pulse_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pulse_entries_timestamp_index` (`timestamp`),
  ADD KEY `pulse_entries_type_index` (`type`),
  ADD KEY `pulse_entries_key_hash_index` (`key_hash`),
  ADD KEY `pulse_entries_timestamp_type_key_hash_value_index` (`timestamp`,`type`,`key_hash`,`value`);

--
-- Indexes for table `pulse_values`
--
ALTER TABLE `pulse_values`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `pulse_values_type_key_hash_unique` (`type`,`key_hash`),
  ADD KEY `pulse_values_timestamp_index` (`timestamp`),
  ADD KEY `pulse_values_type_index` (`type`);

--
-- Indexes for table `referrals`
--
ALTER TABLE `referrals`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `referrals_invitee_id_unique` (`invitee_id`),
  ADD KEY `referrals_vendor_id_foreign` (`vendor_id`),
  ADD KEY `referrals_inviter_id_referral_type_index` (`inviter_id`,`referral_type`),
  ADD KEY `referrals_created_at_index` (`created_at`);

--
-- Indexes for table `resellers`
--
ALTER TABLE `resellers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `resellers_user_id_unique` (`user_id`),
  ADD KEY `resellers_user_id_is_active_index` (`user_id`,`is_active`),
  ADD KEY `resellers_approved_by_foreign` (`approved_by`);

--
-- 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 `scheduled_notifications`
--
ALTER TABLE `scheduled_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `scheduled_notifications_scheduled_at_index` (`scheduled_at`),
  ADD KEY `scheduled_notifications_status_index` (`status`),
  ADD KEY `scheduled_notifications_status_scheduled_at_index` (`status`,`scheduled_at`),
  ADD KEY `scheduled_notifications_vendor_app_id_index` (`vendor_app_id`);

--
-- Indexes for table `service_toggles`
--
ALTER TABLE `service_toggles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `service_toggles_service_key_unique` (`service_key`),
  ADD KEY `service_toggles_toggled_by_foreign` (`toggled_by`),
  ADD KEY `service_toggles_is_active_index` (`is_active`);

--
-- 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 `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `sync_prices`
--
ALTER TABLE `sync_prices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sync_prices_internal_id_foreign` (`internal_id`),
  ADD KEY `sync_prices_external_site_id_foreign` (`external_site_id`);

--
-- Indexes for table `syriatel_sms_messages`
--
ALTER TABLE `syriatel_sms_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `syriatel_sms_messages_operation_number_created_at_index` (`operation_number`,`created_at`),
  ADD KEY `syriatel_sms_messages_processed_created_at_index` (`processed`,`created_at`),
  ADD KEY `syriatel_sms_messages_operation_number_index` (`operation_number`);

--
-- Indexes for table `taxs`
--
ALTER TABLE `taxs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `taxs_user_id_foreign` (`user_id`),
  ADD KEY `taxs_game_id_foreign` (`game_id`),
  ADD KEY `taxs_product_id_foreign` (`product_id`);

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

--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transactions_user_id_created_at_index` (`user_id`,`created_at`),
  ADD KEY `transactions_order_id_index` (`order_id`),
  ADD KEY `transactions_type_created_at_index` (`type`,`created_at`),
  ADD KEY `transactions_currency_id_index` (`currency_id`),
  ADD KEY `vendor_id` (`vendor_id`);

--
-- Indexes for table `updates`
--
ALTER TABLE `updates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `updates_assigned_to_foreign` (`assigned_to`),
  ADD KEY `updates_created_by_foreign` (`created_by`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`),
  ADD UNIQUE KEY `users_api_token_unique` (`api_token`),
  ADD UNIQUE KEY `users_referral_code_unique` (`referral_code`),
  ADD KEY `users_vendor_id_foreign` (`vendor_id`),
  ADD KEY `users_currency_id_foreign` (`currency_id`),
  ADD KEY `vendor_id` (`vendor_id`,`currency_id`,`profit_rate`,`isActive`);

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

--
-- Indexes for table `user_game_players`
--
ALTER TABLE `user_game_players`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_user_game_gamerdata` (`user_id`,`game_id`,`gamer_data_hash`),
  ADD KEY `user_game_players_game_id_foreign` (`game_id`),
  ADD KEY `user_game_players_gamer_data_hash_index` (`gamer_data_hash`);

--
-- Indexes for table `user_logs`
--
ALTER TABLE `user_logs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_logs_session_id_unique` (`session_id`),
  ADD KEY `user_logs_user_id_is_active_index` (`user_id`,`is_active`),
  ADD KEY `user_logs_user_id_login_at_index` (`user_id`,`login_at`),
  ADD KEY `user_logs_session_id_index` (`session_id`),
  ADD KEY `user_logs_loggable_type_loggable_id_index` (`loggable_type`,`loggable_id`),
  ADD KEY `user_logs_personal_access_token_id_index` (`personal_access_token_id`);

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

--
-- Indexes for table `user_order_summaries`
--
ALTER TABLE `user_order_summaries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_order_summaries_user_id_unique` (`user_id`),
  ADD KEY `user_order_summaries_currency_id_index` (`currency_id`),
  ADD KEY `user_order_summaries_last_order_id_index` (`last_order_id`);

--
-- Indexes for table `vendorpercents`
--
ALTER TABLE `vendorpercents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vendorpercents_vendor_id_foreign` (`vendor_id`),
  ADD KEY `vendorpercents_product_id_foreign` (`product_id`);

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

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

--
-- Indexes for table `vendor_apps`
--
ALTER TABLE `vendor_apps`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendor_apps_appToken_unique` (`appToken`);

--
-- Indexes for table `vendor_app_versions`
--
ALTER TABLE `vendor_app_versions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendor_app_versions_vendor_app_id_version_unique` (`vendor_app_id`,`version`),
  ADD KEY `vendor_app_versions_vendor_app_id_index` (`vendor_app_id`);

--
-- Indexes for table `vendor_blocked_charge_methods`
--
ALTER TABLE `vendor_blocked_charge_methods`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendor_charge_method_unique` (`vendor_id`,`charge_method_id`),
  ADD KEY `vendor_blocked_charge_methods_charge_method_id_foreign` (`charge_method_id`);

--
-- Indexes for table `vendor_images`
--
ALTER TABLE `vendor_images`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendor_images_vendor_id_game_id_unique` (`vendor_id`,`game_id`),
  ADD KEY `vendor_images_game_id_foreign` (`game_id`),
  ADD KEY `vendor_images_vendor_id_game_id_index` (`vendor_id`,`game_id`);

--
-- Indexes for table `virtual_cards`
--
ALTER TABLE `virtual_cards`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `virtual_cards_uuid_unique` (`uuid`),
  ADD KEY `idx_virtual_cards_user_id` (`user_id`),
  ADD KEY `idx_virtual_cards_status` (`status`);

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

--
-- Indexes for table `whitelist_ips`
--
ALTER TABLE `whitelist_ips`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `whitelist_ips_ip_address_unique` (`ip_address`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `card_operations`
--
ALTER TABLE `card_operations`
  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 for table `charge_methods`
--
ALTER TABLE `charge_methods`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `orders_uuid`
--
ALTER TABLE `orders_uuid`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1620029;

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

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

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

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

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

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  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=440;

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

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

--
-- AUTO_INCREMENT for table `privates`
--
ALTER TABLE `privates`
  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 for table `products_codes`
--
ALTER TABLE `products_codes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=168;

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `resellers`
--
ALTER TABLE `resellers`
  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=19;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `vendorpercents`
--
ALTER TABLE `vendorpercents`
  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 for table `vendors_settings`
--
ALTER TABLE `vendors_settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

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

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

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

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

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

--
-- AUTO_INCREMENT for table `websockets_statistics_entries`
--
ALTER TABLE `websockets_statistics_entries`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `admin_game_product_permissions`
--
ALTER TABLE `admin_game_product_permissions`
  ADD CONSTRAINT `admin_game_product_permissions_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `admin_game_product_permissions_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `admin_game_product_permissions_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `ad_images`
--
ALTER TABLE `ad_images`
  ADD CONSTRAINT `ad_images_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `ad_images_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `bans`
--
ALTER TABLE `bans`
  ADD CONSTRAINT `bans_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bans_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `bans_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `card_operations`
--
ALTER TABLE `card_operations`
  ADD CONSTRAINT `card_operations_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `card_operations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `card_operations_virtual_card_id_foreign` FOREIGN KEY (`virtual_card_id`) REFERENCES `virtual_cards` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `charge_methods`
--
ALTER TABLE `charge_methods`
  ADD CONSTRAINT `charge_methods_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`);

--
-- Constraints for table `charge_method_attachments`
--
ALTER TABLE `charge_method_attachments`
  ADD CONSTRAINT `charge_method_attachments_charge_method_id_foreign` FOREIGN KEY (`charge_method_id`) REFERENCES `charge_methods` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `codes`
--
ALTER TABLE `codes`
  ADD CONSTRAINT `codes_groub_id_foreign` FOREIGN KEY (`groub_id`) REFERENCES `groubcodes` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `complaints`
--
ALTER TABLE `complaints`
  ADD CONSTRAINT `complaints_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `complaints_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `credit_requests`
--
ALTER TABLE `credit_requests`
  ADD CONSTRAINT `credit_requests_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `credit_requests_method_id_foreign` FOREIGN KEY (`method_id`) REFERENCES `charge_methods` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `credit_requests_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `credit_requests_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `credit_requests_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

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

--
-- Constraints for table `discounts`
--
ALTER TABLE `discounts`
  ADD CONSTRAINT `discounts_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `discounts_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `discounts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `feature_flag_logs`
--
ALTER TABLE `feature_flag_logs`
  ADD CONSTRAINT `feature_flag_logs_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `feature_flag_logs_feature_flag_id_foreign` FOREIGN KEY (`feature_flag_id`) REFERENCES `feature_flags` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `games`
--
ALTER TABLE `games`
  ADD CONSTRAINT `games_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `games_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`),
  ADD CONSTRAINT `games_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `games_script_id_foreign` FOREIGN KEY (`script_id`) REFERENCES `externalsites` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `game_atachments`
--
ALTER TABLE `game_atachments`
  ADD CONSTRAINT `game_atachments_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `identity_verifications`
--
ALTER TABLE `identity_verifications`
  ADD CONSTRAINT `identity_verifications_reviewed_by_foreign` FOREIGN KEY (`reviewed_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `identity_verifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `merchants`
--
ALTER TABLE `merchants`
  ADD CONSTRAINT `merchants_verified_by_foreign` FOREIGN KEY (`verified_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL;

--
-- 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 `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_recipient_id_foreign` FOREIGN KEY (`recipient_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notifications_vendor_app_id_foreign` FOREIGN KEY (`vendor_app_id`) REFERENCES `vendor_apps` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `notification_analytics`
--
ALTER TABLE `notification_analytics`
  ADD CONSTRAINT `notification_analytics_notification_id_foreign` FOREIGN KEY (`notification_id`) REFERENCES `notifications` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notification_analytics_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notification_analytics_vendor_app_id_foreign` FOREIGN KEY (`vendor_app_id`) REFERENCES `vendor_apps` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `notification_email_logs`
--
ALTER TABLE `notification_email_logs`
  ADD CONSTRAINT `notification_email_logs_notification_id_foreign` FOREIGN KEY (`notification_id`) REFERENCES `notifications` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notification_email_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `operations`
--
ALTER TABLE `operations`
  ADD CONSTRAINT `operations_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `operations_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `operations_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `operations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `orders`
--
ALTER TABLE `orders`
  ADD CONSTRAINT `orders_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`),
  ADD CONSTRAINT `orders_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `order_appeals`
--
ALTER TABLE `order_appeals`
  ADD CONSTRAINT `order_appeals_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `order_appeals_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
  ADD CONSTRAINT `order_appeals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `order_codes`
--
ALTER TABLE `order_codes`
  ADD CONSTRAINT `order_codes_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`);

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

--
-- Constraints for table `order_response_requests`
--
ALTER TABLE `order_response_requests`
  ADD CONSTRAINT `order_response_requests_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `order_response_requests_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_receiver_id_foreign` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_sender_id_foreign` FOREIGN KEY (`sender_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `privates`
--
ALTER TABLE `privates`
  ADD CONSTRAINT `privates_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `privates_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `privates_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE;

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

--
-- Constraints for table `product_bundle_items`
--
ALTER TABLE `product_bundle_items`
  ADD CONSTRAINT `product_bundle_items_bundle_id_foreign` FOREIGN KEY (`bundle_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_bundle_items_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `referrals`
--
ALTER TABLE `referrals`
  ADD CONSTRAINT `referrals_invitee_id_foreign` FOREIGN KEY (`invitee_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `referrals_inviter_id_foreign` FOREIGN KEY (`inviter_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `referrals_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `resellers`
--
ALTER TABLE `resellers`
  ADD CONSTRAINT `resellers_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `resellers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`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 `scheduled_notifications`
--
ALTER TABLE `scheduled_notifications`
  ADD CONSTRAINT `scheduled_notifications_vendor_app_id_foreign` FOREIGN KEY (`vendor_app_id`) REFERENCES `vendor_apps` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `service_toggles`
--
ALTER TABLE `service_toggles`
  ADD CONSTRAINT `service_toggles_toggled_by_foreign` FOREIGN KEY (`toggled_by`) REFERENCES `admins` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `sync_prices`
--
ALTER TABLE `sync_prices`
  ADD CONSTRAINT `sync_prices_external_site_id_foreign` FOREIGN KEY (`external_site_id`) REFERENCES `externalsites` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sync_prices_internal_id_foreign` FOREIGN KEY (`internal_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `taxs`
--
ALTER TABLE `taxs`
  ADD CONSTRAINT `taxs_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `taxs_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `taxs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

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

--
-- Constraints for table `transactions`
--
ALTER TABLE `transactions`
  ADD CONSTRAINT `transactions_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transactions_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `transactions_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `updates`
--
ALTER TABLE `updates`
  ADD CONSTRAINT `updates_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `admins` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `updates_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `admins` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`),
  ADD CONSTRAINT `users_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `user_game_players`
--
ALTER TABLE `user_game_players`
  ADD CONSTRAINT `user_game_players_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `user_game_players_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

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

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

--
-- Constraints for table `user_order_summaries`
--
ALTER TABLE `user_order_summaries`
  ADD CONSTRAINT `user_order_summaries_currency_id_foreign` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `user_order_summaries_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendorpercents`
--
ALTER TABLE `vendorpercents`
  ADD CONSTRAINT `vendorpercents_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `vendorpercents_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

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

--
-- Constraints for table `vendor_app_versions`
--
ALTER TABLE `vendor_app_versions`
  ADD CONSTRAINT `vendor_app_versions_vendor_app_id_foreign` FOREIGN KEY (`vendor_app_id`) REFERENCES `vendor_apps` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendor_blocked_charge_methods`
--
ALTER TABLE `vendor_blocked_charge_methods`
  ADD CONSTRAINT `vendor_blocked_charge_methods_charge_method_id_foreign` FOREIGN KEY (`charge_method_id`) REFERENCES `charge_methods` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `vendor_blocked_charge_methods_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendor_images`
--
ALTER TABLE `vendor_images`
  ADD CONSTRAINT `vendor_images_game_id_foreign` FOREIGN KEY (`game_id`) REFERENCES `games` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `vendor_images_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

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

