<?php

namespace App\Events;


use App\Models\ProjectDownload;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Queue\SerializesModels;


class ProjectDownloadStatus implements ShouldBroadcastNow
{
    use SerializesModels;
    public ProjectDownload $projectDownload;

    /**
     * Create a new event instance.
     */
    public function __construct($projectDownload)
    {
        $this->projectDownload = $projectDownload;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     */
    public function broadcastOn(): Channel
    {
        logger('broadcastOn', ['download.'.$this->projectDownload->id]);
        return new PrivateChannel('download.'.$this->projectDownload->id);
    }
}
