syntax = "proto3";

message RPC {
  repeated SubOpts subscriptions = 1;
  repeated Message messages = 2;
  optional ControlMessage control = 3;

  message SubOpts {
    optional bool subscribe = 1; // subscribe or unsubcribe
    optional string topic = 2;
  }

  message Message {
    optional bytes from = 1;
    optional bytes data = 2;
    optional bytes sequenceNumber = 3;
    optional string topic = 4;
    optional bytes signature = 5;
    optional bytes key = 6;
  }
}

message ControlMessage {
  repeated ControlIHave ihave = 1;
  repeated ControlIWant iwant = 2;
  repeated ControlGraft graft = 3;
  repeated ControlPrune prune = 4;
}

message ControlIHave {
  optional string topic = 1;
  repeated bytes messageIDs = 2;
}

message ControlIWant {
  repeated bytes messageIDs = 1;
}

message ControlGraft {
  optional string topic = 1;
}

message ControlPrune {
  optional string topic = 1;
  repeated PeerInfo peers = 2;
  optional uint64 backoff = 3;
}

message PeerInfo {
  optional bytes peerID = 1;
  optional bytes signedPeerRecord = 2;
}
