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

class IMessageEventClose implements IMessageEventPlugin<VideoClose> {
  //代码类型
  code = SendVideoCode.CLOSE

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