package com.yuchen.saas.message.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * <p>
 * 通知类型枚举类型
 * </p>
 *
 * @author caiwq
 * @since 2024-02-23
 */
@Getter
@AllArgsConstructor
public enum PublishTypeEnum {

    /**
     * 自动发布
     */
    AUTO(1, "自动发布"),
    /**
     * 手动发布
     */
    HAND(2, "手动发布");

    private final int value;
    private final String desc;

    public static String getDescByCode(Integer value) {
        if (Objects.isNull(value)) {
            return "";
        }
        PublishTypeEnum[] enumArray = PublishTypeEnum.values();
        for (PublishTypeEnum e : enumArray) {
            if (e.getValue() == value) {
                return e.getDesc();
            }
        }
        return "";
    }

}
