CREATE TABLE `users` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `telegram_id` BIGINT UNIQUE NOT NULL,
  `first_name` VARCHAR(255),
  `username` VARCHAR(255),
  `balance` DECIMAL(10, 2) DEFAULT 0.00,
  `total_watched` INT DEFAULT 0,
  `referred_by` BIGINT DEFAULT NULL,
  `join_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE `withdrawals` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `user_id` INT,
  `method` VARCHAR(100),
  `amount` DECIMAL(10, 2),
  `wallet_address` VARCHAR(255),
  `status` ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
  `request_date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (user_id) REFERENCES users(id)
);

CREATE TABLE `payment_methods` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(100) UNIQUE NOT NULL,
  `status` BOOLEAN DEFAULT 1
);

CREATE TABLE `settings` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `setting_key` VARCHAR(100) UNIQUE NOT NULL,
  `setting_value` TEXT
);

-- কিছু ডিফল্ট সেটিংস যোগ করা হলো
INSERT INTO `settings` (`setting_key`, `setting_value`) VALUES
('ads_reward', '100.00'),
('daily_ads_limit', '50'),
('refer_bonus_percentage', '10'),
('currency_symbol', 'BDT'),
('monetag_site_id', '9534912');