-- Prospective distributors (employee field development leads)
CREATE TABLE IF NOT EXISTS prospective_distributors (
  id INT AUTO_INCREMENT PRIMARY KEY,
  employee_user_id INT NOT NULL,
  trade_name VARCHAR(200) NOT NULL,
  contact_person VARCHAR(150) DEFAULT NULL,
  mobile VARCHAR(20) DEFAULT NULL,
  email VARCHAR(150) DEFAULT NULL,
  business_address TEXT,
  city VARCHAR(100) DEFAULT NULL,
  state VARCHAR(100) DEFAULT NULL,
  pin_code VARCHAR(10) DEFAULT NULL,
  remarks TEXT,
  business_photo_urls JSON,
  lead_status ENUM(
    'new','contacted','interested','not_interested','application_submitted','converted','lost'
  ) DEFAULT 'new',
  distributor_id INT DEFAULT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  FOREIGN KEY (employee_user_id) REFERENCES users(id) ON DELETE CASCADE,
  FOREIGN KEY (distributor_id) REFERENCES distributors(id) ON DELETE SET NULL,
  INDEX idx_prospective_dist_employee (employee_user_id),
  INDEX idx_prospective_dist_status (lead_status)
) ENGINE=InnoDB;
