
package de.ivu.elect.business.exchange.control;

import javax.annotation.Nullable;
import java.io.Serializable;

public class WebServiceErreichbarStatus implements Serializable {

  private static final long serialVersionUID = 1L;

  private final WebServiceStatus webServiceStatus;

  private final Exception exception;

  public WebServiceErreichbarStatus(WebServiceStatus webServiceStatus, @Nullable Exception exception) {
    super();

    this.webServiceStatus = webServiceStatus;
    this.exception = exception;
  }

  public WebServiceErreichbarStatus(WebServiceStatus status) {
    this(status, null);
  }

  @Nullable
  public Exception getException() {
    return exception;
  }

  protected static WebServiceStatus toWebServiceStatus(boolean isErreichbar){
    if (isErreichbar) {
      return WebServiceStatus.ERREICHBAR;
    }
    return WebServiceStatus.NICHT_ERREICHBAR;
  }

  public WebServiceStatus getWebServiceStatus() {
    return webServiceStatus;
  }
}
