package com.zzsmart.qomo.kn.cost.manage.enums;

/**
 * @Classname StandardStageEnum
 * @Description 阶段枚举
 * @Version 1.0.0
 * @Date 2024/6/18 9:51
 * @Created wangqiong
 */
public enum StandardStageEnum {
    INIT("A", "初始"),
    FIRST_BATCH("B", "首批"),
    MASS_PRODUCTION("C", "量产"),


    ;

    private final String code;
    private final String text;

    StandardStageEnum(String code, String text)
    {
        this.code = code;
        this.text = text;
    }

    public String getCode()
    {
        return code;
    }

    public String getText()
    {
        return text;
    }
    /**
     * 根据code获取text
     * @param codeNo
     * @return
     */
    public static String getTextByCode(String codeNo){
        for (StandardStageEnum value : StandardStageEnum.values()) {
            if (value.getCode().equals(codeNo)){
                return value.getText();
            }
        }
        return codeNo.toString();
    }

    /**
     * 根据text获取code
     * @param textStr
     * @return
     */
    public static String getCodeByText(String textStr){
        for (StandardStageEnum value : StandardStageEnum.values()) {
            if (value.getText().equals(textStr)){
                return value.getText();
            }
        }
        return textStr;
    }
}
