package cn.reghao.tnb.user.app.model.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author reghao
 * @date 2024-09-13 09:26:59
 */
public enum BillType {
    InCome(1, "收入"),
    Expenditure(2, "支出");

    private final int code;
    private final String desc;

    private static Map<Integer, String> descMap = new HashMap<>();
    static {
        for (BillType type : BillType.values()) {
            descMap.put(type.code, type.desc);
        }
    }
    BillType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getName() {
        return this.name();
    }

    public Integer getCode() {
        return code;
    }

    public static String getDescByCode(int code) {
        return descMap.get(code);
    }
}
