<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Reflection;

use PpPhp\Core\Platform\Runtime\PlatformRuntimeContext;

final class PlatformReflection
{
    public function __construct(
        private readonly PlatformRuntimeContext $context
    ) {
    }

    public function services(): array
    {
        return $this->context->registries()->services->toArray();
    }

    public function descriptors(): array
    {
        return $this->context->descriptors()->toArray();
    }

    public function blueprints(): array
    {
        return $this->context->blueprints()->toArray();
    }

    public function capabilities(): array
    {
        return $this->context->registries()->capabilities->all();
    }

    public function aliases(): array
    {
        return $this->context->registries()->aliases->all();
    }

    public function summary(): array
    {
        return [
            'services' => count($this->context->registries()->services->all()),
            'descriptors' => count($this->context->descriptors()->all()),
            'blueprints' => count($this->context->blueprints()->all()),
            'aliases' => count($this->context->registries()->aliases->all()),
        ];
    }
}
