"use strict";
const common_vendor = require("../../../../common/vendor.js");
const TUIKit_utils_env = require("../../../utils/env.js");
const common_assets = require("../../../../common/assets.js");
const TUIKit_constant = require("../../../constant.js");
class ConversationHeaderServer {
  static getInstance() {
    if (!ConversationHeaderServer.instance) {
      ConversationHeaderServer.instance = new ConversationHeaderServer();
    }
    return ConversationHeaderServer.instance;
  }
  getMenu() {
    const list = this.generateMenuList();
    if (!TUIKit_utils_env.isPC && list.length > 0) {
      return [{
        text: common_vendor.Wt.t("TUIConversation.发起会话"),
        data: {
          name: "all",
          children: list
        }
      }];
    }
    return list;
  }
  generateMenuList() {
    const list = [
      {
        icon: common_assets.C2C,
        text: common_vendor.Wt.t("TUIConversation.发起单聊"),
        data: {
          name: TUIKit_constant.CONV_CREATE_TYPE.TYPEC2C
        },
        listener: {
          onClicked: this.createConversation.bind(this)
        }
      },
      {
        icon: common_assets.createGroup,
        text: common_vendor.Wt.t("TUIConversation.发起群聊"),
        data: {
          name: TUIKit_constant.CONV_CREATE_TYPE.TYPEGROUP
        },
        listener: {
          onClicked: this.createConversation.bind(this)
        }
      }
    ];
    return list;
  }
  createConversation(item) {
    common_vendor.R.callService({
      serviceName: common_vendor.E.TUIConversation.SERVICE.NAME,
      method: common_vendor.E.TUIConversation.SERVICE.METHOD.CREATE_CONVERSATION,
      params: item
    });
  }
}
exports.ConversationHeaderServer = ConversationHeaderServer;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIConversation/conversation-header/server.js.map
