package cn.sikey.mcdisk.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: nelson
 * @Date: 2025/5/29
 * @Description: 消息类型
 */
@AllArgsConstructor
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum MessageType {

    // 移动云盘业务

    /**
     * 通知家长授权
     */
    NOTIFY_PARENTS_AUTHORIZATION(70, "publish.notice.notify-parents-authorization"),

    /**
     * 开通成功通知家长
     */
    NOTIFY_PARENTS_SUCCESSFUL_ACTIVATION(71, "publish.notice.notify-parents-successful-activation"),

    /**
     * 手表退出后 通知手表重新登录
     */
    RELOGIN_ON_WWATCH(72, "publish.notice.relogin-on-watch"),

    /**
     * 手表暂未开通云相册服务，通知手表开通云相册服务
     */
    ACTIVATE_CLOUD_PHOTO_ALBUM_SERVICE(73, "publish.notice.activate-cloud-photo-album-service"),

    ;

    @JsonValue
    private final Integer value;
    private final String routingKey;

    /**
     * 根据 value 获取 MessageType
     *
     * @param value value
     * @return MessageType
     */
    public static MessageType valueOf(Integer value) {
        for (MessageType messageType : MessageType.values()) {
            if (messageType.value.equals(value)) {
                return messageType;
            }
        }
        throw new RuntimeException("Invalid MessageType value: " + value);
    }
}
