import type IMessageEventPlugin from '../../IMessageEventPlugin'
import type VideoSendInfo from '../mode/VideoSendInfo'
import type VideoBusy from '../mode/VideoBusy'
import {usePeerStore} from '@/store/peerStore'
import SendVideoCode from "@/plugins/video/SendVideoCode";

class IMessageEventBusy implements IMessageEventPlugin<VideoBusy> {
  //代码类型
  code = SendVideoCode.BUSY

  //监听消息
  listener(videoSendInfo: VideoSendInfo<VideoBusy>) {
    const { message } = videoSendInfo
    if(message.fromId === usePeerStore().callId){
      usePeerStore().updateCloseStatus(true)
    }
  }
}
export default IMessageEventBusy
