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

import com.tzld.piaoquan.recommend.server.service.recall.RecallParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 不区分地域小时（不做离线去重）
 *
 * @author dyp
 */
@Service
public class RegionHWithoutDupRecallStrategy extends AbstractRegionRecallStrategy {
    public static final String PUSH_FORM = "rov_recall_h_h_without_dup";
    public static final String LAST_VIDEO_KEY_FORMAT = "recall:last:item:h:%s:%s";

    @Override
    protected String recordKey(RecallParam param) {
        return String.format("recall:last:record:h:%s:%s", param.getAppType(), param.getMid());
    }

    @Override
    protected String poolKey(RecallParam param, String now_dt, int h) {
        // hard code  因为生产任务，会给region填充默认值-1
        return String.format("recall:item:score:h:%s:%s:%s:%s",
                param.getDataKey(), param.getRuleKey(), now_dt, h);
    }

    @Override
    protected String lastVideoKey(RecallParam param) {
        return String.format(LAST_VIDEO_KEY_FORMAT, param.getAppType(), param.getMid());
    }

    @Override
    public String pushFrom() {
        return PUSH_FORM;
    }
}
