-- Create database (if it doesn't exist)
CREATE DATABASE IF NOT EXISTS pickmyco_leads;

-- Use the database
USE pickmyco_leads;

-- Create leads table
CREATE TABLE IF NOT EXISTS leads (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    company VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL,
    phone VARCHAR(20) NOT NULL,
    industry VARCHAR(50) NOT NULL,
    employees VARCHAR(20) NOT NULL,
    message TEXT,
    referral_source VARCHAR(100),
    campaign_data TEXT,
    date_submitted DATETIME NOT NULL,
    status ENUM('new', 'contacted', 'qualified', 'not_interested') DEFAULT 'new',
    notes TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create index for faster searching
CREATE INDEX idx_email ON leads(email);
CREATE INDEX idx_date ON leads(date_submitted);
CREATE INDEX idx_status ON leads(status);
