package com.tzld.longarticle.recommend.server.service.rank;

import com.aliyun.odps.utils.StringUtils;
import com.tzld.piaoquan.recommend.server.service.rank.strategy.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class RankRouter {
    @Autowired
    private RankService rankService;
    @Autowired
    private RankStrategy4Rankv2Model rankStrategy4Rankv2Model;
    @Autowired
    private RankStrategy4RankModel rankStrategy4RankModel;
    @Autowired
    private RankStrategy4Density rankStrategy4Density;
    @Autowired
    private RankStrategy4RegionMergeModelV536 rankStrategy4RegionMergeModelV536;
    @Autowired
    private RankStrategy4RegionMergeModelV551 rankStrategy4RegionMergeModelV3;
    @Autowired
    private RankStrategy4RegionMergeModelV546 rankStrategy4RegionMergeModelV546;
    @Autowired
    private RankStrategy4RegionMergeModelV547 rankStrategy4RegionMergeModelV547;
    @Autowired
    private RankStrategy4RegionMergeModelV548 rankStrategy4RegionMergeModelV548;
    @Autowired
    private RankStrategy4RegionMergeModelV551 rankStrategy4RegionMergeModelV551;
    @Autowired
    private RankStrategy4RegionMergeModelV552 rankStrategy4RegionMergeModelV552;
    @Autowired
    private RankStrategy4RegionMergeModelV553 rankStrategy4RegionMergeModelV553;
    @Autowired
    private RankStrategy4RegionMergeModelV561 rankStrategy4RegionMergeModelV561;
    @Autowired
    private RankStrategy4RegionMergeModelV562 rankStrategy4RegionMergeModelV562;
    @Autowired
    private RankStrategy4RegionMergeModelV563 rankStrategy4RegionMergeModelV563;
    @Autowired
    private RankStrategy4RegionMergeModelV564 rankStrategy4RegionMergeModelV564;
    @Autowired
    private RankStrategy4RegionMergeModelV565 rankStrategy4RegionMergeModelV565;
    @Autowired
    private RankStrategy4RegionMergeModelV566 rankStrategy4RegionMergeModelV566;
    @Autowired
    private RankStrategy4RegionMergeModelV567 rankStrategy4RegionMergeModelV567;
    @Autowired
    private RankStrategy4RegionMergeModelV999 rankStrategy4RegionMergeModelV999;
    @Autowired
    private RankStrategy4RegionMergeModelV569 rankStrategy4RegionMergeModelV569;
    @Autowired
    private RankStrategy4RegionMergeModelV650 rankStrategy4RegionMergeModelV650;
    @Autowired
    private RankStrategy4RegionMergeModelV654 rankStrategy4RegionMergeModelV654;
    @Autowired
    private RankStrategy4RegionMergeModelV655 rankStrategy4RegionMergeModelV655;
    @Autowired
    private FestivalStrategy4RankModel festivalStrategy4RankModel;

    @Autowired
    private RankStrategyFlowThompsonModel rankStrategyFlowThompsonModel;
    @Autowired
    private RankStrategy4RegionMerge rankStrategy4RegionMerge;
    @Autowired
    private RankStrategy4ShareDeepAndWidth rankStrategy4ShareDeepAndWidth;

    public RankResult rank(RankParam param) {
        String abCode = param.getAbCode();
        if (StringUtils.isBlank(abCode)) {
            return rankService.rank(param);
        }
        switch (abCode) {
            case "60097":
            case "60098": // 533
            case "60111": // 561
            case "60112": // 562
                return rankStrategy4Density.rank(param);
            case "60101":
                return rankStrategy4RankModel.rank(param);
            case "60113": // 563
                return rankStrategy4RegionMergeModelV563.rank(param);
            case "60114": // 564
                return rankStrategy4RegionMergeModelV564.rank(param);
            case "60115": // 565
                return rankStrategy4RegionMergeModelV565.rank(param);
            case "60116": // 566
                return rankStrategy4RegionMergeModelV566.rank(param);
            case "60117": // 567
                return rankStrategy4RegionMergeModelV567.rank(param);
            case "60118": // 568
                return rankStrategy4RegionMergeModelV999.rank(param);
            case "60119": // 569
                return rankStrategy4RegionMergeModelV569.rank(param);
            case "60120": // 576
                return rankStrategy4RegionMerge.rank(param);
            case "60121": // 536
                return rankStrategy4RegionMergeModelV536.rank(param);
            case "60122": // 537
                return rankStrategy4RegionMergeModelV546.rank(param);
            case "60123": // 541
                return rankStrategy4RegionMergeModelV3.rank(param);
            case "60124": // 546
                return rankStrategy4RegionMergeModelV546.rank(param);
            case "60125": // 547
                return rankStrategy4RegionMergeModelV547.rank(param);
            case "60126": // 548
                return rankStrategy4RegionMergeModelV548.rank(param);
            case "60105": // 551
                return rankStrategy4RegionMergeModelV551.rank(param);
            case "60106": // 552
                return rankStrategy4RegionMergeModelV552.rank(param);
            case "60107": // 553
                return rankStrategy4RegionMergeModelV553.rank(param);
            case "60130":
            case "60131":
            case "60132":
                return festivalStrategy4RankModel.rank(param);
            case "60150": // 645
                return rankStrategy4ShareDeepAndWidth.rank(param);
            case "60151": // 650
                return rankStrategy4RegionMergeModelV650.rank(param);
            case "60654": // 654
                return rankStrategy4RegionMergeModelV654.rank(param);
            case "60655": // 655
                return rankStrategy4RegionMergeModelV655.rank(param);
            default:
                break;
        }
        return rankService.rank(param);
    }
}

