-- Add tables for agent float deposits and payment settings

-- Float deposits table
CREATE TABLE IF NOT EXISTS float_deposits (
  id INT PRIMARY KEY AUTO_INCREMENT,
  tracking_id VARCHAR(50) UNIQUE NOT NULL,
  agent_id INT NOT NULL,
  amount DECIMAL(10,2) NOT NULL,
  payment_method VARCHAR(20) NOT NULL,
  transaction_id VARCHAR(100),
  status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  FOREIGN KEY (agent_id) REFERENCES users(id) ON DELETE CASCADE,
  INDEX idx_agent_status (agent_id, status),
  INDEX idx_tracking (tracking_id)
);

-- Payment settings table
CREATE TABLE IF NOT EXISTS payment_settings (
  id INT PRIMARY KEY AUTO_INCREMENT,
  bkash_number VARCHAR(20),
  bkash_type ENUM('personal', 'merchant') DEFAULT 'personal',
  nagad_number VARCHAR(20),
  rocket_number VARCHAR(20),
  bank_name VARCHAR(100),
  bank_account VARCHAR(50),
  bank_routing VARCHAR(20),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
