package com.smppw.common.pojo.enums.strategy;

import java.util.stream.Stream;

// 新策略 - 第二级策略
public enum SubStrategy {
    OtherStrategy(-1, "其他策略", "", ""), /**/
    EquityLongOnly(100101, "主观多头", "IN000002D7", ""), /**/
    EquityQuantitative(100102, "量化多头", "IN000002D8", ""), /**/
    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", ""),
    MgtFutQuant(100302, "量化CTA", "IN000002DG", ""),
    OptionStrgy(100303, "期权策略", "IN000002DH", "IN0000008S"),
    OtherFutures(100304, "其他衍生品策略", "IN000002DI", "IN0000008S"),
    MacroStrgy(100401, "宏观策略", "IN000002DJ", "IN00000008"),
    ArbitrageStrgy(100402, "套利策略", "IN000002DK", "IN00000008"),
    CombinedStrgy(100403, "复合策略", "IN000002DL", "IN00000008"),
    FOF(100501, "FOF", "IN000002DM", ""), /**/
    MOM(100502, "MOM", "IN000002DN", ""),
    ; /**/

    private int id;
    private String name;
    private String rongZhiIndex;
    private String benchmark;

    private SubStrategy(int id, String name, String rongZhiIndex, String benchmark) {
        this.id = id;
        this.name = name;
        this.rongZhiIndex = rongZhiIndex;
        this.benchmark = benchmark;
    }

    public int getId() {
        return id;
    }
    public String getName() {
        return name;
    }

    public String getRongZhiIndex() {
        return rongZhiIndex;
    }

    public String getBenchmark() {
        return benchmark;
    }

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

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