/**
 * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
 */

option java_package = "akka.persistence.serialization";
option optimize_for = SPEED;

message PersistentMessage {
  optional PersistentPayload payload = 1;
  optional int64 sequenceNr = 2;
  optional string persistenceId = 3;
  optional bool deleted = 4; // not used in new records from 2.4
  // optional int32 redeliveries = 6; // Removed in 2.4
  // repeated string confirms = 7; // Removed in 2.4
  // optional bool confirmable = 8;  // Removed in 2.4
  // optional DeliveredMessage confirmMessage = 9; // Removed in 2.4
  // optional string confirmTarget = 10; // Removed in 2.4
  optional string sender = 11; // not stored in journal, needed for remote serialization 
  optional string manifest = 12;
  optional string writerUuid = 13;
}

message PersistentPayload {
  required int32 serializerId = 1;
  required bytes payload = 2;
  optional bytes payloadManifest = 3;
}

message AtomicWrite {
  repeated PersistentMessage payload = 1;
}

message AtLeastOnceDeliverySnapshot {
  message UnconfirmedDelivery {
    required int64 deliveryId = 1;
    required string destination = 2;
    required PersistentPayload payload = 3;
  }
  
  required int64 currentDeliveryId = 1;
  repeated UnconfirmedDelivery unconfirmedDeliveries = 2;
}

message PersistentStateChangeEvent {
  required string stateIdentifier = 1;
  optional string timeout = 2;
}
