package com.red.circle.common.business.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author pengliang on 2020/4/24 19:32
 */
public enum ReportedApprovalStatusEnum {
  /**
   * 0.未审批 1.已审批 2.系统已处理
   */

  PENDING(0, "未审批"),

  /**
   * 通过
   */
  PASS(1, "已审批"),

  SYSTEM_HANDLE(2, "系统已处理");

  private final int value;

  private final String desc;

  ReportedApprovalStatusEnum(int value, String desc) {
    this.value = value;
    this.desc = desc;
  }

  public static String getDescByValue(int value) {
    return Arrays.stream(ReportedApprovalStatusEnum.values())
        .filter(reportedApprovalStatusEnum -> Objects
            .equals(reportedApprovalStatusEnum.getValue(), value))
        .findFirst()
        .map(ReportedApprovalStatusEnum::getDesc)
        .orElse("未知");
  }

  public int getValue() {
    return value;
  }

  public String getDesc() {
    return desc;
  }
}
