package org.springblade.common.auth.permission;

/**
 * @author caiyihua
 */
public enum RequestMethodTypeEnum {
    ALL(0, "ALL"),
    POST(1, "POST"),
    GET(2, "GET"),
    PUT(3, "PUT"),
    DELETE(4, "DELETE"),
    ;

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

    private int code;
    private String text;

    public int getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static RequestMethodTypeEnum getEnumByCode(int code) {
        for (RequestMethodTypeEnum requestMethodTypeEnum : values()) {
            if (code == requestMethodTypeEnum.getCode()) {
                return requestMethodTypeEnum;
            }
        }

        return ALL;
    }
}
