package com.xjrsoft.common.enums;

/**
 * @author dzx
 * @date 2024/2/3
 */
public enum ConsumeTypeEnum {
    /**
     * 超市
     * */
    CONSUME_TYPE_2("consume_type_2", "超市"),
    /**
     * 食堂
     * */
    CONSUME_TYPE_1("consume_type_1", "食堂"),
    /**
     * 其他
     * */
    CONSUME_TYPE_4("consume_type_4", "其他"),
    /**
     * 图书馆
     * */
    CONSUME_TYPE_3("consume_type_3", "图书馆");

    final String code;
    final String value;

    public String getCode() {
        return this.code;
    }

    public String getValue() {
        return this.value;
    }

    ConsumeTypeEnum(final String code, final String message) {
        this.code = code;
        this.value = message;
    }

    public static String getCode(String value){
        for (ConsumeTypeEnum item : values()) {
            if (item.getValue().equals(value)) {
                return  item.getCode();
            }
        }
        return "consume_type_4";
    }

    public static String getValue(String code) {
        for (ConsumeTypeEnum item : values()) {
            if (item.getCode().equals(code)) {
                return  item.getValue();
            }
        }
        return "consume_type_4";
    }
}
