/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package leap.oauth2.server;

import leap.core.i18n.MessageKey;

public class SimpleOAuth2Error implements OAuth2Error {

    protected int status;
    protected String error;
    protected String errorCode;
    protected String referral;
    protected String errorDescription;
    private MessageKey key;

    public SimpleOAuth2Error() {
        super();
    }

    public SimpleOAuth2Error(int status, String error, String errorDescription) {
        this.status = status;
        this.error = error;
        this.errorDescription = errorDescription;
    }

    public SimpleOAuth2Error(int status, String error, String errorDescription,MessageKey key) {
        this.status = status;
        this.error = error;
        this.errorDescription = errorDescription;
        this.key=key;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getErrorDescription() {
        return errorDescription;
    }

    public void setErrorDescription(String errorDescription) {
        this.errorDescription = errorDescription;
    }

    @Override
    public String getErrorCode() {
        return errorCode;
    }

    @Override
    public String getReferral() {
        return referral;
    }

    @Override
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

	public MessageKey getKey() {
		return key;
	}

	public void setKey(MessageKey key) {
		this.key = key;
	}

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public void setReferral(String referral) {
        this.referral = referral;
    }
}

@@ -948,26 +948,108 @@
 ror(
-) %7B%0A        super(
+int status, String error, String errorDescription) %7B%0A        this(status,error,errorDescription,null
 );%0A 
@@ -1124,32 +1124,47 @@
 errorDescription
+,MessageKey key
 ) %7B%0A        this
@@ -1167,85 +1167,220 @@
 this
-.
+(
 status
- = status;%0A        this.error = error;%0A        this.errorDescription =
+, error, null,errorDescription,key);%0A    %7D%0A    %0A    public SimpleOAuth2Error(int status, String error, String referral, String errorDescription,MessageKey key) %7B%0A        this(status, error, error,referral,
  err
@@ -1384,32 +1384,38 @@
 errorDescription
+, key)
 ;%0A    %7D%0A%0A    pub
@@ -1453,32 +1453,67 @@
 s, String error,
+ String errorCode, String referral,
  String errorDes
@@ -1513,32 +1513,33 @@
 rrorDescription,
+ 
 MessageKey key) 
@@ -1594,24 +1594,94 @@
 or = error;%0A
+        this.errorCode = errorCode;%0A        this.referral = referral;%0A
         this
@@ -1734,17 +1734,19 @@
 this.key
-=
+ = 
 key;%0A   

refactor Oauth2Error