package com.hfkj.sysenum.discount;

import java.util.Objects;

/**
 * 优惠券状态
 * @author hurui
 */
public enum DiscountUseScopeEnum {
    type1(1 , "加油"),
    type2(2 , "商城"),
    ;

    private Integer code;
    private String name;

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

    public static String getNameByType(Integer code) {
        for (DiscountUseScopeEnum ele : values()) {
            if(Objects.equals(code,ele.getCode())) return ele.getName();
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
