local this = {}

function this:rsp_syncLockSystem(sVal)
  local map = {}
  for i, v in pairs(sVal) do
    map[v] = true
  end
  self:initSystemUnlock(map)
  L_SystemUnlockManager:initialize()
end

function this:rsp_syncUnlockSystem(data)
  local sys = data.unlock_id
  for i, id in pairs(sys or {}) do
    if self.data.bitMap[id] then
      self:setSystemUnlock(id)
      L_SystemUnlockManager:addSystem(id)
      L_SystemUnlockManager:refreshLockers(id)
    end
  end
end

function this:rsp_syncBanSystem(data)
  for _, sInfo in ipairs(data.syslist) do
    if sInfo.status == 1 and not math.isEmpty(sInfo.sysId) then
      self.data.banMap[sInfo.sysId] = true
      self.data.banReason[sInfo.sysId] = sInfo.reason
    else
      self.data.banMap[sInfo.sysId] = nil
    end
    if sInfo.sysId == L_SystemConst.enum.waterMark then
      L_WaterMarkManager:refreshMarkNode(not self.data.banMap[sInfo.sysId])
    elseif sInfo.sysId == L_SystemConst.enum.testingWaterMark then
      L_WaterMarkManager:refreshTestWaterMark(not self.data.banMap[sInfo.sysId])
    end
    L_SystemUnlockManager:refreshLockers(sInfo.sysId)
  end
end

function this:dispathchGuideTriggerEvent(id)
  self:call(self.event.systemUnlockGuideEvent, id)
end

return this
