package com.smppw.common.pojo;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

// 新策略 - 第二级策略
public enum NewSubStrategy implements IStrategy{
    OtherStrategy(-1, "其他策略", "", "IN00000008"), /**/
    EquityLongOnly(100101, "主观多头", "IN000002D7", "IN00000008"), /**/
    EquityQuantitative(100102, "量化多头", "IN000002D8", "IN00000008"), /**/
    EquityLongShort(100103, "股票多空", "IN000002D9", "IN00000008"), /**/
    EquityNeutral(100104, "股票市场中性", "IN000002DA", "IN00000008"), /**/
    BondPure(100201, "纯债策略", "IN000002DB", "IN00000077"), /**/
    BondStrong(100202, "债券增强", "IN000002DC", "IN00000077"), /**/
    BondMultiple(100203, "债券复合", "IN000002DD", "IN00000077"), /**/
    CnvtbBondTrd(100204, "转债交易策略", "IN000002DE", "IN0000008J"),
    ActMgtFut(100301, "主观CTA", "IN000002DF", "IN0000008S"),
    MgtFutQuant(100302, "量化CTA", "IN000002DG", "IN0000008S"),
    OptionStrgy(100303, "期权策略", "IN000002DH", "IN0000008S"),
    OtherFutures(100304, "其他衍生品策略", "IN000002DI", "IN0000008S"),
    MacroStrgy(100401, "宏观策略", "IN000002DJ", "IN00000008"),
    ArbitrageStrgy(100402, "套利策略", "IN000002DK", "IN00000008"),
    CombinedStrgy(100403, "复合策略", "IN000002DL", "IN00000008"),
    SubFOF(100501, "FOF", "IN000002DM", "IN00000008"), /**/
    MOM(100502, "MOM", "IN000002DN", "IN00000008"),
    ; /**/


    public static final List<NewSubStrategy> STRATEGY_LIST = Arrays.asList(EquityLongOnly, EquityQuantitative, EquityLongShort, EquityNeutral,
            BondPure, BondStrong,
            BondMultiple, CnvtbBondTrd, ActMgtFut, MgtFutQuant, OptionStrgy, OtherFutures,MacroStrgy,ArbitrageStrgy,CombinedStrgy, SubFOF,MOM);

    private Integer id;
    private String nameDesc;
    private String rongZhiIndex;
    private String benchmark;

    private NewSubStrategy(Integer id, String nameDesc, String rongZhiIndex, String benchmark) {
        this.id = id;
        this.nameDesc = nameDesc;
        this.rongZhiIndex = rongZhiIndex;
        this.benchmark = benchmark;
    }

    public Integer getId() {
        return id;
    }
    public String getNameDesc() {
        return nameDesc;
    }

    public String getRongZhiIndex() {
        return rongZhiIndex;
    }

    public String getBenchmark() {
        return benchmark;
    }

    public static NewSubStrategy getSubStrategy(int id) {
        return Stream.of(NewSubStrategy.values()).filter(e -> e.id == id).findFirst().orElse(null);
    }

    public static NewSubStrategy getStrategyByName(String name) {
        if (null == name){
            return null;
        }
        for(NewSubStrategy s : NewSubStrategy.values()){
            if(name.equals(s.getNameDesc()+"")){
                return s;
            }
        }
        return null;
    }

    public static NewSubStrategy getStrategyByN(String name) {
        if (null == name){
            return null;
        }
        for(NewSubStrategy s : NewSubStrategy.values()){
            if(name.equals(s.name())){
                return s;
            }
        }
        return null;
    }

    public static NewSubStrategy getStrategy(Integer id) {
        return Stream.of(NewSubStrategy.values()).filter(e -> e.id.equals(id)).findFirst().orElse(null);
    }

    @Override
    public Integer getStrategyId() {
        return this.getId();
    }

    @Override
    public String getStrategyOriginName() {
        return this.name();
    }

    @Override
    public String getStrategyNameDesc() {
        return this.getNameDesc();
    }
}
