<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Workflow\Verification;

final class WorkflowRuntimeSerializer
{
    public function encode(array $data): string
    {
        return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ?: '{}';
    }

    public function decode(string $json): array
    {
        $data = json_decode($json, true);
        return is_array($data) ? $data : [];
    }
}
