<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\DI\Compiler;

final class CompiledDefinition
{
    public function __construct(
        private readonly string $id,
        private readonly string $type,
        private readonly string $lifetime,
        private readonly array $payload = [],
        private readonly array $tags = [],
        private readonly array $aliases = [],
        private readonly array $metadata = []
    ) {}

    public function id(): string { return $this->id; }
    public function type(): string { return $this->type; }
    public function lifetime(): string { return $this->lifetime; }
    public function payload(): array { return $this->payload; }
    public function tags(): array { return $this->tags; }
    public function aliases(): array { return $this->aliases; }
    public function metadata(): array { return $this->metadata; }

    public function toArray(): array
    {
        return [
            'id' => $this->id,
            'type' => $this->type,
            'lifetime' => $this->lifetime,
            'payload' => $this->payload,
            'tags' => $this->tags,
            'aliases' => $this->aliases,
            'metadata' => $this->metadata,
        ];
    }
}
