package com.zfire.mall.manager.enums;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

@Getter
@AllArgsConstructor
public enum OrderFullStatusEnum {
    ENABLE("ENABLE", "有效"),
    CLOSE("CLOSE", "失效"),
    DEL("DEL", "剔除"),
    ;

    @JsonValue
    @EnumValue
    private final String key;
    private final String value;

    public static String getName(String orderType) {
        if (StringUtils.isNotBlank(orderType)) {
            Map<String, Object> enumMap = EnumUtil.getNameFieldMap(OrderFullStatusEnum.class, "value");
            return enumMap.get(orderType).toString();
        }
        return "";
    }
}
