<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Urutan seeder PENTING:
     * 1. RolePermissionSeeder  — harus lebih dulu dari user
     * 2. AdminUserSeeder       — butuh role sudah ada
     * 3. SettingSeeder         — standalone
     * 4. DemoDataSeeder        — butuh semua di atas sudah ada
     *    (hanya berjalan di environment local / testing)
     */
    public function run(): void
    {
        $this->command->info('');
        $this->command->info('╔══════════════════════════════════════╗');
        $this->command->info('║     Titipin Ba Be — Database Seeder  ║');
        $this->command->info('╚══════════════════════════════════════╝');
        $this->command->info('');

        $this->call(RolePermissionSeeder::class);
        $this->call(AdminUserSeeder::class);
        $this->call(SettingSeeder::class);

        if (app()->isLocal()) {
            $this->command->info('');
            $this->command->info('[ ENV=local ] Menjalankan Demo Data Seeder...');
            $this->call(DemoDataSeeder::class);
        }

        $this->command->info('');
        $this->command->info('✅ Seeder selesai.');
        $this->command->info('');
        $this->command->warn('⚠  PENTING: Ganti semua password default sebelum deploy ke production!');
    }
}
