local ActLeadingQuestData = BaseClass("ActLeadingQuestData", ActivityInfoData)
local base = ActivityInfoData
local __init = function(self)
  base.__init(self)
  self.taskList = {}
  self.taskConfigStr = ""
  self.taskGroups = {}
end
local __delete = function(self)
  self.taskList = nil
  self.taskConfigStr = nil
  self.taskGroups = nil
  base.__delete(self)
end
local ParseData = function(self, serverData)
  if not serverData then
    return
  end
  base.ParseActivityData(self, serverData)
  if serverData.taskList then
    self.taskList = serverData.taskList
  end
  if serverData.taskConfigStr then
    self.taskConfigStr = serverData.taskConfigStr
  end
  self:InitTaskGroup()
end
local GetRedCount = function(self)
  local num = 0
  for i, taskList in ipairs(self.taskGroups) do
    for m, taskId in ipairs(taskList) do
      local taskInfo = DataCenter.TaskManager:FindTaskInfo(taskId)
      if not taskInfo or taskInfo.state == 0 then
        break
      end
      if taskInfo.state == 1 then
        num = num + 1
        break
      end
    end
  end
  return num
end
local InitTaskGroup = function(self)
  self.taskGroups = {}
  local arrGroups = string.split(self.taskConfigStr, "|")
  for i, v in ipairs(arrGroups) do
    if not string.IsNullOrEmpty(v) then
      local tasks = string.split(v, ";")
      local tempGroup = {}
      for m, n in ipairs(tasks) do
        table.insert(tempGroup, n)
      end
      table.insert(self.taskGroups, tempGroup)
    end
  end
end
local GetTaskGroups = function(self)
  return self.taskGroups
end
ActLeadingQuestData.__init = __init
ActLeadingQuestData.__delete = __delete
ActLeadingQuestData.ParseData = ParseData
ActLeadingQuestData.GetRedCount = GetRedCount
ActLeadingQuestData.InitTaskGroup = InitTaskGroup
ActLeadingQuestData.GetTaskGroups = GetTaskGroups
return ActLeadingQuestData
