package com.hai.order.type;

import java.util.Objects;

/**
 * 子订单产品类型
 * @className: OrderChildGoodsType
 * @author: HuRui
 * @date: 2022/8/24
 **/
public enum OrderChildGoodsType {
    TYPE1(1, "购买卡卷"),
    TYPE2(2, "积分充值"),
    TYPE3(3, "加油订单"),
    TYPE4(4, "肯德基"),
    TYPE5(5, "电影票"),
    TYPE6(6, "话费充值"),
    TYPE7(7, "优惠券包"),
    TYPE8(8, "贵州汇联通工会卡充值"),
    TYPE9(9, "星巴克"),
    TYPE10(10, "第三方充值"),
            ;

    private Integer number;

    private String name;

    OrderChildGoodsType(int number, String name) {
        this.number = number;
        this.name = name;
    }

    /**
     * 根据类型查询数据
     * @param type
     * @return
     */
    public static OrderChildGoodsType getDataByType(Integer type) {
        for (OrderChildGoodsType ele : values()) {
            if(Objects.equals(type,ele.getNumber())) return ele;
        }
        return null;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

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