<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Kernel\Facades;

use PpPhp\Core\Platform\Kernel\Platform;
use PpPhp\Core\Platform\Runtime\PlatformRuntimeContext;

final class Runtime
{
    public static function boot(string $basePath): ?PlatformRuntimeContext
    {
        return Platform::boot($basePath)->runtime();
    }

    public static function context(): ?PlatformRuntimeContext
    {
        return Platform::runtime();
    }

    public static function booted(): bool
    {
        $runtime = Platform::runtime();

        return $runtime instanceof PlatformRuntimeContext && $runtime->state()->booted();
    }
}
