{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/airbus-oneatlas/refs/heads/main/json-schema/oneatlas-activity-schema.json",
  "title": "Activity",
  "type": "object",
  "properties": {
    "_links": {
      "properties": {
        "cancel": {
          "allOf": [
            {
              "description": "See [Cancel activity](#/paths/~1api~1v1~1activities~1{correlationId}~1cancel/post)"
            },
            {
              "$ref": "#/components/schemas/Link"
            }
          ]
        },
        "catalogItems": {
          "description": "Resource id property (`resourceId`) is a catalog item id (`catalogItemId`). It can be used in all endpoints that need a `catalogItemId`.\n\nSee [Search catalog items with opensearch](#/paths/~1api~1v1~1opensearch/get). See [Format catalog item](#/paths/~1api~1v1~1items~1{catalogItemId}~1format/post).",
          "items": {
            "$ref": "#/components/schemas/Link"
          },
          "type": "array",
          "uniqueItems": true
        },
        "history": {
          "allOf": [
            {
              "description": "See [Get activity stages](#/paths/~1api~1v1~1activities~1{correlationId}~1stages/get)"
            },
            {
              "$ref": "#/components/schemas/Link"
            }
          ]
        },
        "hold": {
          "allOf": [
            {
              "description": "See [Hold activity](#/paths/~1api~1v1~1activities~1{correlationId}~1hold/post)"
            },
            {
              "$ref": "#/components/schemas/Link"
            }
          ]
        },
        "nexts": {
          "description": "Next endpoints applicable to the resource when the activity is finished.",
          "items": {
            "$ref": "#/components/schemas/Link"
          },
          "type": "array",
          "uniqueItems": true
        },
        "rerun": {
          "allOf": [
            {
              "description": "See [Run activity](#/paths/~1api~1v1~1activities~1{correlationId}~1rerun/post)"
            },
            {
              "$ref": "#/components/schemas/Link"
            }
          ]
        }
      },
      "readOnly": true,
      "type": "object"
    },
    "creationDate": {
      "description": "The time when the activity was created",
      "format": "datetime",
      "readOnly": true,
      "type": "string"
    },
    "endDate": {
      "description": "The time when the activity was ended (copy of the date associated to the SUCCEEDED, CANCELED or FAILED stage)",
      "format": "datetime",
      "readOnly": true,
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "lastStageName": {
      "description": "Name of the last completed stage",
      "type": "string"
    },
    "message": {
      "description": "A free text (copy of the last stage message)",
      "readOnly": true,
      "type": "string"
    },
    "payload": {
      "description": "The copy of the origin user request",
      "type": "object"
    },
    "priority": {
      "default": 5,
      "description": "A priority indicator between 1 and 9. 1 is the highest.",
      "format": "int",
      "maximum": 9,
      "minimum": 1,
      "type": "number"
    },
    "progress": {
      "default": 0,
      "description": "A progress indicator between 0 and 100",
      "format": "int",
      "maximum": 100,
      "minimum": 0,
      "type": "number"
    },
    "startDate": {
      "description": "The time when the activity was started (date of the first stage that is not QUEUED)",
      "format": "datetime",
      "readOnly": true,
      "type": "string"
    },
    "status": {
      "default": "QUEUED",
      "description": "Status of the activity (copy of the last stage status)",
      "enum": [
        "QUEUED",
        "RUNNING",
        "ON_HOLD",
        "CANCELED",
        "WAITING_CANCEL",
        "SUCCEEDED",
        "FAILED",
        "ARCHIVED"
      ],
      "type": "string"
    },
    "type": {
      "description": "Type of activity",
      "enum": [
        "ingestion",
        "process",
        "format",
        "control",
        "deliver"
      ],
      "type": "string"
    },
    "userId": {
      "allOf": [
        {
          "$ref": "#/components/schemas/Id"
        },
        {
          "description": "The id of the user that is the origin of the activity (extracted from the X-Forwarded-User request header)"
        }
      ]
    }
  }
}