<?php

namespace App\Modules\Integrations\Platform\Services;

use App\Modules\Integrations\Platform\Models\IntegrationEvent;

final class IntegrationEventReplayService
{
    public function __construct(private readonly WebhookDispatchService $dispatch) {}

    public function replay(string $eventUuid): int
    {
        $event = IntegrationEvent::query()->whereKey($eventUuid)->firstOrFail();

        return $this->dispatch->dispatchForEvent($event, true);
    }
}
