package com.tzld.piaoquan.ad.engine.service.score.deprecated;


import com.tzld.piaoquan.ad.engine.commons.score.BaseLRModelScorer;
import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
import com.tzld.piaoquan.ad.engine.commons.score.ScorerConfigInfo;
import com.tzld.piaoquan.ad.engine.service.remote.ModelRemoteService;
import com.tzld.piaoquan.ad.engine.service.score.ServiceBeanFactory;
import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
import com.tzld.piaoquan.recommend.feature.domain.ad.base.UserAdFeature;

import java.util.List;


//@Service
public class VlogAdRosAndStrScorer extends BaseLRModelScorer {
    private ModelRemoteService modelRemoteService;

    public VlogAdRosAndStrScorer(ScorerConfigInfo scorerConfigInfo) {
        super(scorerConfigInfo);
        this.modelRemoteService = ServiceBeanFactory.getBean(ModelRemoteService.class);
    }

    @Override
    public List<AdRankItem> scoring(final ScoreParam param,
                                    final UserAdFeature userFeature,
                                    final List<AdRankItem> rankItems) {
        ModelRemoteService.Score score = modelRemoteService.getScore(param.getVideoId(), param.getMid(),
                param.getUid(), param.getCity(), param.getProvince());
        if (score != null) {
            for (AdRankItem item : rankItems) {
                item.setStr(score.getStr());
                item.setRos(score.getRos());
            }
        }
        return rankItems;
    }

    @Override
    public void loadModel() {
        // nothing;
    }
}