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 InvoiceOrderTypeEnum {
    ONE(1, "申请发货单"),
    TWO(2, "退货单"),
    THREE(3, "直调发货单")

    ;

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

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