package com.neusoft.smart.pos.card.constants;

public enum CardType {

    MEMBER_CARD(1, "会员卡"),
    RECHARGEABLE_CARD(2, "储值卡"),
    GIFT_CARD(3, "礼品卡")
            ;

    private Integer code;

    private String value;

    CardType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static CardType getEnumByCode(String enumName, Integer code) {
        for (CardType dictEnum : CardType.values()) {
            if (dictEnum.name().startsWith(enumName) && code.equals(dictEnum.getCode())) {
                return dictEnum;
            }
        }
        return null;
    }
}
