// Path: core/src/main/java/eventsrc4j/io/EventStorage.java
// public interface EventStorage<K, S, E> {
// 
//   /**
//    * Access a specific stream.
//    *
//    * @param key the stream key
//    * @return a readable and writable
//    */
//   WritableEventStream<K, S, E> stream(K key);
// 
//   default <KK, SS, EE> EventStorage<KK, SS, EE> xmap(F<K, KK> kk, F<KK, K> k,
//       F<S, SS> ss, F<SS, S> s, F<E, EE> ee,
//       F<EE, E> e) {
// 
//     //TODO
//     throw new UnsupportedOperationException();
//   }
// }
// 
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
// public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
// 
//   /**
//    * Save the given events at the end of the stream, if at expected sequence.
//    *
//    * @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
//    * expected to be empty.
//    * @param time timestamp of the events to save.
//    * @param events a list of events to save in the stream.
//    * @return an IO action producing the result of the write; either successful or indicating an
//    * optimistic concurrency error (duplicated sequence).
//    */
//   IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
// 
//   default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) {
//     return action.eval(WStreamIOAlgebra.of(this));
//   }
// 
// 
// }


import eventsrc4j.io.EventStorage;
import eventsrc4j.io.WritableEventStream;
import fj.data.List;
import fj.data.Option;
import fj.test.Gen;
import fj.test.Property;
import java.time.Instant;
import java.util.function.Function;
import java.util.function.Predicate;
import static fj.data.List.nil;
import static fj.data.List.single;
import static fj.data.Option.none;
import static fj.test.Property.prop;
import static fj.test.Property.property;
import static java.util.Collections.singletonList;
package eventsrc4j;



public final class EventStorageSpec<K, S, E> implements WStreamAction.Factory<K, S, E> {

  private final Gen<K> keys;

  private final Gen<E> events;

  public EventStorageSpec(Gen<K> keys, Gen<E> events) {
    this.keys = keys;
    this.events = events;
  }

// Path: core/src/main/java/eventsrc4j/io/EventStorage.java
// public interface EventStorage<K, S, E> {
// 
//   /**
//    * Access a specific stream.
//    *
//    * @param key the stream key
//    * @return a readable and writable
//    */
//   WritableEventStream<K, S, E> stream(K key);
// 
//   default <KK, SS, EE> EventStorage<KK, SS, EE> xmap(F<K, KK> kk, F<KK, K> k,
//       F<S, SS> ss, F<SS, S> s, F<E, EE> ee,
//       F<EE, E> e) {
// 
//     //TODO
//     throw new UnsupportedOperationException();
//   }
// }
// 
// Path: core/src/main/java/eventsrc4j/io/WritableEventStream.java
// public interface WritableEventStream<K, S, E> extends EventStream<K, S, E> {
// 
//   /**
//    * Save the given events at the end of the stream, if at expected sequence.
//    *
//    * @param expectedSeq expected last saved sequence of the stream, or empty if the stream is
//    * expected to be empty.
//    * @param time timestamp of the events to save.
//    * @param events a list of events to save in the stream.
//    * @return an IO action producing the result of the write; either successful or indicating an
//    * optimistic concurrency error (duplicated sequence).
//    */
//   IO<WriteResult<K, S, E>> write(Option<S> expectedSeq, Instant time, Iterable<E> events);
// 
//   default <R> IO<R> evalWAction(WStreamAction<K, S, E, R> action) {
//     return action.eval(WStreamIOAlgebra.of(this));
//   }
// 
// 
// }


// Path: core/src/test/java/eventsrc4j/EventStorageSpec.java
import eventsrc4j.io.EventStorage;
import eventsrc4j.io.WritableEventStream;
import fj.data.List;
import fj.data.Option;
import fj.test.Gen;
import fj.test.Property;
import java.time.Instant;
import java.util.function.Function;
import java.util.function.Predicate;
import static fj.data.List.nil;
import static fj.data.List.single;
import static fj.data.Option.none;
import static fj.test.Property.prop;
import static fj.test.Property.property;
import static java.util.Collections.singletonList;

package eventsrc4j;



public final class EventStorageSpec<K, S, E> implements WStreamAction.Factory<K, S, E> {

  private final Gen<K> keys;

  private final Gen<E> events;

  public EventStorageSpec(Gen<K> keys, Gen<E> events) {
    this.keys = keys;
    this.events = events;
  }

  public Property read_return_write(EventStorage<K, S, E> eventStorage) {