<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Foundation;

final class PlatformMetadata
{
    public function __construct(
        private readonly array $data = []
    ) {
    }

    public function get(string $key, mixed $default = null): mixed
    {
        return $this->data[$key] ?? $default;
    }

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

    public function merge(array $data): self
    {
        return new self(array_merge($this->data, $data));
    }

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