<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\DI\Reflection;

final class ClassMetadata
{
    public function __construct(
        private readonly string $className,
        private readonly bool $instantiable,
        private readonly ?ConstructorMetadata $constructor = null,
        private readonly array $interfaces = [],
        private readonly array $attributes = []
    ) {}

    public function className(): string { return $this->className; }
    public function instantiable(): bool { return $this->instantiable; }
    public function constructor(): ?ConstructorMetadata { return $this->constructor; }
    public function interfaces(): array { return $this->interfaces; }
    public function attributes(): array { return $this->attributes; }

    public function toArray(): array
    {
        return [
            'className' => $this->className,
            'instantiable' => $this->instantiable,
            'interfaces' => $this->interfaces,
            'attributes' => $this->attributes,
            'constructor' => $this->constructor?->toArray(),
        ];
    }
}
