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

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

import java.util.Arrays;

/**
 * @author: wangli
 * @date: 2022/3/21 15:47
 */
@Getter
public enum MsgTypeEnum {
  GENERAL_MESSAGE(1, "普通消息"),
  PENDING_MESSAGE(2, "待办消息");

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

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

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

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

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