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

import org.apache.commons.collections4.MapUtils;

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

/**
 * 采购状态枚举
 */
public enum PurchaseStatusEnum {
    DRAFT(0, "草稿"),
    UNDER_REVIEW(10, "审批中"),
    REJECT(20, "驳回"),
    PASS(30,"已采购"),
    CENCELLATION(88,"作废"),
    TERMINATION(99,"终止"),
    ;
    private int key;

    private String value;

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

    PurchaseStatusEnum(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 (PurchaseStatusEnum ms : values()) {
            map.put(ms.key, ms.value);
        }
        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

}
