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

import com.smppw.common.pojo.IStrategy;

import java.util.stream.Stream;

// 第三级策略
public enum ThirdStrategy implements IStrategy {
    BuyLowSellHigh(10010101, "主观选股", "", "IN00000008"),
    PrivtPlcIPOAllct(10010102, "定增打新", "", "IN00000008"),
    CSI300Strong(10010201, "沪深300增强", "", "IN00000008"),
    CSI500Strong(10010202, "中证500增强", "", "IN0000007M"),
    CSI1000Strong(10010203, "中证1000增强", "", "IN0000008O"),
    OtherEifStrgy(10010204, "其他指增", "", "IN00000008"),
    StkPickQuant(10010205, "量化选股", "", "IN0000028E"),
    ActTrendFlw(10030101, "主观趋势", "", "IN0000008S"),
    ActMktNutrl(10030102, "主观套利", "", "IN0000008S"),
    MltFutMgtStrgy(10030103, "主观多策略", "", "IN0000008S"),
    TrendFlwQuant(10030201, "量化趋势", "", "IN0000008S"),
    MktNutrlQuant(10030202, "量化套利", "", "IN0000008S"),
    MltFutMgtQuant(10030203, "量化多策略", "", "IN0000008S"),
    ThirdOthers(-99999, "无三级策略", "", "");
    private int id;
    private String nameDesc;
    private String rongZhiIndex;
    private String benchmark;

    private ThirdStrategy(int id, String nameDesc, String rongZhiIndex, String benchmark) {
        this.id = id;
        this.nameDesc = nameDesc;
        this.rongZhiIndex = rongZhiIndex;
        this.benchmark = benchmark;
    }

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

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

    public int getId() {
        return id;
    }

    public String getNameDesc() {
        return nameDesc;
    }

    public String getRongZhiIndex() {
        return rongZhiIndex;
    }

    public String getBenchmark() {
        return benchmark;
    }

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

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

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