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

import cn.axzo.framework.rocketmq.Event;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @author yanglin
 */
@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum MqMessageType {

    OLD_MSG_SEND("old-msg", "old-msg-send", "发送旧消息"),
    TODO_PRESET_BUTTON_PRESSED("todo", "todo-preset-button-pressed", "预设按钮被点击"),
    TODO_STATE_UPDATE("todo", "todo-state-update", "待办状态变更(创建)");

    private final String eventModel;
    private final String eventName;
    private final String desc;

    public Event.EventCode getEventCode() {
        return Event.EventCode.builder()
                .module(eventModel)
                .name(eventName)
                .build();
    }

    public String getTag(String tagInfo) {
        if (StringUtils.isBlank(tagInfo))
            return eventName;
        return eventName + "-" + tagInfo;
    }

}