package com.tofly.gpsboot.common.system;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * "定位网络(1 卫星定位,2 前次定位,4 缓存定位,5 Wifi定位,6 基站定位,8 离线定位,9 最后位置缓存)")
 * @author Zev
 */
@Getter
@AllArgsConstructor
public enum NewWorkTypeEnum {
    /**
     *
     */
    NEW_WORK_TYPE_GPS("1","GPS"),
    NEW_WORK_TYPE_PREVIOUS("2","前次定位"),
    NEW_WORK_TYPE_CACHE("4","缓存定位"),
    NEW_WORK_TYPE_WIFI("5","Wifi"),
    NEW_WORK_TYPE_BASE_STATION("6","基站定位"),
    NEW_WORK_TYPE_OFFLINE("8","离线定位"),
    NEW_WORK_TYPE_FINAL_LOCATION_CACHE("9","最后位置缓存")
    ;
    /**
     * 编码
     */
    private String code;
    /**
     * 内容
     */
    private String value;

    public static String getCodeForValue(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (NewWorkTypeEnum e : NewWorkTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.value;
                break;
            }
        }
        return path;
    }
}
