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

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

    /*
    * 群ID
    */
    public $chatId;

    /*
    * 变更的群成员数组
    */
    public $memChangeArray;

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

    /*
    * 变更类型，当前默认update
    */
    public $changeType;

    /*
    * 变更详情类型：1:成员入群、2:成员退群
    */
    public $updateDetailType;

    /*
    * 入群时有值，0:成员邀请入群、3：扫描群二维码入群
    */
    public $joinScene;

    /*
    * 退群时有值，0:自己退群、1：群主/群管理员移出
    */
    public $quitScene;


    /**
     * Create a new event instance.
     *
     * @param $corpId
     * @param $chatId
     * @param $memChangeArray
     * @param $changeType
     * @param $updateDetailType
     * @param $joinScene
     * @param $quitScene
     */
    public function __construct($corpId, $chatId, $memChangeArray, $changeType, $updateDetailType, $joinScene, $quitScene)
    {
        $this->corpId               = $corpId;
        $this->chatId               = $chatId;
        $this->memChangeArray       = $memChangeArray;
        $this->changeType           = $changeType;
        $this->updateDetailType     = $updateDetailType;
        $this->joinScene            = $joinScene;
        $this->quitScene            = $quitScene;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }



}