"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const TUIChatEngine = require("@tencentcloud/chat-uikit-engine");
const tuiCustomerServicePlugin = require("@tencentcloud/tui-customer-service-plugin");
const typeCheck = require("../../utils/type-check.js");
function isCallMessage(message) {
  var _a;
  const payloadData = typeCheck.JSONToObject((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.data);
  if ((payloadData == null ? void 0 : payloadData.businessID) === 1 && (payloadData == null ? void 0 : payloadData.data)) {
    const payloadDataData = typeCheck.JSONToObject(payloadData.data);
    if (payloadDataData.businessID === "av_call") {
      return true;
    }
  }
  return false;
}
function isRoomSignalingMessage(message) {
  var _a;
  const payloadData = typeCheck.JSONToObject((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.data);
  return (payloadData == null ? void 0 : payloadData.businessID) === "ROOM_INVITE_ACTION" || (payloadData == null ? void 0 : payloadData.businessID) === "tuikit_engine_room";
}
function isRoomCardMessage(message) {
  var _a;
  const payloadData = typeCheck.JSONToObject((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.data);
  return (payloadData == null ? void 0 : payloadData.businessID) === "group_room_message";
}
function isPluginMessage(message) {
  return message.type === TUIChatEngine.TYPES.MSG_CUSTOM && (isCallMessage(message) || tuiCustomerServicePlugin.isCustomerServicePluginMessage(message) || isRoomCardMessage(message) || isRoomSignalingMessage(message));
}
exports.isCallMessage = isCallMessage;
exports.isPluginMessage = isPluginMessage;
exports.isRoomCardMessage = isRoomCardMessage;
exports.isRoomSignalingMessage = isRoomSignalingMessage;
