package com.hai.enum_type;

import java.util.Objects;

/**
 * @serviceName ApiProductTypeEnum.java
 * @author Sum1Dream
 * @version 1.0.0
 * @Description // 产品类型
 * @createTime 17:06 2022/7/8
 **/
public enum ApiProductTypeEnum {
    type1(1, "星巴克"),
    type2(2, "肯德基"),
    type3(3, "第三方产品")
    ;

    private Integer type;

    private String name;

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

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