package com.cool.store.enums;

import com.cool.store.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: WangShuo
 * @Date: 2024/11/04/下午7:00
 * @Version 1.0
 * @注释:
 */
public enum FranchiseBrandEnum {
    ZXJP(1,"正新鸡排","option486"),
    ZXSMZ(2,"正新三明治","option622"),
    ZJS(3,"正烧记","option488"),
    DGMX(4,"大鼓米线","option624"),
    CXM(5,"串小妹","option626"),
    MZG(6,"茂掌柜","option490");
    private int code;
    private String desc;
    //红圈通code
    private String hqtCode;
    FranchiseBrandEnum(int code, String desc,String hqtCode) {
        this.code = code;
        this.desc = desc;
        this.hqtCode = hqtCode;
    }
    public int getCode() {
        return code;
    }
    public String getDesc() {
        return desc;
    }

    public String getHqtCode() {
        return hqtCode;
    }

    public static String getDescByCode(String code) {
        if (StringUtils.isBlank(code)){
            return null;
        }
        int i = Integer.parseInt(code);
        for (FranchiseBrandEnum e : FranchiseBrandEnum.values()) {
            if (i == e.getCode()) {
                return e.getDesc();
            }
        }
        return null;
    }
    public static String getDescByCode(Integer code) {
        if (code==null){
            return null;
        }
        for (FranchiseBrandEnum e : FranchiseBrandEnum.values()) {
            if (code == e.getCode()) {
                return e.getDesc();
            }
        }
        return null;
    }

    public static FranchiseBrandEnum getEnumByCode(Integer code) {
        if (code == null){
            return null;
        }
        for (FranchiseBrandEnum e : FranchiseBrandEnum.values()) {
            if (code == e.getCode()) {
                return e;
            }
        }
        return null;
    }
}
