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

/**
 * 预测模型状态枚举
 */
public enum CostModelStatusEnum {
    /**
     * 草稿
     */
    Draft("Draft", "草稿"),
    /**
     * 已删除
     */
    Delete("Deleted", "已删除"),
    /**
     * 已发布
     */
    Published("Published", "已发布");

    private final String code;
    private final String name;

    CostModelStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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

    /**
     * 根据text获取code
     *
     * @param name
     * @return
     */
    public static String getCodeByName(String name) {
        for (CostModelStatusEnum value : CostModelStatusEnum.values()) {
            if (value.name().equals(name)) {
                return value.name();
            }
        }
        return name;
    }
}
