syntax = "proto3";

package armonik.api.grpc.v1.partitions;

import "partitions_fields.proto";
import "partitions_filters.proto";
import "sort_direction.proto";

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

/**
 * A raw partition object.
 *
 * Used when a list or a single partition is returned.
 */
message PartitionRaw {
  string id = 1; /** The partition ID. */
  repeated string parent_partition_ids = 2; /** The parent partition IDs. */
  int64 pod_reserved = 3; /** Whether the partition is reserved for pods. */
  int64 pod_max = 4; /** The maximum number of pods that can be used by sessions using the partition. */
  map<string, string> pod_configuration = 7; /** The pod configuration. */
  int64 preemption_percentage = 5; /** The percentage of the partition that can be preempted. */
  int64 priority = 6; /** The priority of the partition. */
}

/**
 * Request to list partitions.
 */
message ListPartitionsRequest {
  int32 page = 1; /** The page number. Start at 0. */
  int32 page_size = 2; /** The number of items per page. */

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

  /**
   * Represents the sort object.
   */
  message Sort {
    PartitionField field = 1; /** The field to sort on. */
    sort_direction.SortDirection direction = 2; /** The sort direction. */
  }

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

/**
 * Response to list partitions.
 *
 * Use pagination, filtering and sorting from the request.
 * Retunr a list of raw partitions.
 */
message ListPartitionsResponse {
  repeated PartitionRaw partitions = 1; /** The list of raw partitions. */

  int32 page = 2; /** The page number. Start at 0. */
  int32 page_size = 3; /** The page size. */
  int32 total = 4; /** The total number of partitions. */
}

/**
 * Request to get a partition.
 */
message GetPartitionRequest {
  string id = 1; /** The partition ID. */
}

/**
 * Response to get a partition.
 *
 * Return a raw partition.
 */
message GetPartitionResponse {
  PartitionRaw partition = 1; /** The raw partition. */
}
