const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();

async function main() {
  const allLeads = await prisma.lead.count();
  console.log(`Total leads in DB: ${allLeads}`);

  const completeLeads = await prisma.lead.count({
    where: {
      email: { not: null, not: '' },
      website: { not: null, not: '' },
      phone: { not: null, not: '' },
    }
  });
  console.log(`Complete leads (Email, Website, Phone): ${completeLeads}`);
  
  const incompleteLeads = await prisma.lead.findMany({
    where: {
      OR: [
        { email: null },
        { email: '' },
        { website: null },
        { website: '' },
        { phone: null },
        { phone: '' },
      ]
    },
    take: 5
  });
  
  console.log('Sample Incomplete Leads:');
  incompleteLeads.forEach(l => {
    console.log(`- ${l.businessName}: E:${l.email}, W:${l.website}, P:${l.phone}`);
  });
}

main().catch(e => {
  console.error(e);
  process.exit(1);
}).finally(async () => {
  await prisma.$disconnect();
});
