package com.cloudera.server.web.cmf;

import com.google.common.collect.ImmutableList;

public class CancelWorkResponse
{
  private ImmutableList<String> errors = ImmutableList.of();
  private ImmutableList<String> warnings = ImmutableList.of();

  public static CancelWorkResponse createSuccessResponse()
  {
    return new CancelWorkResponse();
  }

  public static CancelWorkResponse createErrorResponse(String error) {
    CancelWorkResponse response = new CancelWorkResponse();
    response.errors = ImmutableList.of(error);
    return response;
  }

  public static CancelWorkResponse createWarningResponse(String warning) {
    CancelWorkResponse response = new CancelWorkResponse();
    response.warnings = ImmutableList.of(warning);
    return response;
  }

  public ImmutableList<String> getErrors() {
    return this.errors;
  }

  public ImmutableList<String> getWarnings() {
    return this.warnings;
  }

  public boolean hasErrorsOrWarnings() {
    return (this.errors.size() > 0) || (this.warnings.size() > 0);
  }
}