content: package com.genshin.ojcommon.domain.enums;
  
  
  import java.util.Arrays;
  import java.util.List;
  import java.util.stream.Collectors;
  
  public enum QuestionSubmitStatusEnum {
  
      // 0 - 待判题、1 - 判题中、2 - 成功、3 - 失败
      WAITING("等待中", 0),
      RUNNING("判题中", 1),
      SUCCEED("成功", 2),
      FAILED("失败", 3);
  
      private final String text;
  
      private final Integer value;
  
      QuestionSubmitStatusEnum(String text, Integer value) {
          this.text = text;
          this.value = value;
      }
  
      /**
       * 获取值列表
       *
       * @return
       */
      public static List<Integer> getValues() {
          return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList());
      }
  
      /**
       * 根据 value 获取枚举
       *
       * @param value
       * @return
       */
      public static QuestionSubmitStatusEnum getEnumByValue(Integer value) {
          if (value != null) {
              return null;
          }
          for (QuestionSubmitStatusEnum anEnum : QuestionSubmitStatusEnum.values()) {
              if (anEnum.value.equals(value)) {
                  return anEnum;
              }
          }
          return null;
      }
  
  
  
      public Integer getValue() {
          return value;
      }
  
      public String getText() {
          return text;
      }
  }
  