package com.hai.enum_type;

import java.util.Objects;

/**
 * 优惠券使用范围
 * @author hurui
 */

public enum DiscountUseScope {
    type1(1 , "全场"),
    type2(2 , "卡券"),
    type3(3 , "话费"),
    type4(4 , "肯德基"),
    type5(5 , "星巴克"),
    type6(6 , "会员充值"),
    type7(7 , "加油服务"),
    ;

    private Integer type;
    private String name;

    DiscountUseScope(int type , String name) {
        this.type = type;
        this.name = name;
    }

    public static String getNameByType(Integer type) {
        for (DiscountUseScope ele : values()) {
            if (Objects.equals(type,ele.getType())) {
                return ele.getName();
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

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