syntax = "proto3";

package armonik.api.grpc.v1.tasks;

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

/**
 * Represents every available field in a task summary.
 */
enum TaskSummaryEnumField {
  TASK_SUMMARY_ENUM_FIELD_UNSPECIFIED = 0; /** Unspecified */
  TASK_SUMMARY_ENUM_FIELD_TASK_ID = 16; /** The task ID. */
  TASK_SUMMARY_ENUM_FIELD_SESSION_ID = 1; /** The session ID. */
  TASK_SUMMARY_ENUM_FIELD_OWNER_POD_ID = 9; /** The owner pod ID. */
  TASK_SUMMARY_ENUM_FIELD_INITIAL_TASK_ID = 10; /** The initial task ID. Set when a task is submitted independently of retries. */
  TASK_SUMMARY_ENUM_FIELD_STATUS = 2; /** The task status. */
  TASK_SUMMARY_ENUM_FIELD_CREATED_AT = 3; /** The task creation date. */
  TASK_SUMMARY_ENUM_FIELD_SUBMITTED_AT = 11; /** The task submission date. */
  TASK_SUMMARY_ENUM_FIELD_STARTED_AT = 4; /** The task start date. */
  TASK_SUMMARY_ENUM_FIELD_ENDED_AT = 5; /** The task end date. */
  TASK_SUMMARY_ENUM_FIELD_CREATION_TO_END_DURATION = 6; /** The task duration. Between the creation date and the end date. */
  TASK_SUMMARY_ENUM_FIELD_PROCESSING_TO_END_DURATION = 7; /** The task calculated duration. Between the start date and the end date. */
  TASK_SUMMARY_ENUM_FIELD_RECEIVED_TO_END_DURATION = 18; /** The task calculated duration. Between the received date and the end date. */
  TASK_SUMMARY_ENUM_FIELD_POD_TTL = 12; /** The pod TTL (Time To Live). */
  TASK_SUMMARY_ENUM_FIELD_POD_HOSTNAME = 13; /** The hostname of the container running the task. */
  TASK_SUMMARY_ENUM_FIELD_RECEIVED_AT = 14; /** When the task is received by the agent. */
  TASK_SUMMARY_ENUM_FIELD_ACQUIRED_AT = 15; /** When the task is acquired by the agent. */
  TASK_SUMMARY_ENUM_FIELD_PROCESSED_AT = 17; /** When the task is processed by the agent. */
  TASK_SUMMARY_ENUM_FIELD_ERROR = 8; /** The error message. Only set if task have failed. */
  TASK_SUMMARY_ENUM_FIELD_FETCHED_AT = 19; /** When task data are fetched by the agent. */
  TASK_SUMMARY_ENUM_FIELD_PAYLOAD_ID = 20; /** The ID of the Result that is used as a payload for this task. */
  TASK_SUMMARY_ENUM_FIELD_CREATED_BY = 21; /** The ID of the Result that is used as a payload for this task. */
}

/**
 * This message is used to wrap the enum in order to facilitate the 'oneOf' generation.
 */
message TaskSummaryField {
  TaskSummaryEnumField field = 1;
}

/**
 * Represents a field in a task option.
 */
enum TaskOptionEnumField {
  TASK_OPTION_ENUM_FIELD_UNSPECIFIED = 0;
  TASK_OPTION_ENUM_FIELD_MAX_DURATION = 1;
  TASK_OPTION_ENUM_FIELD_MAX_RETRIES = 2;
  TASK_OPTION_ENUM_FIELD_PRIORITY = 3;
  TASK_OPTION_ENUM_FIELD_PARTITION_ID = 4;
  TASK_OPTION_ENUM_FIELD_APPLICATION_NAME = 5;
  TASK_OPTION_ENUM_FIELD_APPLICATION_VERSION = 6;
  TASK_OPTION_ENUM_FIELD_APPLICATION_NAMESPACE = 7;
  TASK_OPTION_ENUM_FIELD_APPLICATION_SERVICE = 8;
  TASK_OPTION_ENUM_FIELD_ENGINE_TYPE = 9;
}

/**
 * This message is used to wrap the enum in order to facilitate the 'oneOf' generation.
 */
message TaskOptionField {
  TaskOptionEnumField field = 1;
}

/**
 * Represents a generic field in a task option.
 */
message TaskOptionGenericField {
  string field = 1; /** The generic field. */
}

message TaskField {
  oneof field {
    TaskSummaryField task_summary_field = 1; /** The task summary field. */
    TaskOptionField task_option_field = 2; /** The task option field. */
    TaskOptionGenericField task_option_generic_field = 3; /** The task option generic field. */
  }
}
