package com.ruoyi.web.domain.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

/**
 * 政务信息枚举类
 */
@Getter
public enum GovernmentInfoEnum {
    NON_PUBLISHED("未发布", 0),
    PUBLISHED("已发布", 1),
    REMOVED("下架",2);

    private final String text;

    private final int value;

    GovernmentInfoEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     */
    public static GovernmentInfoEnum getEnumByValue(Integer value) {
        if (ObjectUtil.isEmpty(value)) {
            return null;
        }
        for (GovernmentInfoEnum villageServiceEnum : GovernmentInfoEnum.values()) {
            if (villageServiceEnum.value == value) {
                return villageServiceEnum;
            }
        }
        return null;
    }
}
