package com.fdkankan.common.constant;

/**
 * <p>
        是否成功状态枚举
 * </p>
 * @author dengsixing
 * @date 2022/1/28
 **/
public enum CommonSuccessStatus {

    FAIL(-1, "失败"),
    WAITING(0, "等待"),
    SUCCESS(1, "成功");

    private Integer code;
    private String message;

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

    public static CommonSuccessStatus get(Integer code){
        CommonSuccessStatus[] values = CommonSuccessStatus.values();
        Integer enumValue = null;
        for(CommonSuccessStatus eachValue : values){
            enumValue = eachValue.code();
            if(enumValue.equals(code)){
                return eachValue;
            }
        }
        return null;
    }

    public Integer code() {
        return code;
    }

    public String message() {
        return message;
    }

}
