import { prisma } from '../lib/prisma';

async function main() {
  console.log('🔍 Prüfe Equipment-Einträge...\n');

  const count = await prisma.equipment.count();
  console.log(`📊 Anzahl Equipment-Einträge: ${count}`);

  if (count > 0) {
    const equipment = await prisma.equipment.findMany();
    console.log('\n📦 Vorhandene Equipment:');
    console.table(equipment.map(e => ({
      id: e.id.slice(0, 8) + '...',
      name: e.name,
      price: e.price,
      lexofficeId: e.lexofficeArticleId?.slice(0, 8) + '...' || 'null',
    })));
  } else {
    console.log('\n⚠️  Keine Equipment-Einträge in der Datenbank!');
    console.log('ℹ️  Du musst zuerst Equipment-Artikel anlegen.');
  }
}

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