package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

/**
 * 合同付款状态
 */
@Getter
public enum ContractPayStatusEnum {

    UNDER_APPROVAL(0, "审批中"),
    HAVE_IN_HAND(1, "进行中"),
    COMPLETED(2, "已完成");

    private final Integer type;
    private final String name;

    private static final HashMap<Integer, ContractPayStatusEnum> map = new HashMap<>();

    ContractPayStatusEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    static {
        for (ContractPayStatusEnum value : ContractPayStatusEnum.values()) {
            map.put(value.getType(), value);
        }
    }

    /**
     * 根据type获取枚举
     */
    public static ContractPayStatusEnum get(Integer type) {
        return map.get(type);
    }

    /**
     * 根据type值获取枚举
     */
    public static String getName(Integer type) {
        return map.get(type).getName();
    }


}
