<?php

namespace App\Events;

use App\Models\CancellationRequest;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class CancellationApproved
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public CancellationRequest $cancellationRequest;

    public bool $immediate;

    public function __construct(CancellationRequest $cancellationRequest, bool $immediate = false)
    {
        $this->cancellationRequest = $cancellationRequest;
        $this->immediate = $immediate;
    }

    public function broadcastOn(): array
    {
        return [
            new PrivateChannel('channel-name'),
        ];
    }
}
