{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/university-of-geneva/main/json-schema/university-of-geneva-order-schema.json",
  "title": "Yareta Order",
  "description": "Orders allow to prepare archive download (DIP) from the archives (AIP).",
  "type": "object",
  "properties": {
    "creation": {
      "$ref": "#/$defs/ChangeInfo"
    },
    "lastUpdate": {
      "$ref": "#/$defs/ChangeInfo"
    },
    "resId": {
      "type": "string",
      "description": "The identifier of the resource. The default format is a Universally Unique IDentifier (UUID).",
      "maxLength": 50,
      "minLength": 0
    },
    "publicOrder": {
      "type": "boolean",
      "description": "If the order is public, false otherwise."
    },
    "subsetItems": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OrderSubsetItem"
      }
    },
    "metadataVersion": {
      "type": "string",
      "description": "The metadata version of the order query.",
      "enum": [
        "1.0",
        "1.1",
        "2.0",
        "2.1",
        "3.0",
        "3.1",
        "4.0",
        "5.0"
      ]
    },
    "name": {
      "type": "string",
      "description": "The name of the order query.",
      "maxLength": 255,
      "minLength": 1
    },
    "query": {
      "type": "string",
      "description": "The query of the order query.",
      "maxLength": 5099,
      "minLength": 0
    },
    "queryType": {
      "type": "string",
      "description": "The type of the order query.",
      "enum": [
        "ADVANCED",
        "DIRECT",
        "SIMPLE"
      ]
    },
    "status": {
      "type": "string",
      "description": "The status of the order query.",
      "enum": [
        "DOWNLOADING",
        "IN_DISSEMINATION_PREPARATION",
        "IN_ERROR",
        "IN_PREPARATION",
        "IN_PROGRESS",
        "READY",
        "SUBMITTED"
      ]
    },
    "statusMessage": {
      "type": "string",
      "description": "The message related to the status of the order query.",
      "maxLength": 1024,
      "minLength": 0
    },
    "disseminationPolicyId": {
      "type": "string",
      "description": "The dissemination policy identifier linked to the order.",
      "maxLength": 2147483647,
      "minLength": 1
    },
    "organizationalUnitDisseminationPolicyId": {
      "type": "string",
      "description": "The dissemination policy identifier linked to the orgunit.",
      "maxLength": 2147483647,
      "minLength": 1
    },
    "subitemsChecksum": {
      "type": "string",
      "description": "The checksum of the order subitems list."
    },
    "orderStatus": {
      "type": "string",
      "enum": [
        "DOWNLOADING",
        "IN_DISSEMINATION_PREPARATION",
        "IN_ERROR",
        "IN_PREPARATION",
        "IN_PROGRESS",
        "READY",
        "SUBMITTED"
      ],
      "writeOnly": true
    },
    "errorStatus": {
      "type": "string",
      "writeOnly": true
    },
    "dipNumber": {
      "type": "integer",
      "format": "int32",
      "description": "The DIP number of the order query."
    },
    "aipNumber": {
      "type": "integer",
      "format": "int32",
      "description": "The AIP number of the order query."
    },
    "_links": {
      "$ref": "#/$defs/Links"
    }
  },
  "$defs": {
    "OrderSubsetItem": {
      "type": "object",
      "properties": {
        "creation": {
          "$ref": "#/$defs/ChangeInfo"
        },
        "lastUpdate": {
          "$ref": "#/$defs/ChangeInfo"
        },
        "resId": {
          "type": "string",
          "description": "The identifier of the resource. The default format is a Universally Unique IDentifier (UUID).",
          "maxLength": 50,
          "minLength": 0
        },
        "itemPath": {
          "type": "string"
        },
        "_links": {
          "$ref": "#/$defs/Links"
        }
      }
    },
    "Link": {
      "type": "object",
      "properties": {
        "href": {
          "type": "string"
        },
        "hreflang": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "deprecation": {
          "type": "string"
        },
        "profile": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "templated": {
          "type": "boolean"
        }
      }
    },
    "ChangeInfo": {
      "type": "object",
      "description": "The change information of an action.",
      "properties": {
        "fullName": {
          "type": "string",
          "description": "The full name of the user who did the action on the resource.",
          "readOnly": true
        },
        "who": {
          "type": "string",
          "description": "The user who did the action on the resource.",
          "readOnly": true
        },
        "when": {
          "type": "string",
          "format": "date-time",
          "description": "The date when the action was done on the resources.",
          "readOnly": true
        }
      }
    },
    "Links": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/Link"
      }
    }
  }
}