<?php
declare(strict_types=1);
namespace PpPhp\Packages\Ui\Ppui\Foundation;
use PpPhp\Packages\Ui\Ppui\Foundation\Contracts\ValidatorInterface;
final class Validator implements ValidatorInterface
{
    public function validate(array $definition): array
    {
        $errors = [];
        if (!isset($definition['id']) || trim((string)$definition['id']) === '') $errors[] = 'Definition id is required.';
        if (!isset($definition['label']) || trim((string)$definition['label']) === '') $errors[] = 'Definition label is required.';
        return $errors;
    }
}
