package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

/**
 * 合同状态
 */
@Getter
public enum ContractStatusEnum {

    TO_BE_CONFIRMED(0, "待确认"),
    UNDER_APPROVAL(1, "审批中"),
    HAVE_IN_HAND(2, "进行中"),
    COMPLETED(3, "已完成");

    private final Integer type;
    private final String name;

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

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

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

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

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


}
