<?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 CancellationRejected
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public CancellationRequest $cancellationRequest;

    public string $reason;

    public function __construct(CancellationRequest $cancellationRequest, string $reason = '')
    {
        $this->cancellationRequest = $cancellationRequest;
        $this->reason = $reason;
    }

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