{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "evaluated_on",
    "inventory",
    "evidence",
    "locations",
    "assets",
    "exports",
    "deletions",
    "retentions",
    "residuals"
  ],
  "properties": {
    "schema": {
      "const": "varexis-data-exit-input/1"
    },
    "evaluated_on": {
      "type": "string",
      "minLength": 1,
      "maxLength": 10,
      "format": "date"
    },
    "inventory": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "complete",
        "evidence_ref"
      ],
      "properties": {
        "complete": {
          "type": "boolean"
        },
        "evidence_ref": {
          "oneOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 80,
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "evidence": {
      "type": "array",
      "minItems": 0,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "kind",
          "captured_on",
          "artifact_sha256",
          "reference"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "kind": {
            "enum": [
              "inventory",
              "export",
              "deletion",
              "retention",
              "exception",
              "residual",
              "authority",
              "approval",
              "outcome"
            ]
          },
          "captured_on": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "format": "date"
          },
          "artifact_sha256": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-f0-9]{64}$"
          },
          "reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      },
      "uniqueItems": true
    },
    "locations": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "label",
          "kind"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 160
          },
          "kind": {
            "enum": [
              "primary",
              "replica",
              "backup",
              "export",
              "vendor",
              "other"
            ]
          }
        }
      },
      "uniqueItems": true
    },
    "assets": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "location_id",
          "export_required",
          "expected_export_item_ids",
          "deletion_required",
          "delete_by"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "location_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "export_required": {
            "type": "boolean"
          },
          "expected_export_item_ids": {
            "type": "array",
            "minItems": 0,
            "maxItems": 1000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80,
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
            },
            "uniqueItems": true
          },
          "deletion_required": {
            "type": "boolean"
          },
          "delete_by": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 10,
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "uniqueItems": true
    },
    "exports": {
      "type": "array",
      "minItems": 0,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "asset_id",
          "location_id",
          "item_ids",
          "complete",
          "evidence_ref"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "asset_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "location_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "item_ids": {
            "type": "array",
            "minItems": 0,
            "maxItems": 1000,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80,
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
            },
            "uniqueItems": true
          },
          "complete": {
            "type": "boolean"
          },
          "evidence_ref": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "uniqueItems": true
    },
    "deletions": {
      "type": "array",
      "minItems": 0,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "asset_id",
          "location_id",
          "requested_on",
          "completed_on",
          "status",
          "evidence_ref"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "asset_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "location_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "requested_on": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "format": "date"
          },
          "completed_on": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 10,
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "enum": [
              "pending",
              "failed",
              "completed"
            ]
          },
          "evidence_ref": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "uniqueItems": true
    },
    "retentions": {
      "type": "array",
      "minItems": 0,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "asset_id",
          "location_id",
          "retain_until",
          "hold_active",
          "exception_ref",
          "evidence_ref"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "asset_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "location_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "retain_until": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 10,
                "format": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "hold_active": {
            "type": "boolean"
          },
          "exception_ref": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
              },
              {
                "type": "null"
              }
            ]
          },
          "evidence_ref": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "uniqueItems": true
    },
    "residuals": {
      "type": "array",
      "minItems": 0,
      "maxItems": 1000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "asset_id",
          "location_id",
          "status",
          "evidence_ref"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "asset_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "location_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
          },
          "status": {
            "enum": [
              "resolved",
              "unresolved"
            ]
          },
          "evidence_ref": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 80,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "uniqueItems": true
    }
  }
}
