<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    public function run(): void
    {
        $users = [
            [
                'name' => 'Super Admin',
                'email' => 'admin@harcourts.co.nz',
                'password' => Hash::make('Password123!'),
                'role' => 'super_admin',
                'active' => true,
            ],
            [
                'name' => 'Sarah Jenkins',
                'email' => 'harcourts.admin@harcourts.co.nz',
                'password' => Hash::make('Password123!'),
                'role' => 'harcourts_admin',
                'active' => true,
            ],
            [
                'name' => 'Yudee Designer',
                'email' => 'designer@harcourts.co.nz',
                'password' => Hash::make('Password123!'),
                'role' => 'designer',
                'active' => true,
            ],
        ];

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