// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String ANALYZED = "analyzed";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String DATE_FORMAT = "date_format";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String FULL_NAME = "full_name";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String GEOMETRY_TYPE = "geometry_type";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String NESTED = "nested";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticAttribute.java
// public enum ElasticGeometryType {
//     GEO_POINT,
//     GEO_SHAPE
// }


import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.ANALYZED;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.DATE_FORMAT;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.FULL_NAME;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.GEOMETRY_TYPE;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.NESTED;
import mil.nga.giat.data.elasticsearch.ElasticAttribute.ElasticGeometryType;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.referencing.CRS;
import org.geotools.util.logging.Logging;
import org.locationtech.jts.geom.Geometry;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
import org.opengis.feature.type.Name;
/*
 * This file is hereby placed into the Public Domain. This means anyone is
 * free to do whatever they wish with this file.
 */
package mil.nga.giat.data.elasticsearch;




/**
 * Builds a feature type based on the attributes defined in the 
 * {@link ElasticLayerConfiguration}.
 *
 */
class ElasticFeatureTypeBuilder extends SimpleFeatureTypeBuilder {

    private final static Logger LOGGER = Logging.getLogger(ElasticFeatureTypeBuilder.class);

    private final List<ElasticAttribute> attributes;

    public ElasticFeatureTypeBuilder(List<ElasticAttribute> attributes, Name name) {
        setName(name);
        this.attributes = attributes;
    }

    @Override
    public SimpleFeatureType buildFeatureType() {
        if (attributes != null) {
            String defaultGeometryName = null;
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String ANALYZED = "analyzed";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String DATE_FORMAT = "date_format";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String FULL_NAME = "full_name";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String GEOMETRY_TYPE = "geometry_type";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticConstants.java
// public static final String NESTED = "nested";
// 
// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticAttribute.java
// public enum ElasticGeometryType {
//     GEO_POINT,
//     GEO_SHAPE
// }


// Path: gt-elasticsearch/src/main/java/mil/nga/giat/data/elasticsearch/ElasticFeatureTypeBuilder.java
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.ANALYZED;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.DATE_FORMAT;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.FULL_NAME;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.GEOMETRY_TYPE;
import static mil.nga.giat.data.elasticsearch.ElasticConstants.NESTED;
import mil.nga.giat.data.elasticsearch.ElasticAttribute.ElasticGeometryType;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.referencing.CRS;
import org.geotools.util.logging.Logging;
import org.locationtech.jts.geom.Geometry;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
import org.opengis.feature.type.Name;

/*
 * This file is hereby placed into the Public Domain. This means anyone is
 * free to do whatever they wish with this file.
 */
package mil.nga.giat.data.elasticsearch;




/**
 * Builds a feature type based on the attributes defined in the 
 * {@link ElasticLayerConfiguration}.
 *
 */
class ElasticFeatureTypeBuilder extends SimpleFeatureTypeBuilder {

    private final static Logger LOGGER = Logging.getLogger(ElasticFeatureTypeBuilder.class);

    private final List<ElasticAttribute> attributes;

    public ElasticFeatureTypeBuilder(List<ElasticAttribute> attributes, Name name) {
        setName(name);
        this.attributes = attributes;
    }

    @Override
    public SimpleFeatureType buildFeatureType() {
        if (attributes != null) {
            String defaultGeometryName = null;
            for (ElasticAttribute attribute : attributes) {