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

import cn.azxo.framework.common.model.EnumBase;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 消息模板类型
 *
 * 模板类型(1:验证码;2:短信通知;3:推广短信;4:群发助手)
 *
 * @author zhaoyong
 * @see MessageTemplateTypeEnum
 * @since 2021-07-12 13:34
 */
@RequiredArgsConstructor
@Getter
public enum MessageTemplateTypeEnum implements EnumBase<Integer> {

  /**
   * 发送短信状态
   */
  VERIFICATION_CODE(1, "验证码"),
  SHORT_NOTE(2, "短信通知"),
  PROMOTIONAL(3, "推广短信"),
  BROADCAST(4, "群发助手"),
  ;

  private final Integer code;

  private final String message;

  public static boolean isShortNote(Integer code) {
    return VERIFICATION_CODE.getCode().equals(code);
  }

  public static MessageTemplateTypeEnum getByCode(Integer code){
    for (MessageTemplateTypeEnum value : MessageTemplateTypeEnum.values()) {
      if (value.getCode().equals(code)) {
        return value;
      }
    }
    return null;
  }

}
