package com.hai.enum_type;

import java.util.Objects;

/**
 * 产品图片
 * @author hurui
 */
public enum ProductImgEnum {
    name0("product/茶瓦纳.png", "茶瓦纳"),
    name1("product/冷萃咖啡.png", "冷萃咖啡"),
    name2("product/浓缩咖啡.png", "浓缩咖啡"),
    name3("product/其他.png", "其他"),
    name4("product/星冰乐.png", "星冰乐"),
    ;

    private String name;

    private String imgUrl;

    public static String getNameByImgUrl(String name) {
        for (ProductImgEnum ele : values()) {
            if(Objects.equals(name,ele.getName())) return ele.getImgUrl();
        }
        return null;
    }

    ProductImgEnum(String imgUrl, String name) {
        this.imgUrl = imgUrl;
        this.name = name;
    }

    public String getName() {
        return name;
    }

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

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }
}
