<?php
declare(strict_types=1);
namespace PpPhp\Packages\Ui\Ppui\Foundation\Definitions;
use PpPhp\Packages\Ui\Ppui\Foundation\Contracts\DefinitionInterface;
abstract class AbstractDefinition implements DefinitionInterface
{
    public function __construct(
        protected readonly string $id,
        protected readonly string $label,
        protected readonly array $metadata = []
    ) {}
    public function id(): string { return $this->id; }
    public function label(): string { return $this->label; }
    public function metadata(): array { return $this->metadata; }
    public function toArray(): array
    {
        return array_merge(['id'=>$this->id,'label'=>$this->label], $this->metadata);
    }
}
