<?php

namespace Database\Seeders;

use App\Enums\UserRole;
use App\Models\User;
use Illuminate\Database\Seeder;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        foreach (UserRole::cases() as $role) {
            $username = $role->value;

            User::updateOrCreate(
                ['email' => sprintf('%s@winery.test', $username)],
                [
                    'name' => ucfirst($username) . ' User',
                    'username' => $username,
                    'password' => 'password',
                    'role' => $role,
                ]
            );
        }
    }
}
