<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Password default: password123
        $users = [
            [
                'role_id' => 1, // Superadmin
                'name' => 'Super Administrator',
                'email' => 'superadmin@appsuper.test',
                'password' => Hash::make('password123'),
                'nip' => '197001011995031001',
                'phone' => '08111111111',
                'is_active' => true,
            ],
            [
                'role_id' => 2, // Admin Dinas
                'name' => 'Admin Dinas Pendidikan',
                'email' => 'admin.dinas@appsuper.test',
                'password' => Hash::make('password123'),
                'nip' => '198001012005011001',
                'phone' => '08123456789',
                'is_active' => true,
            ],
            [
                'role_id' => 3, // Admin KCD
                'name' => 'Admin KCD Wilayah I',
                'email' => 'admin.kcd1@appsuper.test',
                'password' => Hash::make('password123'),
                'nip' => '198502022007012001',
                'phone' => '08123456790',
                'is_active' => true,
            ],
            [
                'role_id' => 4, // Pengawas
                'name' => 'Pengawas A',
                'email' => 'pengawas.a@appsuper.test',
                'password' => Hash::make('password123'),
                'nip' => '197803032003031001',
                'phone' => '08123456791',
                'is_active' => true,
            ],
            [
                'role_id' => 5, // Admin Sekolah
                'name' => 'Admin SLB Bina Harapan',
                'email' => 'admin.slb@appsuper.test',
                'password' => Hash::make('password123'),
                'nip' => '199004042012042001',
                'phone' => '08123456792',
                'is_active' => true,
            ],
            [
                'role_id' => 6, // Guru
                'name' => 'Guru Pendidikan Khusus',
                'email' => 'guru.pk@appsuper.test',
                'password' => Hash::make('password123'),
                'nip' => '199505052015051001',
                'phone' => '08123456793',
                'is_active' => true,
            ],
        ];

        foreach ($users as $user) {
            DB::table('users')->insert(array_merge($user, [
                'email_verified_at' => now(),
                'created_at' => now(),
                'updated_at' => now(),
            ]));
        }
    }
}
