package com.hai.order.type;

import java.util.Objects;

/**
 * 订单产品类型
 * @className: OrderProductType
 * @author: HuRui
 * @date: 2022/8/25
 **/
public enum OrderProductType {
    PRODUCT_TYPE1(1, "星巴克"),
    PRODUCT_TYPE2(2, "肯德基"),
    PRODUCT_TYPE3(3, "第三方充值"),
    PRODUCT_TYPE4(4, "积分充值"),
    PRODUCT_TYPE5(5, "购买卡券"),
    PRODUCT_TYPE6(6, "加油订单"),
    PRODUCT_TYPE7(7, "优惠券包"),
    PRODUCT_TYPE8(8, "汇联通工会卡充值"),
    PRODUCT_TYPE9(9, "话费充值"),
    ;

    private Integer number;

    private String name;

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

    /**
     * 根据类型查询数据
     * @param type
     * @return
     */
    public static OrderProductType getDataByType(Integer type) {
        for (OrderProductType 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;
    }
}
