CREATE TABLE IF NOT EXISTS leads (
    LeadID INT AUTO_INCREMENT PRIMARY KEY,
    Name VARCHAR(255) NOT NULL,
    CompanyName VARCHAR(255),
    Email VARCHAR(255),
    Phone VARCHAR(50),
    Source VARCHAR(100) NULL,
    Status VARCHAR(50) DEFAULT 'New',
    PotentialAmount DECIMAL(12, 2) NULL,
    CreatedOn TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS activities (
    ActivityID INT AUTO_INCREMENT PRIMARY KEY,
    LeadID INT,
    ActivityType VARCHAR(50) NOT NULL,
    DueDate DATE,
    Status VARCHAR(50) DEFAULT 'Pending',
    Notes TEXT,
    CreatedOn TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (LeadID) REFERENCES leads(LeadID) ON DELETE CASCADE
);
