local ActivityPopManager = class("ActivityPopManager", BaseModule)

function ActivityPopManager:setFirstLogin(isFirstEnter)
	self.firstRechargePop = isFirstEnter
	self.giftPop = isFirstEnter
	self.giftPopChain = isFirstEnter
	self.activityPop = {
		isActSummon = isFirstEnter,
		isActSprint = isFirstEnter,
	}
end

-- 增加今日不再提示组件(注意只可以在 onLoadRootComplete 里调用且只可以调用一次)
function ActivityPopManager:addPopBar(parent, node)
	if not parent then
		return
	end
	local childList = parent:getChildList()
	for _, uiObj in pairs(childList) do
		if uiObj:getTag() == GConst.GAME_OBJECT_TAG.POP_SKIP_BAR then
			return
		end
	end
	local targetNode = node or parent
	UIPrefabManager:loadUIWidgetAsync("assets/prefabs/ui/common/pop_skip_bar.prefab", targetNode, function(prefabObject)
		local popBar = prefabObject:addLuaComponent(GConst.TYPEOF_LUA_CLASS.POP_SKIP_BAR)
		prefabObject:setTag(GConst.GAME_OBJECT_TAG.POP_SKIP_BAR)
		popBar:show()
	end)
end

function ActivityPopManager:checkFirstRechargePop()
	if DataManager.TutorialData:getIsInTutorial() then
		return false
	end

	if DataManager.ShopData:getNeedShowFirstRechargePop() then
		ModuleManager.ShopManager:showFirstRechargeUI()
        return true
    end

	return false
end

-- function ActivityPopManager:setGiftPopState(state)
-- 	self.giftPop = state
-- end

-- function ActivityPopManager:checkGiftPop()
-- 	if not self.giftPop then
-- 		return false
-- 	end

-- 	if self:checkPopGift() then
-- 		return true
-- 	end

-- 	return false
-- end

-- function ActivityPopManager:setGiftPopChainState(state)
-- 	self.giftPopChain = state
-- end

function ActivityPopManager:checkActivityPop()
	if self:checkActivityActivityPop() then
		return true
	end

	return false
end

-- function ActivityPopManager:checkPopGift()
-- 	local giftType, _ = DataManager.GiftPopData:getPopGiftType(self.giftPop)
-- 	self.giftPop = false
-- 	if not giftType then
-- 		return false
-- 	end
-- 	ModuleManager.GiftPopManager:showPopGiftUI({
-- 		popType = giftType
-- 	})
-- 	return true
-- end

function ActivityPopManager:checkActivityActivityPop()
	return self:checkActSprint()
end

-- 冲刺活动
function ActivityPopManager:checkActSprint()
	if not DataManager.ActSprintData:getIsOpen() or not DataManager.ActSprintData:showSideBar() then
		return false
	end
	local params = {}
	params.autoPop = true
    params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.ACT_SPRINT
    ModuleManager.ActSprintManager:showActSprintListUI(params)
	self.activityPop.isActSprint = false
	return true
end

return ActivityPopManager