syntax = "proto3";

package v1;

import "google/protobuf/wrappers.proto";
import "service.proto";
import "routing.proto";
import "client.proto";
import "ratelimit.proto";

message SimpleResponse {
	google.protobuf.UInt32Value code = 1;
	google.protobuf.StringValue info = 2;
}

message Response {
	google.protobuf.UInt32Value code = 1;
	google.protobuf.StringValue info = 2;
	Client client = 3;
	Namespace namespace = 4;
	Service service = 5;
	Instance instance = 6;
	Routing routing = 7;
	ServiceAlias alias = 8;
	Rule rateLimit = 9;
}

message BatchWriteResponse {
	google.protobuf.UInt32Value code = 1;
	google.protobuf.StringValue info = 2;
	google.protobuf.UInt32Value size = 3;
	repeated Response responses = 4;
}

message BatchQueryResponse {
	google.protobuf.UInt32Value code = 1;
	google.protobuf.StringValue info = 2;
	google.protobuf.UInt32Value amount = 3;
	google.protobuf.UInt32Value size = 4;
	repeated Namespace namespaces = 5;
	repeated Service services = 6;
	repeated Instance instances = 7;
	repeated Routing routings = 8;
	repeated ServiceAlias aliases = 9;
	repeated Rule rateLimits = 10;
}

message DiscoverResponse {
	google.protobuf.UInt32Value code = 1;
	google.protobuf.StringValue info = 2;

	enum DiscoverResponseType {
		UNKNOWN = 0;
		INSTANCE = 1;
		CLUSTER = 2;
		ROUTING = 3;
		RATE_LIMIT = 4;
	}

	DiscoverResponseType type = 3;
	Service service = 4;
	repeated Instance instances = 5;
	Routing routing = 6;
	RateLimit rateLimit = 7;
}
