<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

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

final class AboutCommand extends AbstractCommand
{
    public function name(): string { return 'about'; }
    public function description(): string { return 'Show platform overview.'; }

    public function handle(array $arguments = []): int
    {
        $loader = PlatformBootstrap::loader();

        $this->title('PPphp Platform');
        $this->line('Kernel ........ OK');
        $this->line('Runtime ....... ' . (Platform::runtime() ? 'OK' : 'NOT BOOTED'));
        $this->line('Classes ....... ' . ($loader ? $loader->count() : 0));
        $this->line('Manifests ..... ' . count(Platform::manifests()->all()));
        $this->line('Modules ....... ' . Platform::modules()->count());
        $this->line('Packages ...... ' . Platform::packages()->count());
        $this->line('Themes ........ ' . Platform::themes()->count());
        $this->line('Services ...... ' . count(Platform::registries()->services->all()));
        return 0;
    }
}
