<?php

namespace Opencart\Extension\Alsendo\Helpers;

class ValidationJsonResponseTransformer
{

    public static function transform(array $input): array
    {
        $inputError = $input['error'];
        $inputError = json_decode($inputError, true);

        $errors = [];
        foreach ($inputError['errors'] as $inputSingleError) {
            $errors[] = [
                'message' => $inputSingleError['message'],
                'field' => $inputSingleError['field'],
            ];
        }

        return $errors;
    }
}