<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Kernel\Platform;

final class ModulesCommand extends AbstractCommand
{
    public function name(): string { return 'modules'; }
    public function description(): string { return 'List discovered modules.'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Modules');
        foreach (Platform::modules()->all() as $module) {
            $this->line('- ' . $module->id() . ' [' . $module->status() . '] ' . $module->label());
        }
        return 0;
    }
}
