import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

async function main() {
  // Find the user we created earlier
  const user = await prisma.user.findUnique({
    where: { email: 'real@example.com' }
  })

  if (!user) {
    console.error('User not found. Please register first.')
    return
  }

  const business = await prisma.business.create({
    data: {
      name: 'Real DB Business',
      category: 'Technologie & IT',
      location: 'Dakar, Sénégal',
      description: 'This is a real business stored in the database, merged with mock data.',
      logoUrl: 'https://picsum.photos/200/200?random=100',
      contactEmail: 'contact@realdb.com',
      verified: true,
      isFeatured: true,
      ownerId: user.id,
      tags: ['Real', 'Database', 'Test']
    }
  })

  console.log('Created business:', business)
}

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