package com.xhpc.activity.enums;



public enum ActivityTypeEnum {

    CASH("CASH", "现金活动"),
    DISCOUNT("DISCOUNT", "折扣活动"),
    ;


    private final String code;
    private final String name;

    ActivityTypeEnum(String code, String name){
        this.code = code;
        this.name = name;
    }

    //根据code获取name
    public static String getNameByCode(String code) {
        for (ActivityTypeEnum typeEnum : ActivityTypeEnum.values()) {
            //移除交办
            if (typeEnum.code.equals(code)) {
                return typeEnum.name;
            }
        }
        return "";
    }

    //根据name获取code
    public static String getCodeByName(String name) {
        for (ActivityTypeEnum typeEnum : ActivityTypeEnum.values()) {
            //移除交办
            if (typeEnum.name.equals(name)) {
                return typeEnum.code;
            }
        }
        return null;
    }

    public String getCode() {

        return code;
    }

    public String getName() {

        return name;
    }
}
