package com.tzld.piaoquan.recommend.server.service.recall.strategy;

import com.tzld.piaoquan.recommend.server.service.flowpool.FlowPoolConstants;
import com.tzld.piaoquan.recommend.server.service.recall.RecallParam;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @author dyp
 */
@Service
public class QuickFlowPoolWithLevelRecallStrategy extends AbstractFlowPoolWithLevelRecallStrategy {
    @Value("${flow.pool.upgrade.switch:true}")
    private boolean flowPoolUpgradeSwitch;

    @Override
    Pair<String, String> flowPoolKeyAndLevel(RecallParam param) {
        return flowPoolUpgradeSwitch
                ? Pair.of(String.format("flow:pool:quick:item:%s:3", 0), "")
                : Pair.of(String.format("flow:pool:quick:item:%s:3", param.getAppType()), "");
    }

    @Override
    public String pushFrom() {
        return FlowPoolConstants.QUICK_PUSH_FORM;
    }

}
