001package org.hl7.fhir.validation.cli.utils;
002
003import org.hl7.fhir.utilities.Utilities;
004
005public enum ValidationLevel {
006  HINTS,
007  WARNINGS,
008  ERRORS;
009
010  public static ValidationLevel fromCode(String v) {
011    if (Utilities.noString(v)) {
012      return HINTS;
013    }
014    v = v.toLowerCase();
015    if (Utilities.existsInList(v, "h", "i", "hints", "info")) {
016      return HINTS;
017    }
018    if (Utilities.existsInList(v, "w", "warning", "warnings")) {
019      return WARNINGS;
020    }
021    if (Utilities.existsInList(v, "e", "error", "errors")) {
022      return ERRORS;
023    }
024    return HINTS;
025  }
026}