<?php

namespace App\Events\Applications;

use App\Models\Applications\Application;
use App\Models\Companies\CompanyMember;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ApplicationExpertChanged {
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public Application $application;
    public ?CompanyMember $previousExpert;

    public function __construct(Application $application, ?CompanyMember $previousExpert = null) {
        $this->application = $application;
        $this->previousExpert = $previousExpert;
    }

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