syntax = "proto3";

package nln.stream.v1;

service StreamService {
  rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse);
  rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse);
  rpc GetTopicSchema(GetTopicSchemaRequest) returns (GetTopicSchemaResponse);
}

message SubscribeRequest {
  string topic = 1;
  OutputFormat format = 2;
}

enum OutputFormat {
  PROTO = 0;
  JSON = 1;
}

message SubscribeResponse {
  string topic = 1;
  uint64 slot = 2;
  string payload = 5;
}

message ListTopicsRequest {}

message ListTopicsResponse {
  repeated TopicInfo topics = 1;
}

message TopicInfo {
  string name = 1;
  string description = 2;
  string proto_message_type = 3;
}

message GetTopicSchemaRequest {
  string topic = 1;
}

message GetTopicSchemaResponse {
  string proto_schema = 1;
  string message_type = 2;
}
