syntax = "proto3";

package armonik.api.grpc.v1.results;

import "objects.proto";
import "results_common.proto";

option csharp_namespace = "ArmoniK.Api.gRPC.V1.Results";

/**
 * The ResultsService provides methods for interacting with results
 */
service Results {
  /**
   * Get a results list using pagination, filters and sorting
   */
  rpc ListResults(ListResultsRequest) returns (ListResultsResponse) {}

  /**
   * Get a result by id.
   */
  rpc GetResult(GetResultRequest) returns (GetResultResponse) {}

  /**
   * Get the id of the task that should produce the result
   */
  rpc GetOwnerTaskId(GetOwnerTaskIdRequest) returns (GetOwnerTaskIdResponse);

  /**
   * Create the metadata of multiple results at once
   * Data have to be uploaded separately
   */
  rpc CreateResultsMetaData(CreateResultsMetaDataRequest) returns (CreateResultsMetaDataResponse) {}

  /**
   * Create one result with data included in the request
   */
  rpc CreateResults(CreateResultsRequest) returns (CreateResultsResponse) {}

  /**
   * Upload data for result with stream
   */
  rpc UploadResultData(stream UploadResultDataRequest) returns (UploadResultDataResponse) {}

  /**
   * Retrieve data
   */
  rpc DownloadResultData(DownloadResultDataRequest) returns (stream DownloadResultDataResponse) {}

  /**
   * Delete data from multiple results
   */
  rpc DeleteResultsData(DeleteResultsDataRequest) returns (DeleteResultsDataResponse) {}

  /**
  * Get the configuration of the service
  */
  rpc GetServiceConfiguration(Empty) returns (ResultsServiceConfigurationResponse);

  /**
	 * This endpoint allows a user to watch a list of results and be notified when there is any change.
	 * The user sends the list of ids they want to watch.
	 * The submitter will then send the statuses for all requested ids immediately and keep the stream open.
	 *   Ids not present in DB will be returned at that time with the special state NOTFOUND.
	 * The submitter will send updates to the client via the opened stream.
	 * Any reply can be implicitely chunked if there are too many event to report at the same time (or for the first reply).
	 * It is possible to filter out specific statuses from events.
	 */
  rpc WatchResults(stream WatchResultRequest) returns (stream WatchResultResponse);
}
