package com.zfire.jiasm.syncdata.constant;


import lombok.Getter;

/**
 * @author yaozx
 * @version 1.0
 * @date 2023-07-21
 */
@Getter
public enum AppraiseTypeEnum {
    SATISFACTION("SATISFACTION","好"),
    GENERAL("GENERAL","中"),
    DISPLEASURE("DISPLEASURE","差"),
    ELIMINATE("ELIMINATE","剔除"),
    OTHER_APPRISE("OTHER_APPRISE","其他"),



    ;


    /**
     * 编码
     */
    private final String code;


    private final String text;

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

    public static AppraiseTypeEnum getByCode(String code) {
        for (AppraiseTypeEnum item : values()) {
            if (code.equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }

    /**
     * @param code: code
     * @return 对应枚举
     **/
    public static String getMessageByCode(Integer code) {
        String result = null;
        for (AppraiseTypeEnum item : values()) {
            if (code.equals(item.getCode())) {
                result = item.getText();
                break;
            }
        }
        return result;
    }
}
