package com.cool.store.enums.point;

import java.util.Objects;

/**
 * @author zhangchenbiao
 * @FileName: FlowRateEnum
 * @Description:高峰期人流
 * @date 2024-03-26 16:08
 */
public enum FlowRateEnum {

    //1:200以下 2:200～300 3:300～400 4:400以上
    FLOW_RATE_1(1, "200以下"),
    FLOW_RATE_2(2, "200～300"),
    FLOW_RATE_3(3, "300～400"),
    FLOW_RATE_4(4, "400以上"),
    ;

    private Integer code;

    private String desc;

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

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static FlowRateEnum getByCode(Integer code) {
        if(Objects.isNull(code)){
            return null;
        }
        for (FlowRateEnum value : FlowRateEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
