// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/Entry.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class Entry {
//    private String eventId;
//    private String eventType;
//    private Long eventNumber;
//    private String data;
//    private String metaData;
//    private String streamId;
//    private Boolean isLinkMetaData;
//    private Long positionEventNumber;
//    private String positionStreamId;
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
//    private List<Link> links;
// 
//    private Event content;
// }
// 
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/Event.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class Event {
//    private String eventId;
//    private String eventType;
//    private Long eventNumber;
//    private String streamId;
//    private Boolean isLinkMetaData;
//    private Long positionEventNumber;
//    private String positionStreamId;
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
// 
//    private String eventStreamId;
//    private String data;
//    private String metadata;
// }
// 
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/EventResponse.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class EventResponse {
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
// 
//    private Event content;
// }
// 
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/EventStreamFeed.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class EventStreamFeed {
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    boolean headOfStream;
//    private List<Link> links;
//    private List<Entry> entries;
// 
// }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.List;
import java.util.stream.Collectors;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import de.qyotta.eventstore.model.Entry;
import de.qyotta.eventstore.model.Event;
import de.qyotta.eventstore.model.EventResponse;
import de.qyotta.eventstore.model.EventStreamFeed;
         public Event deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
            final Event.EventBuilder e = Event.builder();
            final JsonObject object = json.getAsJsonObject();
            final JsonElement dataElement = object.get("data");
            final JsonElement metadataElement = object.get("metadata");

            final String eventStreamId = object.get("eventStreamId")
                  .getAsString();
            final String eventId = object.get("eventId")
                  .getAsString();
            final Long eventNumber = object.get("eventNumber")
                  .getAsLong();
            final String eventType = object.get("eventType")
                  .getAsString();

            final String data = gson.toJson(dataElement);
            final String metadata = gson.toJson(metadataElement);

            return e.eventStreamId(eventStreamId)
                  .eventId(eventId)
                  .eventNumber(eventNumber)
                  .eventType(eventType)
                  .data(data)
                  .metadata(metadata)
                  .build();
         }
      });
      gson = gsonBuilder.create();
   }

// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/Entry.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class Entry {
//    private String eventId;
//    private String eventType;
//    private Long eventNumber;
//    private String data;
//    private String metaData;
//    private String streamId;
//    private Boolean isLinkMetaData;
//    private Long positionEventNumber;
//    private String positionStreamId;
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
//    private List<Link> links;
// 
//    private Event content;
// }
// 
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/Event.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class Event {
//    private String eventId;
//    private String eventType;
//    private Long eventNumber;
//    private String streamId;
//    private Boolean isLinkMetaData;
//    private Long positionEventNumber;
//    private String positionStreamId;
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
// 
//    private String eventStreamId;
//    private String data;
//    private String metadata;
// }
// 
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/EventResponse.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class EventResponse {
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    private String summary;
// 
//    private Event content;
// }
// 
// Path: eventstore-client/src/main/java/de/qyotta/eventstore/model/EventStreamFeed.java
// @Getter
// @Setter
// @Builder(toBuilder = true)
// @ToString
// @EqualsAndHashCode
// @NoArgsConstructor(access = AccessLevel.PUBLIC)
// @AllArgsConstructor(access = AccessLevel.PUBLIC)
// public class EventStreamFeed {
//    private String title;
//    private String id;
//    private String updated;
//    private Author author;
//    boolean headOfStream;
//    private List<Link> links;
//    private List<Entry> entries;
// 
// }


// Path: eventstore-client/src/main/java/de/qyotta/neweventstore/AtomFeedJsonReader.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.List;
import java.util.stream.Collectors;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import de.qyotta.eventstore.model.Entry;
import de.qyotta.eventstore.model.Event;
import de.qyotta.eventstore.model.EventResponse;
import de.qyotta.eventstore.model.EventStreamFeed;

         public Event deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
            final Event.EventBuilder e = Event.builder();
            final JsonObject object = json.getAsJsonObject();
            final JsonElement dataElement = object.get("data");
            final JsonElement metadataElement = object.get("metadata");

            final String eventStreamId = object.get("eventStreamId")
                  .getAsString();
            final String eventId = object.get("eventId")
                  .getAsString();
            final Long eventNumber = object.get("eventNumber")
                  .getAsLong();
            final String eventType = object.get("eventType")
                  .getAsString();

            final String data = gson.toJson(dataElement);
            final String metadata = gson.toJson(metadataElement);

            return e.eventStreamId(eventStreamId)
                  .eventId(eventId)
                  .eventNumber(eventNumber)
                  .eventType(eventType)
                  .data(data)
                  .metadata(metadata)
                  .build();
         }
      });
      gson = gsonBuilder.create();
   }

   public List<Entry> readAtomFeed(InputStream in) {