package com.jeesharp.business.modules.setting.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 运营弹窗上下线状态，对应表字段 {@code cfg_operation_popup.status}。
 *
 * @author jeesharp
 * @since 2026-05-13
 */
@Getter
@AllArgsConstructor
public enum OperationPopupStatusEnum {

    /**
     * 禁用
     */
    DISABLED(0, "禁用"),

    /**
     * 启用
     */
    ENABLED(1, "启用");

    private final Integer value;

    private final String desc;

    public static OperationPopupStatusEnum fromValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (OperationPopupStatusEnum e : values()) {
            if (e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }

    public static String getDescByValue(Integer value) {
        OperationPopupStatusEnum e = fromValue(value);
        return e != null ? e.getDesc() : "";
    }
}
