<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Runtime;

final class RuntimeState
{
    private bool $booted = false;
    private array $messages = [];

    public function markBooted(): void
    {
        $this->booted = true;
    }

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

    public function message(string $message): void
    {
        $this->messages[] = $message;
    }

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

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