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

async function main() {
  const site = await prisma.site.create({
    data: {
      name: 'Solar Rooftop 2',
      location: 'Malaysia',
      inverterProvider: 'Huawei',
      emergencyContact: '012-3456789',
      lastSyncTimestamp: new Date(),
      theoreticalMaxGeneration_kWh: 5000,
      consumptionData: {
        create: [
          {
            type: 'consumption',
            timestamp: new Date('2025-01-01T00:00:00Z'),
            value: 120.5,
          },
        ],
      },
      generationData: {
        create: [
          {
            type: 'generation',
            timestamp: new Date('2025-01-01T00:00:00Z'),
            value: 200.75,
          },
        ],
      },
    },
  });

  console.log('Seeded site:', site.name);
}

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

