local this = class("moduleAnnouncementPoster", G_UIModuleBase)

function this.bind()
  return {
    announcementContent = {
      moduleName = "pages/announcement/cellAnnouncementContent"
    },
    go_poster = true
  }
end

function this.methods()
  return {
    onClick_btn = function(self)
      if self.onClickBtn then
        self.onClickBtn()
      end
    end
  }
end

function this:initData(data)
  local content = data:getContent()
  local jumpParam = data:getJumpId()
  local array = jumpParam.split(jumpParam, ",")
  local jumpValue = array[1] or 0
  local isUrl = false
  if jumpValue ~= nil and 5 < #jumpValue then
    isUrl = true
  else
    jumpValue = tonumber(jumpValue)
  end
  local sizeDeltaX = tonumber(array[2] or 0)
  local sizeDeltaY = tonumber(array[3] or 0)
  self.modules.announcementContent.bind.announcementUrl = content
  self.modules.announcementContent:refresh()
  
  function self.onClickBtn()
    if jumpValue == nil then
      return
    end
    if isUrl then
      CS.UnityEngine.Application.OpenURL(jumpValue)
    elseif 0 < jumpValue then
      L_SystemBreakManager:jumpTo(jumpValue)
    end
  end
  
  local button = self.bindComponents.Button
  button.anchoredPosition = C_Vector2(sizeDeltaX, sizeDeltaY)
end

return this
