local this = class("moduleChatCommonWords", G_UIModuleBase)

function this:ctor(...)
  this.super.ctor(self, ...)
  self.data = {}
end

function this.bind()
  return {
    scrollList_commonWords = {
      moduleName = "modulePages/cellButtonCommon"
    }
  }
end

function this.methods()
  return {
    scrollList_commonWords = {
      onClick = function(self, bind)
        local callback = function()
          self.parent.bind.go_moduleCommonWords = false
          self.parent.bind.go_chatMask = false
        end
        if self.parent.data.selectPlayerUid ~= nil then
          L_ChatStore:req_sendChatInfo(self.parent.data.selectPlayerUid, L_Const.ChatInfoType.CHAT_COMMON, tostring(bind.id), callback)
        end
        if self.parent.data.selectMeetingChat == true then
          L_ChatStore:req_meetingChat(L_Const.ChatInfoType.CHAT_COMMON, tostring(bind.id), callback)
        end
      end
    }
  }
end

function this:open(options)
  this.super.open(self, options)
  self:initModule()
end

function this:close(options)
  this.super.close(self, options)
end

function this:initModule()
  self:initCommonWordsList()
end

function this:initCommonWordsList()
  local chatQuickTpl = L_GameTpl:getChatQuickTpl()
  local data = chatQuickTpl.data
  local tmp = {}
  for i, v in pairs(data) do
    table.insert(tmp, {
      id = chatQuickTpl:getId(v),
      txt_name = chatQuickTpl:getWords(v)
    })
  end
  self.bind.scrollList_commonWords:clear()
  self.bind.scrollList_commonWords:insert_array(tmp)
end

return this
