<?php

namespace App\Jobs;

use App\Services\FacebookCapiService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class SendFacebookCapiEvent implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $eventName;
    protected $data;
    protected $userData;
    protected $options;

    public function __construct($eventName, $data = [], $userData = [], $options = [])
    {
        $this->eventName = $eventName;
        $this->data = $data;
        $this->userData = $userData;
        $this->options = $options;
    }

    public function handle(FacebookCapiService $service)
    {
        // Use the actual service logic to send
        $service->processEvent($this->eventName, $this->data, $this->userData, $this->options);
    }
}
