package com.cool.store.enums;

/**
 * @Author suzhuhong
 * @Date 2023/6/19 19:48
 * @Version 1.0
 */
public enum AcceptAdjustTypeEnum {

    NOT_ACCEPT(0,"不接受调剂"),
    NATIONAL_ADJUSTMENT(1,"全国调剂"),
    PROVINCIAL_ADJUSTMENT(2,"省内调剂"),
    LOCAL_ADJUSTMENT(3,"市内调剂"),




    ;

    private Integer code;

    private String message;

    AcceptAdjustTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


    public  String getMessage(String enums) {
        return AcceptAdjustTypeEnum.valueOf(enums).getMessage();
    }


    public  Integer getCode(String enums) {
        return AcceptAdjustTypeEnum.valueOf(enums).getCode();
    }


    /**
     * 根据name查找
     * @param message 枚举message
     * @return 枚举对象
     */
    public static Integer findEnumByName(String message) {
        for (AcceptAdjustTypeEnum statusEnum : AcceptAdjustTypeEnum.values()) {
            if (statusEnum.getMessage().equals(message)) {
                //如果需要直接返回code则更改返回类型为String,return statusEnum.code;
                return statusEnum.getCode();
            }
        }
      return  null;
    }
}
