<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        // Panggil seeder IndoRegion agar dropdown alamat (Provinsi, Kota, dll) tidak kosong
        $this->call([
            IndoRegionSeeder::class,
            AdminSeeder::class,
        ]);

        // Buat user test jika belum ada
        if (!User::where('email', 'test@example.com')->exists()) {
            User::factory()->create([
                'name' => 'Azhari Pro',
                'email' => 'test@example.com',
                'password' => bcrypt('password'),
                'phone' => '08123456789011',
                'role' => 'pelanggan',
            ]);
        }
    }
}
