<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Dispatcher\Persistence;

use PpPhp\Core\Platform\Event\Dispatcher\Runtime\DispatcherRuntimeManager;

final class RuntimePersistence
{
    public function __construct(private readonly DispatcherRuntimeManager $manager) {}

    public function persist(): array
    {
        return $this->manager->save()->toArray();
    }

    public function restore(): array
    {
        return $this->manager->load()->toArray();
    }

    public function clear(): void
    {
        $this->manager->clear();
    }
}
