<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class PegawaiSeeder extends Seeder
{
    public function run(): void
    {
        // Matikan pengecekan foreign key sementara agar bisa truncate (bersihkan tabel)
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        DB::table('pegawais')->truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');

        // Masukkan data pegawai saja (Profile), User ID disesuaikan dengan urutan di AkunSeeder
        // ID 1: Sutowo, ID 2: Welprida, ID 3: Rini, ID 4: Harri ...
        DB::table('pegawais')->insert([
            [
                'id' => 4, 
                'nip' => '198501012010011001',
                'nama' => 'HARRI MULIAWAN, ST',
                'jabatan' => 'Pengawas Ketenagakerjaan Ahli Muda',
                'user_id' => 4, // Nyambung ke Harri di tabel users
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'id' => 5,
                'nip' => '198602022011021002',
                'nama' => 'DANA OKTAVIAN, S.Sos',
                'jabatan' => 'Pengawas Ketenagakerjaan Ahli Muda',
                'user_id' => 5,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'id' => 6,
                'nip' => '198703032012032003',
                'nama' => 'LISBET MARYATI S, SH',
                'jabatan' => 'Pengawas Ketenagakerjaan Ahli Pertama',
                'user_id' => 6,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'id' => 7,
                'nip' => '198804042013042004',
                'nama' => 'MAISA BAHARI, SH',
                'jabatan' => 'Pengawas Ketenagakerjaan Ahli Pertama',
                'user_id' => 7,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'id' => 8,
                'nip' => '198905052014051005',
                'nama' => 'URAY NANDA KHARISMA, SE',
                'jabatan' => 'Pengawas Ketenagakerjaan Ahli Pertama',
                'user_id' => 8,
                'created_at' => now(),
                'updated_at' => now(),
            ],
        ]);

        $this->command->info('✓ PegawaiSeeder Berhasil: Data profil pegawai sudah masuk!');
    }
}