<?php


namespace App\Events;

//外部人员与跟进员工操作事件新增，删除外部人员，删除跟进员工
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ExternalAndFollowOperateEvent
{
    use Dispatchable, InteractsWithSockets,SerializesModels;

    /*
     * 企微ID
     */
    public $corpId;

    /*
    * 跟进成员ID
    */
    public $followUserId;

    /*
    * 外部联系人ID
    */
    public $externalUserId;

    /*
     * 事件类型:1:添加好友、2：删除企业客户(用户)、3：删除跟进人员(内部员工)
    */
    public $eventType;
    /*
     * 企业自定义的state参数，用于区分不同的添加渠道
    */
    public $state = '';

    /**
     * Create a new event instance.
     *
     * @param $corpId
     * @param $followUserId
     * @param $externalUserId
     * @param $eventType
     * @param $state
     */
    public function __construct($corpId, $followUserId , $externalUserId, $eventType, $state='')
    {
        $this->corpId = $corpId;
        $this->followUserId = $followUserId;
        $this->externalUserId = $externalUserId;
        $this->eventType = $eventType;
        $this->state     = $state;
    }
    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }

}