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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * <p>
 * 公告/资讯发布状态枚举类型
 * </p>
 *
 * @author caiwq
 * @since 2024-03-01
 */
@Getter
@AllArgsConstructor
public enum NoticePublishStatusEnum {
    /**
     * 未发布
     */
    NO_PUBLISH(1, "未发布"),
    /**
     * 发布
     */
    PUBLISH(2, "发布"),
    /**
     * 关闭
     */
    CLOSE(3, "关闭");

    private final int value;
    private final String desc;

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

}
