<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class DatabaseSeeder extends Seeder
{
    use WithoutModelEvents;

    public function run(): void
    {
        $users = [
            [
                'name'     => 'Administrator',
                'email'    => 'admin@service.test',
                'role'     => 'admin',
                'password' => Hash::make('password'),
            ],
            [
                'name'     => 'Teknisi',
                'email'    => 'teknisi@service.test',
                'role'     => 'technician',
                'password' => Hash::make('password'),
            ],
            [
                'name'     => 'Kurir',
                'email'    => 'kurir@service.test',
                'role'     => 'courier',
                'password' => Hash::make('password'),
            ],
        ];

        foreach ($users as $data) {
            User::updateOrCreate(['email' => $data['email']], $data);
        }
    }
}

