<?php

namespace App\Database\Seeds;

use CodeIgniter\Database\Seeder;

/**
 * Master seeder. Run with:
 *   php spark db:seed DatabaseSeeder
 *
 * Add each new module's seeder here, in dependency order, as modules
 * are built (Roles before Users, Branch/Department before Users, etc).
 */
class DatabaseSeeder extends Seeder
{
    public function run(): void
    {
        // Reference data first — the admin user below assigns itself the
        // seeded Administrator role / Head Office branch / Administration
        // department, so these must run first.
        $this->call(RoleSeeder::class);
        $this->call(PermissionSeeder::class);
        $this->call(RolePermissionSeeder::class);
        $this->call(BranchSeeder::class);
        $this->call(DepartmentSeeder::class);
        $this->call(LeaveTypeSeeder::class);
        $this->call(CompanySettingsSeeder::class);

        // Phase 1 — Authentication + User Management.
        $this->call(DefaultAdminSeeder::class);

        // Demo/test data is optional — run separately when you want sample
        // users and module rows: php spark db:seed DemoDataSeeder
        // (or: php scripts/seed_demo_data.php)
    }
}
