// Copyright (c) 2018 IoTeX
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.

// To compile the proto, run:
//      protoc -I. -I ./../types --go_out=plugins=grpc:$GOPATH/src *.proto
syntax = "proto3";
package iotexrpc;
option go_package = "github.com/iotexproject/iotex-proto/golang/iotexrpc";
option java_multiple_files = true;
option java_package = "com.github.iotexproject.grpc.rpc";

import "google/protobuf/timestamp.proto";

message BlockSync {
  uint64 start = 2;
  uint64 end = 3;
}

message ActionSync {
  repeated bytes hashes = 1;
}

enum MessageType {
  UNKNOWN = 0;
  ACTION = 1;
  BLOCK = 2;
  CONSENSUS = 3;
  BLOCK_REQUEST = 4;
  NODE_INFO_REQUEST = 5;
  NODE_INFO = 6;
  ACTIONS = 7;
  ACTION_HASH = 8;
  ACTION_REQUEST = 9;
  TEST = 10001;
}

message BroadcastMsg {
  uint32 chain_id = 1;
  MessageType msg_type = 2;
  bytes msg_body = 3;
  string peer_id = 4;
  google.protobuf.Timestamp timestamp = 5;
}

message UnicastMsg {
  uint32 chain_id = 1;
  string addr = 2;
  MessageType msg_type = 3;
  bytes msg_body = 4;
  string peer_id = 5;
  google.protobuf.Timestamp timestamp = 6;
}
