package cn.axzo.msg.center.domain.enums;

import java.util.Arrays;

/**
 * 用户类型枚举
 */
public enum UserTypeEnum {

  CM(1, "cm_worker"),

  TEAM(2, "cm_leader"),

  CMP(3, "cmp"),
  /**
   * 普通类型
   */
  NORMAL(5,"normal"),

  NOT_IDENTITY(9,"not_identity"),

  ;

  private Integer value;

  private String name;

  public Integer getValue() {
    return this.value;
  }

  public String getName() {
    return name;
  }

  private UserTypeEnum(Integer value, String name) {
    this.value = value;
    this.name = name;
  }

  public static UserTypeEnum getByName(String name) {
    return Arrays.stream(values()).filter(it -> it.name.equals(name)).findFirst()
        .orElse(null);
  }

  public static UserTypeEnum valueOf(Integer type) {
    return Arrays.stream(values()).filter(it -> it.value.equals(type)).findFirst().orElse(null);
  }
}
