package com.smppw.common.pojo.enums;

import lombok.Getter;

@Getter
public enum BarraStyleRespEnum {
    //beta_book-to-price-ratio_earnings-yield_growth_leverage_liquidity_momentum_non-linear-size_residual-volatility_size
    BETA(1,2,"beta","贝塔","beta因子"),
    BOOKTOPRICERATIO(2,10,"bookToPriceRatio","账面市值比","账面市值比因子"),
    EARNINGSYIELD(3,9,"earningsYield","盈利率","盈利预期因子"),
    GROWTH(4,4,"growth","成长性","成长因子"),
    LEVERAGE(5,6,"leverage","杠杆率","杠杆因子"),
    LIQUIDITY(6,1,"liquidity","流动性","流动性因子"),
    MOMENTUM(7,5,"momentum","动量","动量因子"),
    NONLINEARSIZE(8,7,"nonLinearSize","非线性市值","非线性市值因子"),
    RESIDUALVOLATILITY(9,3,"residualVolatility","残差波动率","残差波动因子"),
    SIZE(10,8,"size","规模","市值因子"),
    ;

    private Integer num;
    private Integer posNum;
    private String name;
    private String cName;
    private String yName;

    BarraStyleRespEnum(Integer num, Integer posNum, String name, String cName, String yName) {
        this.num = num;
        this.posNum = posNum;
        this.name = name;
        this.cName = cName;
        this.yName = yName;
    }

    public static String getBarrCname(int num){
        for (BarraStyleRespEnum barrNum : BarraStyleRespEnum.values()){
            if (barrNum.getNum() == num) {
                return barrNum.getCName();
            }
        }
        return "";
    }

    public static BarraStyleRespEnum getBarrEnum(int num){
        for (BarraStyleRespEnum barrNum : BarraStyleRespEnum.values()){
            if (barrNum.getNum().intValue() == num) {
                return barrNum;
            }
        }
        return null;
    }

    public static BarraStyleRespEnum getBarrEnumPos(int posNum){
        for (BarraStyleRespEnum barrNum : BarraStyleRespEnum.values()){
            if (barrNum.getPosNum().intValue() == posNum) {
                return barrNum;
            }
        }
        return null;
    }


    public static String getBarrYNameByName(String name){
        for (BarraStyleRespEnum barrNum : BarraStyleRespEnum.values()){
            if (barrNum.getName().equals(name)) {
                return barrNum.getYName();
            }
        }
        return "";
    }

}
