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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 首单优惠配置状态，对应 {@code mall_first_order_config.status}。
 *
 * @author jeesharp
 * @since 2026-06-06
 */
@Getter
@AllArgsConstructor
public enum MallFirstOrderConfigStatusEnum {

    DISABLED(0, "禁用"),
    ENABLED(1, "启用");

    private final Integer value;
    private final String desc;

    public static MallFirstOrderConfigStatusEnum fromValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (MallFirstOrderConfigStatusEnum item : values()) {
            if (item.value.equals(value)) {
                return item;
            }
        }
        return null;
    }

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