<?php

namespace Database\Seeders;

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

class TestUserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Insert Member
        DB::table('members')->insert([
            'nik' => '1234567890123456',
            'no_anggota' => 'KSP001',
            'nama' => 'Test User',
            'tempat_lahir' => 'Jakarta',
            'tanggal_lahir' => '1990-01-01',
            'jenis_kelamin' => 'L',
            'email' => 'test@example.com',
            'no_telp' => '081234567890',
            'alamat' => 'Jl. Test No. 123',
            'status' => 'aktif',
            'unit_kerja' => 'IT',
            'pekerjaan' => 'Programmer',
            'simpanan_pokok' => 100000,
            'simpanan_wajib' => 50000,
            'simpanan_sukarela' => 200000,
            'jumlah_simpanan' => 350000,
            'create_time' => now(),
        ]);

        // Insert Web User
        DB::table('web_users')->insert([
            'nama_user' => 'testuser',
            'passwd' => Hash::make('password123'), // password: password123
            'user_id' => '1234567890123456', // NIK dari member
            'is_active' => true,
            'login_count' => 0,
            'create_time' => now(),
        ]);

        echo "✅ Test user created successfully!\n";
        echo "Username: testuser OR 1234567890123456 OR 081234567890\n";
        echo "Password: password123\n";
    }
}
