package com.conveyal.analysis.spatial;

import org.locationtech.jts.geom.Geometry;
import org.opengis.feature.type.AttributeType;

/** Groups the original names and user-friendly fields from shapefile attributes, CSV columns, etc. */
public class SpatialAttribute {
    /** Name in source file */
    public final String name;

    /** Editable by end users */
    String label;

    Type type;

    enum Type {
        NUMBER, // internally, we generally parse as doubles
        TEXT,
        GEOM,
        ERROR
    }

    public SpatialAttribute(String name, AttributeType type) {
        this.name = name;
        this.label = name;
        if (Number.class.isAssignableFrom(type.getBinding())) this.type = Type.NUMBER;
        else if (String.class.isAssignableFrom(type.getBinding())) this.type = Type.TEXT;
        else if (Geometry.class.isAssignableFrom(type.getBinding())) this.type = Type.GEOM;
        else this.type = Type.ERROR;
    }

}

@@ -305,14 +305,8 @@
 lic 
-final 
 Stri
@@ -352,16 +352,23 @@
  */%0A    
+public 
 String l
@@ -378,16 +378,23 @@
 l;%0A%0A    
+public 
 Type typ
@@ -401,16 +401,24 @@
 e;%0A%0A    
+private 
 enum Typ
@@ -960,10 +960,131 @@
 %0A    %7D%0A%0A
+    /**%0A     * No-arg constructor required for Mongo POJO serialization%0A     */%0A    public SpatialAttribute () %7B%0A%0A    %7D%0A%0A
 %7D%0A

make properties public for mongo serialization