// Path: stardao-core/src/main/java/io/stardog/stardao/core/field/Field.java
// @AutoValue
// public abstract class Field {
//     public abstract String getName();
//     public abstract String getStorageName();
//     public abstract boolean isOptional();
//     public abstract boolean isCreatable();
//     public abstract boolean isUpdatable();
// 
//     public abstract Field.Builder toBuilder();
//     public static Field.Builder builder() { return new AutoValue_Field.Builder(); }
// 
//     @AutoValue.Builder
//     public abstract static class Builder {
//         public abstract Builder name(String name);
//         public abstract Builder storageName(String storageName);
//         public abstract Builder optional(boolean optional);
//         public abstract Builder creatable(boolean creatable);
//         public abstract Builder updatable(boolean updatable);
//         public abstract Field build();
//     }
// }
// 
// Path: stardao-core/src/main/java/io/stardog/stardao/core/field/FieldData.java
// @AutoValue
// public abstract class FieldData {
//     @Nullable
//     public abstract Field getId();
//     @Nullable
//     public abstract Field getCreatedAt();
//     @Nullable
//     public abstract Field getCreatedBy();
//     @Nullable
//     public abstract Field getUpdatedAt();
//     @Nullable
//     public abstract Field getUpdatedBy();
//     public abstract Map<String,Field> getMap();
// 
//     public abstract Builder toBuilder();
//     public static FieldData.Builder builder() {
//         return new AutoValue_FieldData.Builder();
//     }
// 
//     @AutoValue.Builder
//     public abstract static class Builder {
//         public abstract Builder id(Field id);
//         public abstract Builder createdAt(Field field);
//         public abstract Builder createdBy(Field field);
//         public abstract Builder updatedAt(Field field);
//         public abstract Builder updatedBy(Field field);
//         public abstract Builder map(Map<String,Field> fields);
//         public abstract FieldData build();
//     }
// }


import com.amazonaws.services.dynamodbv2.document.Item;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.stardog.stardao.core.field.Field;
import io.stardog.stardao.core.field.FieldData;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
package io.stardog.stardao.dynamodb.mapper;



public class JacksonItemMapper<M> implements ItemMapper<M> {
    private final Class<M> modelClass;
    private final FieldData fieldData;
    private final ObjectMapper objectMapper;
    private final Map<String,String> objectToItemFieldRenames;
    private final Map<String,String> itemToObjectFieldRenames;

    public JacksonItemMapper(Class<M> modelClass, FieldData fieldData) {
        this(modelClass, fieldData, new ObjectMapper()
                .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
                .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true)
                .configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
                .configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
                .registerModule(new Jdk8Module())
                .registerModule(new JavaTimeModule()));
    }

    public JacksonItemMapper(Class<M> modelClass, FieldData fieldData, ObjectMapper objectMapper) {
        this.modelClass = modelClass;
        this.fieldData = fieldData;
        this.objectMapper = objectMapper;
        this.objectToItemFieldRenames = new HashMap<>();
        this.itemToObjectFieldRenames = new HashMap<>();
// Path: stardao-core/src/main/java/io/stardog/stardao/core/field/Field.java
// @AutoValue
// public abstract class Field {
//     public abstract String getName();
//     public abstract String getStorageName();
//     public abstract boolean isOptional();
//     public abstract boolean isCreatable();
//     public abstract boolean isUpdatable();
// 
//     public abstract Field.Builder toBuilder();
//     public static Field.Builder builder() { return new AutoValue_Field.Builder(); }
// 
//     @AutoValue.Builder
//     public abstract static class Builder {
//         public abstract Builder name(String name);
//         public abstract Builder storageName(String storageName);
//         public abstract Builder optional(boolean optional);
//         public abstract Builder creatable(boolean creatable);
//         public abstract Builder updatable(boolean updatable);
//         public abstract Field build();
//     }
// }
// 
// Path: stardao-core/src/main/java/io/stardog/stardao/core/field/FieldData.java
// @AutoValue
// public abstract class FieldData {
//     @Nullable
//     public abstract Field getId();
//     @Nullable
//     public abstract Field getCreatedAt();
//     @Nullable
//     public abstract Field getCreatedBy();
//     @Nullable
//     public abstract Field getUpdatedAt();
//     @Nullable
//     public abstract Field getUpdatedBy();
//     public abstract Map<String,Field> getMap();
// 
//     public abstract Builder toBuilder();
//     public static FieldData.Builder builder() {
//         return new AutoValue_FieldData.Builder();
//     }
// 
//     @AutoValue.Builder
//     public abstract static class Builder {
//         public abstract Builder id(Field id);
//         public abstract Builder createdAt(Field field);
//         public abstract Builder createdBy(Field field);
//         public abstract Builder updatedAt(Field field);
//         public abstract Builder updatedBy(Field field);
//         public abstract Builder map(Map<String,Field> fields);
//         public abstract FieldData build();
//     }
// }


// Path: stardao-dynamodb/src/main/java/io/stardog/stardao/dynamodb/mapper/JacksonItemMapper.java
import com.amazonaws.services.dynamodbv2.document.Item;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.stardog.stardao.core.field.Field;
import io.stardog.stardao.core.field.FieldData;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

package io.stardog.stardao.dynamodb.mapper;



public class JacksonItemMapper<M> implements ItemMapper<M> {
    private final Class<M> modelClass;
    private final FieldData fieldData;
    private final ObjectMapper objectMapper;
    private final Map<String,String> objectToItemFieldRenames;
    private final Map<String,String> itemToObjectFieldRenames;

    public JacksonItemMapper(Class<M> modelClass, FieldData fieldData) {
        this(modelClass, fieldData, new ObjectMapper()
                .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
                .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true)
                .configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
                .configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
                .registerModule(new Jdk8Module())
                .registerModule(new JavaTimeModule()));
    }

    public JacksonItemMapper(Class<M> modelClass, FieldData fieldData, ObjectMapper objectMapper) {
        this.modelClass = modelClass;
        this.fieldData = fieldData;
        this.objectMapper = objectMapper;
        this.objectToItemFieldRenames = new HashMap<>();
        this.itemToObjectFieldRenames = new HashMap<>();
        for (Field field : fieldData.getMap().values()) {