import * as XLSX from 'xlsx';

export function exportLeadsToCSV(leads: any[]) {
    if (!leads || leads.length === 0) return;
    
    const worksheet = XLSX.utils.json_to_sheet(leads);
    const workbook = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(workbook, worksheet, "Leads");
    
    // Generate CSV and trigger download
    XLSX.writeFile(workbook, `LeadForge_Export_${new Date().toISOString().split('T')[0]}.csv`);
}
