All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.geotab.model.enumeration.DefectSeverity Maven / Gradle / Ivy

package com.geotab.model.enumeration;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * The severity of a defect for a DVIRLog.
 */
public enum DefectSeverity {

  /**
   * Severity level for Unregulated Defects (vehicle or trailer is safe to operate).
   */
  UNREGULATED("Unregulated", -1),

  /**
   * Normal defect severity.
   */
  NORMAL("Normal", 0),

  /**
   * Critical defect severity (vehicle or trailer is unsafe to operate).
   */
  CRITICAL("Critical", 1);

  private String name;
  private int code;

  DefectSeverity(String name, int code) {
    this.name = name;
    this.code = code;
  }

  public int getCode() {
    return code;
  }

  @JsonValue
  public String getName() {
    return name;
  }


  public static DefectSeverity findOrDefault(String value) {
    if (value == null) {
      return null;
    }
    switch (value) {
      case "Critical":
        return CRITICAL;
      case "Unregulated":
        return UNREGULATED;
      default:
        return NORMAL;
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy