<?php

namespace App\Tasks;

use App\Services\PushNotificationDispatcher;
use Illuminate\Support\Facades\Log;
use Throwable;

class SendPushNotificationsTask
{
    public function __construct(private PushNotificationDispatcher $dispatcher) {}

    public function __invoke(): void
    {
        try {
            $this->dispatcher->dispatch();
        } catch (Throwable $e) {
            Log::error('Falha ao executar SendPushNotificationsTask: '.$e->getMessage(), [
                'exception' => $e,
            ]);
        }
    }
}
