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

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum NativeTypeEnum {

  //路由类型(0=null 1=uniapp 2=native 3=H5 4=webCms)", example = "1
  WEB(1,4),
  MINI_PROGRAM(2, 1),
  IOS(3, 2),
  ANDROID(4, 2),
  H5(5, 3),
  WECHAT_MP(6, 5),
  ;

  @EnumValue
  private final Integer code;
  private final Integer message;

  NativeTypeEnum(Integer code, Integer message) {
    this.code = code;
    this.message = message;
  }

  public Integer getCode() {
    return this.code;
  }

  public Integer getMessage() {
    return this.message;
  }

  public static NativeTypeEnum getByCode(Integer code) {
    return Arrays.stream(values()).filter(it -> it.code.equals(code)).findFirst().orElse(null);
  }

}
