<?php

declare(strict_types=1);

namespace PpPhp\Core\Diagnostics\Metadata;

abstract class AbstractMetadata implements MetadataInterface
{
    public function __construct(
        protected readonly string $id,
        protected readonly string $type,
        protected readonly string $label,
        protected readonly string $version = '1.0.0',
        protected readonly string $path = '',
        protected readonly array $dependencies = [],
        protected readonly array $capabilities = [],
        protected readonly array $assets = [],
        protected readonly array $raw = []
    ) {
    }

    public function id(): string
    {
        return $this->id;
    }

    public function type(): string
    {
        return $this->type;
    }

    public function label(): string
    {
        return $this->label;
    }

    public function version(): string
    {
        return $this->version;
    }

    public function path(): string
    {
        return $this->path;
    }

    public function dependencies(): array
    {
        return $this->dependencies;
    }

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

    public function assets(): array
    {
        return $this->assets;
    }

    public function raw(): array
    {
        return $this->raw;
    }

    public function toArray(): array
    {
        return [
            'id' => $this->id,
            'type' => $this->type,
            'label' => $this->label,
            'version' => $this->version,
            'path' => $this->path,
            'dependencies' => $this->dependencies,
            'capabilities' => $this->capabilities,
            'assets' => $this->assets,
            'raw' => $this->raw,
        ];
    }
}
