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 NoticeTopStatusEnum {

    /**
     * 未置顶
     */
    NO_TOP(0, "未置顶"),
    /**
     * 置顶
     */
    TOP(1, "置顶");

    private final int value;
    private final String desc;

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