--
-- Host: localhost    Database: jb_casino
-- ------------------------------------------------------


--
-- Table structure for table `admin_settings`
--

CREATE TABLE `admin_settings` (
  `id` int(11) NOT NULL DEFAULT 1,
  `house_edge_rate` decimal(5,2) DEFAULT 5.00,
  `deposit_commission_rate` decimal(5,2) DEFAULT 5.00,
  `withdrawal_commission_rate` decimal(5,2) DEFAULT 2.00,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admin_settings`
--

INSERT INTO `admin_settings` VALUES (1,5.00,5.00,2.00,'2025-09-06 04:26:54');

--
-- Table structure for table `agent_float_balance`
--

CREATE TABLE `agent_float_balance` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agent_id` int(11) NOT NULL,
  `float_balance` decimal(10,2) DEFAULT 0.00,
  `initial_float` decimal(10,2) DEFAULT 0.00,
  `total_deposits_handled` decimal(10,2) DEFAULT 0.00,
  `total_withdrawals_handled` decimal(10,2) DEFAULT 0.00,
  `commission_earned` decimal(10,2) DEFAULT 0.00,
  `house_edge_owed` decimal(10,2) DEFAULT 0.00,
  `is_active` tinyint(1) DEFAULT 1,
  `last_settlement_date` date DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_agent_active` (`agent_id`,`is_active`),
  CONSTRAINT `agent_float_balance_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `agent_float_balance`
--

INSERT INTO `agent_float_balance` VALUES (6,5,10000.00,0.00,0.00,0.00,0.00,0.00,1,NULL,'2025-09-06 17:08:19','2025-09-06 17:08:49');

--
-- Table structure for table `bonus_logs`
--

CREATE TABLE `bonus_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `bonus_type` varchar(50) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `description` text DEFAULT NULL,
  `status` enum('pending','credited','expired') DEFAULT 'credited',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `player_id` (`player_id`),
  CONSTRAINT `bonus_logs_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `bonus_logs`
--

INSERT INTO `bonus_logs` VALUES (1,4,'daily_login',20.00,'Daily login bonus','credited','2025-09-07 06:06:51'),(2,4,'rebate_bonus',95.00,'Daily rebate: 10% of ৳950 losses','credited','2025-09-07 06:11:51'),(3,4,'monthly_bonus',100.00,'Monthly Bonus','credited','2025-09-07 06:12:32'),(4,4,'deposit_bonus',20.00,'Deposit Bonus','credited','2025-09-07 06:12:35'),(5,4,'deposit_bonus',20.00,'Deposit Bonus','credited','2025-09-07 06:12:36'),(6,4,'first_deposit',100.00,'First Deposit Bonus','credited','2025-09-07 06:12:36'),(7,4,'first_deposit',100.00,'First Deposit Bonus','credited','2025-09-07 06:12:36'),(8,4,'first_deposit',100.00,'First Deposit Bonus','credited','2025-09-07 06:12:37'),(9,4,'first_deposit',100.00,'First Deposit Bonus','credited','2025-09-07 06:12:37'),(10,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:12:38'),(11,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:12:38'),(12,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:12:38'),(13,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:12:38'),(14,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:12:39'),(15,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:16:06'),(16,4,'first_deposit',100.00,'First Deposit Bonus','credited','2025-09-07 06:16:46'),(17,4,'first_deposit',100.00,'First Deposit Bonus','credited','2025-09-07 06:16:47'),(18,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:16:50'),(19,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:04'),(20,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:06'),(21,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:06'),(22,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:06'),(23,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:06'),(24,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:07'),(25,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:07'),(26,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:07'),(27,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:07'),(28,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:07'),(29,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:08'),(30,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:08'),(31,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:08'),(32,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:08'),(33,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:08'),(34,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:17:08'),(35,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:19:13'),(36,4,'email_verification',50.00,'Email Verification Bonus','credited','2025-09-07 06:19:26');

--
-- Table structure for table `bonuses`
--

CREATE TABLE `bonuses` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `value` decimal(10,2) NOT NULL,
  `condition_text` text DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `bonuses`
--

INSERT INTO `bonuses` VALUES (1,'daily_login','Daily Login Bonus',20.00,'Login once per day','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(2,'weekly_bonus','Weekly Bonus',50.00,'Login daily for 7 consecutive days','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(3,'monthly_bonus','Monthly Bonus',100.00,'Credited on 1st day of each month','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(4,'email_verification','Email Verification Bonus',50.00,'Verify email address (one-time)','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(5,'deposit_bonus','Deposit Bonus',20.00,'20% bonus on deposits ≥ 3000 BDT','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(6,'first_deposit','First Deposit Bonus',100.00,'100% bonus on first deposit','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(7,'referral_bonus','Referral Bonus',30.00,'30% of referred player first deposit','active','2025-09-07 06:02:41','2025-09-07 06:02:41'),(8,'rebate_bonus','Daily Rebate Bonus',10.00,'10% rebate on daily losses','active','2025-09-07 06:10:48','2025-09-07 06:10:48');

--
-- Table structure for table `commission_tracking`
--

CREATE TABLE `commission_tracking` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agent_id` int(11) NOT NULL,
  `transaction_type` enum('deposit','withdrawal') NOT NULL,
  `transaction_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `commission_rate` decimal(5,2) NOT NULL,
  `commission_amount` decimal(10,2) NOT NULL,
  `date` date NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_agent_date` (`agent_id`,`date`),
  CONSTRAINT `commission_tracking_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `commission_tracking`
--


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

CREATE TABLE `deposits` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tracking_id` varchar(50) NOT NULL,
  `player_id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('bkash','nagad','rocket') NOT NULL,
  `agent_number` varchar(20) DEFAULT NULL,
  `cashout_number` varchar(20) DEFAULT NULL,
  `trx_id` varchar(50) DEFAULT NULL,
  `status` enum('pending','approved','rejected') DEFAULT 'pending',
  `commission_amount` decimal(10,2) DEFAULT 0.00,
  `commission_rate` decimal(5,2) DEFAULT 5.00,
  `approved_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `tracking_id` (`tracking_id`),
  KEY `player_id` (`player_id`),
  KEY `idx_status` (`status`),
  KEY `idx_agent_date` (`agent_id`,`created_at`),
  CONSTRAINT `deposits_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `deposits_ibfk_2` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `deposits`
--

INSERT INTO `deposits` VALUES (2,'DEP-1757183177681-ROMFEU',4,5,1000.00,'bkash','AUTO_SELECTED','728209545','degegegeg','approved',50.00,5.00,NULL,'2025-09-06 18:26:17'),(3,'DEP-1757183577859-TEST',4,5,500.00,'bkash','01700000000','01800000000','TXN123456','pending',0.00,5.00,NULL,'2025-09-06 18:32:57');

--
-- Table structure for table `float_deposits`
--

CREATE TABLE `float_deposits` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tracking_id` varchar(50) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` varchar(20) NOT NULL,
  `transaction_id` varchar(100) DEFAULT NULL,
  `status` enum('pending','approved','rejected') DEFAULT 'pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `tracking_id` (`tracking_id`),
  KEY `idx_agent_status` (`agent_id`,`status`),
  KEY `idx_tracking` (`tracking_id`),
  CONSTRAINT `float_deposits_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `float_deposits`
--

INSERT INTO `float_deposits` VALUES (3,'FLOAT-1757177158086-EK1ITU',5,10000.00,'bkash','efefefef','pending','2025-09-06 16:45:58','2025-09-06 16:45:58'),(4,'FLOAT-1757177938911-YYN3LI',5,10000.00,'bkash','jhfyfuyfyuuf','pending','2025-09-06 16:58:58','2025-09-06 16:58:58'),(5,'FLOAT-1757178113121-K4W7V8',5,10000.00,'bkash','fvygfyufy','approved','2025-09-06 17:01:53','2025-09-06 17:02:32');

--
-- Table structure for table `game_results`
--

CREATE TABLE `game_results` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `agent_id` int(11) DEFAULT NULL,
  `game_type` varchar(50) DEFAULT 'slots',
  `bet_amount` decimal(10,2) NOT NULL,
  `win_amount` decimal(10,2) DEFAULT 0.00,
  `result_symbols` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`result_symbols`)),
  `house_edge_amount` decimal(10,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_player_date` (`player_id`,`created_at`),
  KEY `idx_agent_date` (`agent_id`,`created_at`),
  CONSTRAINT `game_results_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `game_results_ibfk_2` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `game_results`
--

INSERT INTO `game_results` VALUES (1,4,NULL,'slots',59.00,295.00,'[[\"🍒\",\"⭐\",\"🍒\"],[\"💎\",\"🔔\",\"7️⃣\"],[\"🍒\",\"⭐\",\"🍒\"]]',0.00,'2025-09-06 04:07:14'),(2,4,NULL,'slots',27.00,0.00,'[[\"🍀\",\"💎\",\"🍒\"],[\"🍋\",\"⭐\",\"7️⃣\"],[\"🔔\",\"⭐\",\"⭐\"]]',1.35,'2025-09-06 04:07:15'),(3,4,NULL,'slots',15.00,0.00,'[[\"⭐\",\"💎\",\"🍀\"],[\"7️⃣\",\"🔔\",\"⭐\"],[\"🍒\",\"🍒\",\"🍋\"]]',0.75,'2025-09-06 04:07:16'),(4,4,NULL,'slots',48.00,48.00,'[[\"🍒\",\"🔔\",\"7️⃣\"],[\"🍀\",\"🍋\",\"🍒\"],[\"💎\",\"💎\",\"7️⃣\"]]',0.00,'2025-09-06 04:07:16'),(5,4,NULL,'slots',30.00,60.00,'[[\"🔔\",\"🍒\",\"🍋\"],[\"⭐\",\"🍋\",\"🔔\"],[\"7️⃣\",\"7️⃣\",\"🍋\"]]',0.00,'2025-09-06 04:07:17'),(6,4,NULL,'slots',10.00,30.00,'[[\"7️⃣\",\"🔔\",\"⭐\"],[\"🍋\",\"⭐\",\"💎\"],[\"7️⃣\",\"🍒\",\"⭐\"]]',0.00,'2025-09-06 04:07:17'),(7,4,NULL,'slots',21.00,42.00,'[[\"7️⃣\",\"🍒\",\"🔔\"],[\"🍀\",\"7️⃣\",\"🍀\"],[\"7️⃣\",\"💎\",\"🍀\"]]',0.00,'2025-09-06 04:07:18'),(8,4,NULL,'slots',32.00,32.00,'[[\"🍋\",\"🔔\",\"🔔\"],[\"🍒\",\"💎\",\"💎\"],[\"🍋\",\"💎\",\"7️⃣\"]]',0.00,'2025-09-06 04:07:18'),(10,4,NULL,'slots',10.00,20.00,'[[\"🍀\",\"🍋\",\"🔔\"],[\"🍀\",\"⭐\",\"⭐\"],[\"🍋\",\"⭐\",\"🍀\"]]',0.00,'2025-09-06 04:31:28'),(11,4,NULL,'slots',10.00,20.00,'[[\"💎\",\"🍀\",\"💎\"],[\"🔔\",\"💎\",\"⭐\"],[\"🍒\",\"💎\",\"🍒\"]]',0.00,'2025-09-06 04:31:31'),(12,4,NULL,'slots',10.00,10.00,'[[\"🍒\",\"🔔\",\"🔔\"],[\"7️⃣\",\"⭐\",\"💎\"],[\"🍋\",\"7️⃣\",\"🔔\"]]',0.00,'2025-09-06 04:31:34'),(13,4,NULL,'slots',10.00,10.00,'[[\"🍀\",\"💎\",\"🍒\"],[\"🍒\",\"💎\",\"💎\"],[\"7️⃣\",\"🍋\",\"🍋\"]]',0.00,'2025-09-06 04:31:35'),(14,4,NULL,'slots',10.00,50.00,'[[\"7️⃣\",\"🔔\",\"⭐\"],[\"🍋\",\"🍀\",\"⭐\"],[\"🍒\",\"💎\",\"⭐\"]]',0.00,'2025-09-06 04:31:36'),(15,4,NULL,'slots',10.00,20.00,'[[\"🍀\",\"🍀\",\"7️⃣\"],[\"🍋\",\"⭐\",\"🔔\"],[\"7️⃣\",\"🔔\",\"🍀\"]]',0.00,'2025-09-06 04:31:39'),(16,4,NULL,'slots',10.00,10.00,'[[\"🍒\",\"7️⃣\",\"💎\"],[\"💎\",\"💎\",\"🔔\"],[\"🔔\",\"💎\",\"🔔\"]]',0.00,'2025-09-06 04:31:54'),(17,4,NULL,'slots',10.00,30.00,'[[\"🔔\",\"💎\",\"💎\"],[\"🍀\",\"🍒\",\"7️⃣\"],[\"🔔\",\"💎\",\"💎\"]]',0.00,'2025-09-06 04:31:55'),(18,4,NULL,'slots',10.00,20.00,'[[\"⭐\",\"🔔\",\"🔔\"],[\"⭐\",\"🍀\",\"🍋\"],[\"🔔\",\"🍒\",\"💎\"]]',0.00,'2025-09-06 04:31:58'),(19,4,NULL,'slots',10.00,20.00,'[[\"💎\",\"7️⃣\",\"🍒\"],[\"💎\",\"7️⃣\",\"🔔\"],[\"🍋\",\"💎\",\"🔔\"]]',0.00,'2025-09-06 04:32:00'),(20,4,NULL,'slots',10.00,10.00,'[[\"💎\",\"⭐\",\"🔔\"],[\"7️⃣\",\"🍀\",\"🔔\"],[\"🍋\",\"🔔\",\"🍒\"]]',0.00,'2025-09-06 04:32:02'),(21,4,NULL,'slots',10.00,10.00,'[[\"⭐\",\"🍀\",\"🍒\"],[\"🍒\",\"🍋\",\"🔔\"],[\"⭐\",\"💎\",\"🍀\"]]',0.00,'2025-09-06 04:32:03'),(22,4,NULL,'slots',10.00,20.00,'[[\"🍒\",\"🔔\",\"🍋\"],[\"💎\",\"🍒\",\"🍋\"],[\"🍀\",\"🍋\",\"🔔\"]]',0.00,'2025-09-06 04:32:03'),(23,4,NULL,'slots',1000.00,1000.00,'[[\"⭐\",\"🍋\",\"7️⃣\"],[\"🍀\",\"7️⃣\",\"🔔\"],[\"💎\",\"⭐\",\"🍀\"]]',0.00,'2025-09-06 04:32:10'),(24,4,NULL,'slots',1000.00,2000.00,'[[\"🍋\",\"🍒\",\"💎\"],[\"🍀\",\"🍋\",\"💎\"],[\"🍒\",\"🔔\",\"⭐\"]]',0.00,'2025-09-06 04:32:12'),(25,4,NULL,'slots',1000.00,3000.00,'[[\"7️⃣\",\"🔔\",\"🔔\"],[\"7️⃣\",\"🔔\",\"🍋\"],[\"💎\",\"7️⃣\",\"⭐\"]]',0.00,'2025-09-06 04:32:14'),(26,4,NULL,'slots',1000.00,1000.00,'[[\"7️⃣\",\"🍋\",\"🍋\"],[\"💎\",\"🍀\",\"🍀\"],[\"⭐\",\"🍋\",\"⭐\"]]',0.00,'2025-09-06 04:32:16'),(27,4,NULL,'slots',1000.00,2000.00,'[[\"⭐\",\"🍒\",\"7️⃣\"],[\"🍒\",\"⭐\",\"7️⃣\"],[\"🍀\",\"7️⃣\",\"🍒\"]]',0.00,'2025-09-06 04:32:17'),(28,4,NULL,'slots',1000.00,5000.00,'[[\"💎\",\"🍀\",\"⭐\"],[\"🔔\",\"🍒\",\"⭐\"],[\"🍀\",\"⭐\",\"⭐\"]]',0.00,'2025-09-06 04:32:19'),(29,4,NULL,'slots',1000.00,2000.00,'[[\"🍒\",\"🍒\",\"7️⃣\"],[\"🍀\",\"7️⃣\",\"⭐\"],[\"💎\",\"💎\",\"🍒\"]]',0.00,'2025-09-06 04:32:21'),(30,4,NULL,'slots',1000.00,2000.00,'[[\"🔔\",\"🍋\",\"7️⃣\"],[\"💎\",\"🔔\",\"🍒\"],[\"🍒\",\"🍋\",\"🍋\"]]',0.00,'2025-09-06 04:32:23'),(31,4,NULL,'slots',1000.00,1000.00,'[[\"🍋\",\"🔔\",\"🍒\"],[\"🍀\",\"💎\",\"7️⃣\"],[\"🍋\",\"⭐\",\"⭐\"]]',0.00,'2025-09-06 04:32:25'),(32,4,NULL,'slots',1000.00,3000.00,'[[\"🍒\",\"7️⃣\",\"🍒\"],[\"🍋\",\"7️⃣\",\"🔔\"],[\"🍒\",\"💎\",\"⭐\"]]',0.00,'2025-09-06 04:32:30'),(33,4,NULL,'slots',100.00,300.00,'[[\"💎\",\"💎\",\"⭐\"],[\"💎\",\"🔔\",\"⭐\"],[\"⭐\",\"🍒\",\"🍋\"]]',0.00,'2025-09-06 05:57:02'),(34,4,NULL,'slots',100.00,100.00,'[[\"🔔\",\"🔔\",\"🍀\"],[\"🔔\",\"💎\",\"💎\"],[\"7️⃣\",\"💎\",\"7️⃣\"]]',0.00,'2025-09-06 05:57:07');

--
-- Table structure for table `house_edge_tracking`
--

CREATE TABLE `house_edge_tracking` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `game_type` varchar(50) DEFAULT NULL,
  `bet_amount` decimal(10,2) NOT NULL,
  `player_loss` decimal(10,2) NOT NULL,
  `house_edge_rate` decimal(5,2) DEFAULT 5.00,
  `house_edge_amount` decimal(10,2) NOT NULL,
  `date` date NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_agent_date` (`agent_id`,`date`),
  KEY `idx_player_date` (`player_id`,`date`),
  CONSTRAINT `house_edge_tracking_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `house_edge_tracking_ibfk_2` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `house_edge_tracking`
--


--
-- Table structure for table `lottery_rounds`
--

CREATE TABLE `lottery_rounds` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `round_name` varchar(100) NOT NULL,
  `ticket_price` decimal(10,2) NOT NULL,
  `total_tickets` int(11) NOT NULL,
  `prize_amount` decimal(10,2) NOT NULL,
  `total_winners` int(11) DEFAULT 1,
  `start_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `end_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` enum('active','ended','drawing') DEFAULT 'active',
  `winning_number` varchar(10) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lottery_rounds`
--

INSERT INTO `lottery_rounds` VALUES (1,'Test Lottery Round',50.00,1000,10000.00,1,'2025-09-06 16:20:38','2025-09-07 16:20:38','active',NULL,1,'2025-09-06 16:20:38','2025-09-06 16:20:38');

--
-- Table structure for table `lottery_settings`
--

CREATE TABLE `lottery_settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `is_enabled` tinyint(4) DEFAULT 1,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lottery_settings`
--

INSERT INTO `lottery_settings` VALUES (1,1,'2025-09-06 16:02:46');

--
-- Table structure for table `lottery_tickets`
--

CREATE TABLE `lottery_tickets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `round_id` int(11) NOT NULL,
  `player_id` int(11) NOT NULL,
  `ticket_number` varchar(10) NOT NULL,
  `purchase_time` timestamp NOT NULL DEFAULT current_timestamp(),
  `win_status` tinyint(4) DEFAULT 0,
  `prize_won` decimal(10,2) DEFAULT 0.00,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ticket_number` (`ticket_number`),
  KEY `round_id` (`round_id`),
  KEY `player_id` (`player_id`),
  CONSTRAINT `lottery_tickets_ibfk_1` FOREIGN KEY (`round_id`) REFERENCES `lottery_rounds` (`id`),
  CONSTRAINT `lottery_tickets_ibfk_2` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lottery_tickets`
--

INSERT INTO `lottery_tickets` VALUES (1,1,4,'3733105065','2025-09-07 04:21:41',0,0.00),(2,1,4,'5250740787','2025-09-07 04:24:11',0,0.00),(3,1,4,'6616438030','2025-09-07 04:24:16',0,0.00),(4,1,4,'3434579576','2025-09-07 04:24:16',0,0.00),(5,1,4,'8083561742','2025-09-07 04:24:16',0,0.00),(6,1,4,'9896207568','2025-09-07 04:25:09',0,0.00),(7,1,4,'2452708128','2025-09-07 04:25:09',0,0.00),(8,1,4,'4818936408','2025-09-07 04:25:09',0,0.00),(9,1,4,'3341501982','2025-09-07 04:25:09',0,0.00),(10,1,4,'6511340533','2025-09-07 04:25:09',0,0.00),(11,1,4,'4574303937','2025-09-07 04:25:09',0,0.00),(12,1,4,'6932890042','2025-09-07 04:25:09',0,0.00),(13,1,4,'4193397919','2025-09-07 04:25:09',0,0.00),(14,1,4,'3478457372','2025-09-07 04:25:09',0,0.00),(15,1,4,'5609789921','2025-09-07 04:25:09',0,0.00),(16,1,5,'3818390756','2025-09-07 04:31:42',0,0.00),(17,1,4,'3453670419','2025-09-07 04:33:59',0,0.00),(18,1,4,'3432980637','2025-09-07 04:38:17',0,0.00),(19,1,4,'1780685519','2025-09-07 05:05:58',0,0.00),(20,1,4,'5141548710','2025-09-07 05:37:41',0,0.00),(21,1,4,'8560132538','2025-09-07 06:15:44',0,0.00),(22,1,4,'3771133482','2025-09-07 06:15:44',0,0.00);

--
-- Table structure for table `lottery_winners`
--

CREATE TABLE `lottery_winners` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `round_id` int(11) NOT NULL,
  `player_id` int(11) NOT NULL,
  `ticket_number` varchar(10) NOT NULL,
  `prize_amount` decimal(10,2) NOT NULL,
  `draw_time` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `round_id` (`round_id`),
  KEY `player_id` (`player_id`),
  CONSTRAINT `lottery_winners_ibfk_1` FOREIGN KEY (`round_id`) REFERENCES `lottery_rounds` (`id`),
  CONSTRAINT `lottery_winners_ibfk_2` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `lottery_winners`
--

INSERT INTO `lottery_winners` VALUES (1,1,4,'1234567890',5000.00,'2025-09-06 05:03:55'),(2,1,5,'0987654321',3000.00,'2025-09-05 05:03:55');

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

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `type` varchar(20) DEFAULT 'info',
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data`)),
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_user_unread` (`user_id`,`is_read`,`created_at`),
  CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `notifications` VALUES (2,4,'info','ডিপোজিট রিকুয়েস্ট পাঠানো হয়েছে','আপনার 1000 টাকার ডিপোজিট রিকুয়েস্ট পাঠানো হয়েছে। ট্র্যাকিং ID: DEP-1757131140140-FEKTEG','null',0,'2025-09-06 03:59:00'),(3,4,'success','ডিপোজিট অনুমোদিত','আপনার 1000.00 টাকার ডিপোজিট অনুমোদিত হয়েছে।','null',0,'2025-09-06 03:59:01'),(5,1,'info','Float Deposit Request','Agent agent_dhaka requests ৳5000 float deposit',NULL,0,'2025-09-06 05:56:30'),(7,1,'info','Float Deposit Request','Agent agent_dhaka requests ৳5000 float deposit',NULL,0,'2025-09-06 05:57:07'),(9,1,'info','Float Deposit Request','Agent agent_dhaka requests ৳10000 float deposit',NULL,0,'2025-09-06 16:45:58'),(10,1,'info','Float Deposit Request','Agent agent_dhaka requests ৳10000 float deposit',NULL,0,'2025-09-06 16:58:58'),(11,1,'info','Float Deposit Request','Agent agent_dhaka requests ৳10000 float deposit',NULL,0,'2025-09-06 17:01:53'),(12,5,'success','Float Deposit Approved','Your ৳10000.00 float deposit has been approved',NULL,0,'2025-09-06 17:02:32'),(13,5,'info','নতুন ডিপোজিট রিকুয়েস্ট','1000 টাকার ডিপোজিট রিকুয়েস্ট পেয়েছেন। ট্র্যাকিং ID: DEP-1757183177681-ROMFEU',NULL,0,'2025-09-06 18:26:17'),(14,1,'info','নতুন ডিপোজিট রিকুয়েস্ট','1000 টাকার ডিপোজিট রিকুয়েস্ট পেয়েছেন। ট্র্যাকিং ID: DEP-1757183177681-ROMFEU',NULL,0,'2025-09-06 18:26:17'),(15,5,'info','নতুন ডিপোজিট রিকুয়েস্ট','1000 টাকার ডিপোজিট রিকুয়েস্ট পেয়েছেন। ট্র্যাকিং ID: DEP-1757183177681-ROMFEU',NULL,0,'2025-09-06 18:26:17'),(16,6,'info','নতুন ডিপোজিট রিকুয়েস্ট','1000 টাকার ডিপোজিট রিকুয়েস্ট পেয়েছেন। ট্র্যাকিং ID: DEP-1757183177681-ROMFEU',NULL,0,'2025-09-06 18:26:17'),(17,4,'info','ডিপোজিট রিকুয়েস্ট','আপনার ডিপোজিট রিকুয়েস্ট পাঠানো হয়েছে। ট্র্যাকিং ID: DEP-1757183177681-ROMFEU',NULL,0,'2025-09-06 18:26:17'),(18,4,'success','ডিপোজিট অনুমোদিত','আপনার 1000.00 টাকার ডিপোজিট অনুমোদিত হয়েছে।',NULL,0,'2025-09-06 18:26:27');

--
-- Table structure for table `payment_settings`
--

CREATE TABLE `payment_settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bkash_number` varchar(20) DEFAULT NULL,
  `bkash_type` enum('personal','merchant') DEFAULT 'personal',
  `nagad_number` varchar(20) DEFAULT NULL,
  `rocket_number` varchar(20) DEFAULT NULL,
  `bank_name` varchar(100) DEFAULT NULL,
  `bank_account` varchar(50) DEFAULT NULL,
  `bank_routing` varchar(20) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `payment_settings`
--

INSERT INTO `payment_settings` VALUES (1,'01712345678','personal','01812345678','01912345678','Dutch Bangla Bank','1234567890','090','2025-09-06 05:56:30','2025-09-06 05:56:30'),(2,'01712345678','personal','01812345678','01912345678','Dutch Bangla Bank','1234567890','090','2025-09-06 05:57:07','2025-09-06 05:57:07'),(3,'01780684828','personal','01812345678','01912345678','Dutch Bangla Bank','1234567890','090','2025-09-06 05:58:42','2025-09-06 05:58:42'),(4,'01780684828','personal','01812345678','01912345678','Dutch Bangla Bank','1234567890','090','2025-09-06 15:42:58','2025-09-06 15:42:58'),(5,'01780684828','merchant','01780684829','01780684830','BRAC Bank','9876543210','060','2025-09-06 15:46:52','2025-09-06 15:46:52');

--
-- Table structure for table `player_streaks`
--

CREATE TABLE `player_streaks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `player_id` int(11) NOT NULL,
  `daily_streak` int(11) DEFAULT 0,
  `last_login_date` date DEFAULT NULL,
  `weekly_bonus_claimed` date DEFAULT NULL,
  `monthly_bonus_claimed` date DEFAULT NULL,
  `email_verified_bonus` tinyint(1) DEFAULT 0,
  `first_deposit_bonus` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `player_id` (`player_id`),
  CONSTRAINT `player_streaks_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `player_streaks`
--

INSERT INTO `player_streaks` VALUES (1,4,1,'2025-09-07',NULL,NULL,1,1,'2025-09-07 06:06:51','2025-09-07 06:19:20');

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

CREATE TABLE `referrals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `referrer_id` int(11) NOT NULL,
  `referred_id` int(11) NOT NULL,
  `status` enum('pending','completed') DEFAULT 'pending',
  `bonus_given` decimal(10,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `referrer_id` (`referrer_id`),
  KEY `referred_id` (`referred_id`),
  CONSTRAINT `referrals_ibfk_1` FOREIGN KEY (`referrer_id`) REFERENCES `users` (`id`),
  CONSTRAINT `referrals_ibfk_2` FOREIGN KEY (`referred_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `referrals`
--


--
-- Table structure for table `settlements`
--

CREATE TABLE `settlements` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `agent_id` int(11) NOT NULL,
  `settlement_date` date NOT NULL,
  `initial_float` decimal(10,2) NOT NULL,
  `total_deposits` decimal(10,2) NOT NULL,
  `total_withdrawals` decimal(10,2) NOT NULL,
  `commission_earned` decimal(10,2) NOT NULL,
  `house_edge_owed` decimal(10,2) NOT NULL,
  `remaining_float` decimal(10,2) NOT NULL,
  `net_settlement` decimal(10,2) NOT NULL,
  `status` enum('pending','completed') DEFAULT 'pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_agent_date` (`agent_id`,`settlement_date`),
  KEY `idx_date` (`settlement_date`),
  CONSTRAINT `settlements_ibfk_1` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `settlements`
--


--
-- Table structure for table `transaction_logs`
--

CREATE TABLE `transaction_logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `transaction_type` enum('deposit','withdrawal','game_win','game_loss','commission','house_edge','float_topup','settlement') NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `balance_before` decimal(10,2) NOT NULL,
  `balance_after` decimal(10,2) NOT NULL,
  `reference_id` varchar(50) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_user_type_date` (`user_id`,`transaction_type`,`created_at`),
  CONSTRAINT `transaction_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `transaction_logs`
--

INSERT INTO `transaction_logs` VALUES (1,4,'deposit',1000.00,5000.00,6000.00,'DEP-1757131140140-FEKTEG','Deposit approved by agent','2025-09-06 03:59:01'),(2,4,'game_loss',100.00,6000.00,5900.00,'slots_1757131142181','slots game result','2025-09-06 03:59:02'),(3,4,'game_win',236.00,5900.00,6136.00,'SLOT_1757131634972','Slot game: won 236 BDT','2025-09-06 04:07:14'),(4,4,'game_loss',27.00,6136.00,6109.00,'SLOT_1757131635496','Slot game: lost 27 BDT','2025-09-06 04:07:15'),(5,4,'game_loss',15.00,6109.00,6094.00,'SLOT_1757131636004','Slot game: lost 15 BDT','2025-09-06 04:07:16'),(6,4,'game_win',0.00,6094.00,6094.00,'SLOT_1757131636517','Slot game: won 0 BDT','2025-09-06 04:07:16'),(7,4,'game_win',30.00,6094.00,6124.00,'SLOT_1757131637031','Slot game: won 30 BDT','2025-09-06 04:07:17'),(8,4,'game_win',20.00,6124.00,6144.00,'SLOT_1757131637545','Slot game: won 20 BDT','2025-09-06 04:07:17'),(9,4,'game_win',21.00,6144.00,6165.00,'SLOT_1757131638059','Slot game: won 21 BDT','2025-09-06 04:07:18'),(10,4,'game_win',0.00,6165.00,6165.00,'SLOT_1757131638572','Slot game: won 0 BDT','2025-09-06 04:07:18'),(11,4,'game_win',10.00,6165.00,6175.00,'SLOT_1757133088093','Slot game: won 10 BDT','2025-09-06 04:31:28'),(12,4,'game_win',10.00,6175.00,6185.00,'SLOT_1757133091588','Slot game: won 10 BDT','2025-09-06 04:31:31'),(13,4,'game_win',0.00,6185.00,6185.00,'SLOT_1757133094684','Slot game: won 0 BDT','2025-09-06 04:31:34'),(14,4,'game_win',0.00,6185.00,6185.00,'SLOT_1757133095555','Slot game: won 0 BDT','2025-09-06 04:31:35'),(15,4,'game_win',40.00,6185.00,6225.00,'SLOT_1757133096155','Slot game: won 40 BDT','2025-09-06 04:31:36'),(16,4,'game_win',10.00,6225.00,6235.00,'SLOT_1757133099044','Slot game: won 10 BDT','2025-09-06 04:31:39'),(17,4,'game_win',0.00,6235.00,6235.00,'SLOT_1757133114544','Slot game: won 0 BDT','2025-09-06 04:31:54'),(18,4,'game_win',20.00,6235.00,6255.00,'SLOT_1757133115523','Slot game: won 20 BDT','2025-09-06 04:31:55'),(19,4,'game_win',10.00,6255.00,6265.00,'SLOT_1757133118429','Slot game: won 10 BDT','2025-09-06 04:31:58'),(20,4,'game_win',10.00,6265.00,6275.00,'SLOT_1757133120376','Slot game: won 10 BDT','2025-09-06 04:32:00'),(21,4,'game_win',0.00,6275.00,6275.00,'SLOT_1757133122235','Slot game: won 0 BDT','2025-09-06 04:32:02'),(22,4,'game_win',0.00,6275.00,6275.00,'SLOT_1757133123147','Slot game: won 0 BDT','2025-09-06 04:32:03'),(23,4,'game_win',10.00,6275.00,6285.00,'SLOT_1757133123611','Slot game: won 10 BDT','2025-09-06 04:32:03'),(24,4,'game_win',0.00,6285.00,6285.00,'SLOT_1757133130792','Slot game: won 0 BDT','2025-09-06 04:32:10'),(25,4,'game_win',1000.00,6285.00,7285.00,'SLOT_1757133132419','Slot game: won 1000 BDT','2025-09-06 04:32:12'),(26,4,'game_win',2000.00,7285.00,9285.00,'SLOT_1757133134484','Slot game: won 2000 BDT','2025-09-06 04:32:14'),(27,4,'game_win',0.00,9285.00,9285.00,'SLOT_1757133136742','Slot game: won 0 BDT','2025-09-06 04:32:16'),(28,4,'game_win',1000.00,9285.00,10285.00,'SLOT_1757133137315','Slot game: won 1000 BDT','2025-09-06 04:32:17'),(29,4,'game_win',4000.00,10285.00,14285.00,'SLOT_1757133139179','Slot game: won 4000 BDT','2025-09-06 04:32:19'),(30,4,'game_win',1000.00,14285.00,15285.00,'SLOT_1757133141187','Slot game: won 1000 BDT','2025-09-06 04:32:21'),(31,4,'game_win',1000.00,15285.00,16285.00,'SLOT_1757133143495','Slot game: won 1000 BDT','2025-09-06 04:32:23'),(32,4,'game_win',0.00,16285.00,16285.00,'SLOT_1757133145012','Slot game: won 0 BDT','2025-09-06 04:32:25'),(33,4,'game_win',2000.00,16285.00,18285.00,'SLOT_1757133150238','Slot game: won 2000 BDT','2025-09-06 04:32:30'),(34,4,'game_win',200.00,10000.00,10200.00,'SLOT_1757138222672','Slot game: won 200 BDT','2025-09-06 05:57:02'),(35,4,'game_win',0.00,10200.00,10200.00,'SLOT_1757138227905','Slot game: won 0 BDT','2025-09-06 05:57:07');

--
-- Table structure for table `withdrawals`
--

CREATE TABLE `withdrawals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tracking_id` varchar(50) NOT NULL,
  `player_id` int(11) NOT NULL,
  `agent_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('bkash','nagad','rocket') NOT NULL,
  `player_number` varchar(20) NOT NULL,
  `status` enum('pending','approved','rejected') DEFAULT 'pending',
  `commission_amount` decimal(10,2) DEFAULT 0.00,
  `commission_rate` decimal(5,2) DEFAULT 2.00,
  `approved_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `tracking_id` (`tracking_id`),
  KEY `player_id` (`player_id`),
  KEY `idx_status` (`status`),
  KEY `idx_agent_date` (`agent_id`,`created_at`),
  CONSTRAINT `withdrawals_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `withdrawals_ibfk_2` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `withdrawals`
--



