/**
 * Messages describing applications and associated requests and responses.
 */
syntax = "proto3";

package armonik.api.grpc.v1.applications;

import "applications_fields.proto";
import "applications_filters.proto";
import "sort_direction.proto";

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

/**
 * A raw application object.
 *
 * Used when a list of applications is requested.
 */
message ApplicationRaw {
  string name = 1; /** Application name. */
  string version = 2; /** Application version. */
  string namespace = 3; /** Application namespace used in the excecuted class. */
  string service = 4; /** Application service used in the excecuted class. */
}

/**
 * Request to list applications.
 *
 * Use pagination, filtering and sorting.
 */
message ListApplicationsRequest {
  int32 page = 1; /** The page number. Start at 0. */
  int32 page_size = 2; /** Number of items per page. */

  Filters filters = 3; /** The filters. */

  /**
   * Represents the sort object.
   */
  message Sort {
    repeated ApplicationField fields = 1; /** Fields to order by. */
    sort_direction.SortDirection direction = 2; /** The order direction. */
  }

  /** The sort.
   *
   * Must be set for every request.
   */
  Sort sort = 4;
}

/**
 * Response to list applications.
 *
 * Use pagination, filtering and sorting from the request.
 * Return a list of raw applications.
 */
message ListApplicationsResponse {
  repeated ApplicationRaw applications = 1;

  int32 page = 2; /** The current page. Start at 0. */
  int32 page_size = 3; /** Number of items per page. */
  int32 total = 4; /** Total number of items. */
}
