<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Console\ConsolePath;
use PpPhp\Core\Platform\DI\Integration\PlatformContainerRuntime;

final class ContainerCommand extends AbstractCommand
{
    public function name(): string { return 'container'; }
    public function description(): string { return 'Show integrated DI container summary.'; }

    public function handle(array $arguments = []): int
    {
        $summary = (new PlatformContainerRuntime(ConsolePath::basePath()))->summary();

        $this->title('PPphp DI Container');
        $this->line('Definitions: ' . $summary['definitions']);
        $this->line('Aliases: ' . $summary['aliases']);
        $this->line('Tags: ' . $summary['tags']);
        $this->line('Runtime registered: ' . $summary['registered']);
        $this->line('Warnings: ' . $summary['warnings']);
        $this->line('Integration: OK');

        return 0;
    }
}
