package com.fjhx.purchase.entity.purchase.enums;

import org.apache.commons.collections4.MapUtils;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 采购数据来源
 */
public enum PurchaseDataResourceEnum {
    DATA_RESOURCE_0(0, "自建"),
    DATA_RESOURCE_1(1, "外销合同采购"),
    DATA_RESOURCE_2(2, "样品单采购"),
    ;
    private int key;

    private String value;

    private static Map<Integer, String> map = new LinkedHashMap<>();

    PurchaseDataResourceEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * 获取枚举map
     *
     * @return
     */
    public static Map<Integer, String> getMap() {
        if (MapUtils.isNotEmpty(map)) {
            return map;
        }
        for (PurchaseDataResourceEnum ms : values()) {
            map.put(ms.key, ms.value);
        }
        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

}
