<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Streaming\Publisher;

final class PublisherValidator
{
    public function validate(PublishRequest $request): array
    {
        $issues = [];

        if ($request->publisherId() === '') {
            $issues[] = 'publisherId is required';
        }

        if ($request->topic() === '') {
            $issues[] = 'topic is required';
        }

        if ($request->type() === '') {
            $issues[] = 'type is required';
        }

        return [
            'ok' => $issues === [],
            'issues' => $issues,
        ];
    }
}
