<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Runtime;

final class RuntimeConfiguration
{
    public function __construct(
        private readonly string $basePath,
        private readonly bool $debug = false,
        private readonly array $options = []
    ) {
    }

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

    public function debug(): bool
    {
        return $this->debug;
    }

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

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

    public function toArray(): array
    {
        return [
            'basePath' => $this->basePath,
            'debug' => $this->debug,
            'options' => $this->options,
        ];
    }
}
