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

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

/**
 * @author zhangran
 * @Date 2020/8/14 10:49
 * @Description
 */
public enum SystemTypeEnum {

  // 安卓系统
  ANDROID("android", "安卓"),

  // ios
  IOS("ios", "苹果");

  private final String type;
  public final String desc;

  SystemTypeEnum(String type, String desc) {
    this.type = type;
    this.desc = desc;
  }

  public String get() {
    return type;
  }

  /**
   * 判断是否存在
   *
   * @param type
   * @return
   */
  public static SystemTypeEnum getSystem(String type) {
    String lowType = type.toLowerCase();
    return Arrays.stream(SystemTypeEnum.values()).filter(it -> Objects.equals(it.type, lowType))
        .findFirst().orElse(null);
  }

}
