package com.qmth.boot.core.security.exception;

public class AuthorizationException extends RuntimeException {

    private static final long serialVersionUID = -2876981104626449737L;

    private int code;

    public static AuthorizationException TIME_INVALID = new AuthorizationException(401001, "time is invalid");

    public static AuthorizationException TIME_EXPIRED = new AuthorizationException(401002, "time has expired");

    public static AuthorizationException SIGNATURE_INVALID = new AuthorizationException(401003, "signature is invalid");

    public static AuthorizationException SIGNATURE_TYPE_INVALID = new AuthorizationException(401004,
            "signature type invalid");

    public static AuthorizationException IDENTITY_NOT_FOUND = new AuthorizationException(401005, "identity not found");

    public static AuthorizationException SECRET_ERROR = new AuthorizationException(401006, "secret error");

    public static AuthorizationException TOKEN_ERROR = new AuthorizationException(401007, "token error");

    public static AuthorizationException NO_PERMISSION = new AuthorizationException(401008, "no permission");

    public static AuthorizationException SERVICE_NOT_FOUND = new AuthorizationException(401009,
            "authorization service not found");

    public AuthorizationException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return code;
    }
}
