package com.hai.enum_type;

import java.util.Objects;

public enum GoodsType {

    goodsType1(1 , "卡卷"),
    goodsType2(2 , "金币充值"),
    goodsType3(3 , "团油"),
    goodsType4(4 , "KFC"),
    goodsType5(5 , "电影票"),
    goodsType6(6 , "话费充值"),
    goodsType7(7 , "优惠卷包"),
    goodsType8(8 , "汇联通充值"),
    goodsType9(9 , "星巴克"),
    goodsType10(10 , "会员充值"),
    ;

    private Integer  type;
    private String name;


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

    public static String getNameByType(Integer type) {
        for (GoodsType 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;
    }
}
