import User from '#models/user'
import { BaseSeeder } from '@adonisjs/lucid/seeders'
import { faker } from '@faker-js/faker'

export default class extends BaseSeeder {
  public async run () {
    const usersExist = await User.query().first()
    if (usersExist) {
      console.log('Database already seeded, skipping...')
      return 
    }
    const users = Array.from({ length: 200 }).map(() => ({
      fullName: faker.person.fullName(),
      email: faker.internet.email(),
      password: 'password123',
    }))

    await User.createMany(users)
  }
}