<?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' => 'Admin TUNJUK-i',
                'email' => 'admin@tunjuk-i.id',
                'password' => Hash::make('password'),
                'role' => 'admin',
                'is_active' => true,
            ],
            [
                'name' => 'Budi Santoso',
                'email' => 'ppk@tunjuk-i.id',
                'password' => Hash::make('password'),
                'role' => 'ppk',
                'is_active' => true,
            ],
            [
                'name' => 'PT. Papua Mandiri',
                'email' => 'kontraktor@tunjuk-i.id',
                'password' => Hash::make('password'),
                'role' => 'contractor',
                'is_active' => true,
            ],
            [
                'name' => 'Quantum i Corporation',
                'email' => 'agent@tunjuk-i.id',
                'password' => Hash::make('password'),
                'role' => 'agent',
                'is_active' => true,
            ],
            [
                'name' => 'Bank Papua',
                'email' => 'bank@tunjuk-i.id',
                'password' => Hash::make('password'),
                'role' => 'bank',
                'is_active' => true,
            ],
            [
                'name' => 'BPK Papua',
                'email' => 'auditor@tunjuk-i.id',
                'password' => Hash::make('password'),
                'role' => 'auditor',
                'is_active' => true,
            ],
        ];

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

        $this->command->info('✅ 6 users created/updated successfully!');
    }
}