package com.sf.service.gateway.enums;

/**
 * 网关策略类型
 * 
 * @author zoukun
 */
public enum GatewayStrategyType
{
    AUTHENTICATION("AUTHENTICATION", "认证策略"),
    PERMISSION("PERMISSION", "鉴权策略"),
    CURRENT_LIMITING("CURRENT_LIMITING", "限流策略"),
    CIRCUIT_BREAKER("CIRCUIT_BREAKER", "熔断策略")
    ;

    private final String code;
    private final String info;

    GatewayStrategyType(String code, String info)
    {
        this.code = code;
        this.info = info;
    }

    public String getCode()
    {
        return code;
    }

    public String getInfo()
    {
        return info;
    }

    public static GatewayStrategyType getByCode(String code){
        for (GatewayStrategyType value : GatewayStrategyType.values()) {
            if (value.code.equals(code)){
                return value;
            }
        }
        return null;
    }
}
