<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    public function run(): void
    {
        $admin = User::create([
            'name' => 'Admin PAMSIMAS',
            'email' => 'admin@pamsimas.com',
            'password' => Hash::make('admin123'),
            'role' => 'admin',
            'status' => 'aktif',
            'email_verified_at' => now(),
        ]);

        for ($i = 1; $i <= 10; $i++) {
            $user = User::create([
                'name' => 'Pelanggan ' . $i,
                'email' => 'pelanggan' . $i . '@gmail.com',
                'password' => Hash::make('password'),
                'role' => 'user',
                'status' => 'aktif',
                'email_verified_at' => now(),
            ]);

            Profile::create([
                'user_id' => $user->id,
                'address' => 'Alamat Pelanggan ' . $i,
                'phone_number' => '0812345678' . str_pad($i, 2, '0', STR_PAD_LEFT),
                'customer_number' => 'PAMSIMAS-' . str_pad($user->id, 5, '0', STR_PAD_LEFT),
                'foto_profil' => null,
            ]);
        }
    }
}
