syntax = "proto3";

package event;

option go_package = "./proto;event";
import "google/protobuf/struct.proto";

service Event {
	rpc Publish(PublishRequest) returns (PublishResponse) {}
	rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) {}
}

// Publish a message to the event stream.
message PublishRequest {
	// The topic to publish to
	string topic = 1;
	// The json message to publish
	google.protobuf.Struct message = 2;
}

message PublishResponse {}

// Subscribe to messages for a given topic.
message SubscribeRequest {
	// The topic to subscribe to
	string topic = 1;
	// Optional group for the subscription
	string group = 2;
}

// A blocking event will be returned in response.
message SubscribeResponse {
	// The topic subscribed to
	string topic = 1;
	// The next json message on the topic
	google.protobuf.Struct message = 2;
}
