syntax = "proto3";
package topk.control.v1;

import "topk/control/v1/collection.proto";
import "topk/control/v1/schema.proto";

service CollectionService {
  // List collections
  rpc ListCollections(ListCollectionsRequest) returns (ListCollectionsResponse);

  // Get collection
  rpc GetCollection(GetCollectionRequest) returns (GetCollectionResponse);

  // Create collection
  rpc CreateCollection(CreateCollectionRequest) returns (CreateCollectionResponse);

  // Delete collection
  rpc DeleteCollection(DeleteCollectionRequest) returns (DeleteCollectionResponse);
}

message ListCollectionsRequest {}
message ListCollectionsResponse {
  repeated Collection collections = 1;
}

message GetCollectionRequest {
  string name = 1;
}
message GetCollectionResponse {
  Collection collection = 1;
}

message CreateCollectionRequest {
  string name = 1;
  map<string, FieldSpec> schema = 2;
}
message CreateCollectionResponse {
  Collection collection = 1;
}

message DeleteCollectionRequest {
  string name = 1;
}
message DeleteCollectionResponse {}
