local this = class("chatStore", G_BaseStore)
this.event = {
  refreshMessage = "chatStore_refreshMessage",
  refreshConversationList = "chatStore_refreshConversationList",
  refreshChatShield = "chatStore_refreshChatShield",
  deleteConversation = "chatStore_deleteConversation",
  refreshMeetingMessage = "chatStore_refreshMeetingMessage",
  clearUnreadNum = "chatStore_clearUnreadNum",
  clearMeetingUnreadNum = "chatStore_clearMeetingUnreadNum",
  refreshEmojiInfo = "chatStore_refreshEmojiInfo"
}
this:importPartialClass(require(L_R.store .. "chat.chatState"))
this:importPartialClass(require(L_R.store .. "chat.chatAction"))

function this:clearUnreadNum(playerUid)
  local conversation = self:getConversation(playerUid)
  conversation.num = 0
  self:call(self.event.clearUnreadNum, playerUid)
end

function this:clearMeetingUnreadNum()
  if self.data.meetingConversation.num == 0 then
    return
  end
  self.data.meetingConversation.num = 0
  self:call(self.event.clearMeetingUnreadNum)
end

function this:resetMeetingConversation()
  self.data.meetingConversation = require(L_R.store .. "chat.data.conversation").new()
  self.data.meetingSwitchLineRecord = {}
end

function this:recordSwitchMeetingLine(lineId, mapId)
  local time = L_TimeUtil.getServerTime()
  self.data.meetingSwitchLineRecord[time] = {lineId = lineId, mapId = mapId}
end

function this:checkMsgIsValid(chat)
  if chat.type == L_Const.ChatInfoType.CHAT_NORMAL then
  elseif chat.type == L_Const.ChatInfoType.CHAT_EMOJI then
    local chatEmojiTpl = L_GameTpl:getChatEmojiTpl()
    local tpl = chatEmojiTpl:getTplById(tonumber(chat.msg))
    return not table.isEmpty(tpl)
  elseif chat.type == L_Const.ChatInfoType.CHAT_COMMON then
    local chatQuickTpl = L_GameTpl:getChatQuickTpl()
    local tpl = chatQuickTpl:getTplById(tonumber(chat.msg))
    return not table.isEmpty(tpl)
  end
  return true
end

return this
