package com.cool.store.enums.prepare.newStore;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * 线下竞争对手
 */
public enum OfflineCompetitorEnum {
    BRAND_FRUIT(10,"品牌水果店"),
    COUPLES_FRUIT(20,"夫妻水果店"),
    VEGETABLE_MARKET(30,"菜场店"),
    BIG_BUSINESS(40,"大商超"),
    FRESH_FOOD(50,"生鲜店"),
    NONE(60,"无"),


    ;

    private Integer code;
    private String desc;

    OfflineCompetitorEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static final Map<Integer, OfflineCompetitorEnum> map
            = Arrays.stream(values()).collect(Collectors.toMap(OfflineCompetitorEnum::getCode, Function.identity()));

    public static OfflineCompetitorEnum getByCode(Integer code) {
        return map.get(code);
    }
}
