<?php

declare(strict_types=1);

namespace Database\Seeders;

use PDO;

/**
 * DatabaseSeeder
 *
 * Order matters: business lines and roles/permissions must exist
 * before users can reference them; business lines must exist before
 * service types/plans reference them, etc. Run the whole thing via
 * `php bin/seed.php`.
 */
final class DatabaseSeeder
{
    /** @var class-string<SeederInterface>[] */
    private const SEEDERS = [
        BusinessLineSeeder::class,
        RolePermissionSeeder::class,
        LeadPipelineSeeder::class,
        OrgStructureSeeder::class,
        AdminUserSeeder::class,
        ReferenceDataSeeder::class,
        WorkspaceSeeder::class,
        MarketingSeeder::class,
        AiIntegrationSeeder::class,
    ];

    public function run(PDO $pdo): void
    {
        foreach (self::SEEDERS as $seederClass) {
            echo "▶ " . $seederClass . "\n";
            /** @var SeederInterface $seeder */
            $seeder = new $seederClass();
            $seeder->run($pdo);
        }
    }
}
