/*
 * Copyright © 2020 Cask Data, Inc.
 *
 * 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 io.cdap.delta.api.assessment;

import java.util.Objects;

/**
 * An assessment about some type of entity.
 */
public class Problem {
  private final String name;
  private final String description;
  private final String suggestion;
  private final String impact;

  public Problem(String name, String description, String suggestion, String impact) {
    this.name = name;
    this.description = description;
    this.suggestion = suggestion;
    this.impact = impact;
  }

  /**
   * @return name of the entity that is being assessed
   */
  public String getName() {
    return name;
  }

  /**
   * @return description of what might be wrong
   */
  public String getDescription() {
    return description;
  }

  /**
   * @return suggestion for what to do next to fix the potential problem
   */
  public String getSuggestion() {
    return suggestion;
  }

  /**
   * @return impact of the potential problem
   */
  public String getImpact() {
    return impact;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Problem that = (Problem) o;
    return Objects.equals(name, that.name) &&
      Objects.equals(description, that.description) &&
      Objects.equals(suggestion, that.suggestion) &&
      Objects.equals(impact, that.impact);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, description, suggestion, impact);
  }
}

@@ -863,16 +863,52 @@
 impact;%0A
+  private final Severity severity;%0A%0A
 %0A  publi
@@ -982,24 +982,198 @@
 g impact) %7B%0A
+    this(name, description, suggestion, impact, Severity.ERROR);%0A  %7D%0A  public Problem(String name, String description, String suggestion, String impact, Severity severity) %7B%0A
     this.nam
@@ -1274,24 +1274,54 @@
 t = impact;%0A
+    this.severity = severity;%0A
   %7D%0A%0A  /**%0A 
@@ -1808,24 +1808,143 @@
 mpact;%0A  %7D%0A%0A
+  /**%0A   * @return severity of the potential problem%0A   */%0A  public Severity getSeverity() %7B%0A    return severity;%0A  %7D%0A%0A
   @Override%0A
@@ -2325,24 +2325,73 @@
 that.impact)
+ &&%0A      Objects.equals(severity, that.severity)
 ;%0A  %7D%0A%0A  @Ov
@@ -2484,17 +2484,125 @@
 , impact
-);
+, severity);%0A  %7D%0A%0A  /**%0A   * The severity of the problem%0A   */%0A  public enum Severity %7B%0A    ERROR,%0A    WARNING
 %0A  %7D%0A%7D%0A

add severity for a problem (#155)