package com.sckw.core.model.enums;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author lfdc
 * @description 字段检测要素枚举
 * @date 2023-11-05 15:11:30
 */

public enum DictItemEnum {

    LONGITUDE_X("longitude", "lng", "经度（X偏移）"),
    LATITUDE_Y("latitude", "lat", "纬度（Y偏移）"),
    ALTITUDE_Z("altitude", "high", "海拔（z偏移）"),
    ALTITUDE_NULL("ISNULL", "ISNULL", "ISNULL"),
    ;
    private final String codeType;
    private final String value;
    private final String name;

    DictItemEnum(String codeType, String value, String name) {
        this.codeType = codeType;
        this.value = value;
        this.name = name;
    }

    public String getCodeType() {
        return codeType;
    }

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static DictItemEnum getData(String value) {
        for (DictItemEnum entry : values()) {
            if(!Objects.isNull(entry.getValue())){
                if (entry.getValue().equals(value)) {
                    return entry;
                }
            }

        }
        return DictItemEnum.ALTITUDE_NULL;
    }
    public static int getHasBool(String value) {
        for (DictItemEnum entry : values()) {
            if(!Objects.isNull(entry.getValue())){
                if (entry.getValue().equals(value)) {
                    return 1;
                }
            }

        }

        return 0;
    }

    public static List<String> getAll() {
        List<String> list = new ArrayList<>();
        for (DictItemEnum entry : values()) {
            if(!"ISNULL".equals(entry.getValue())){
                list.add(entry.getValue());
            }
        }
        return list;
    }
}
