{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/daon/json-schema/daon-process-instance-archive-status-response-schema.json",
  "title": "ProcessInstanceArchiveStatusResponse",
  "description": "Archive status of a process instance, per archive policy.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/daon-process-instance-archiving-api-openapi.yml#/components/schemas/ProcessInstanceArchiveStatusResponse",
  "type": "object",
  "properties": {
    "processInstanceId": {
      "type": "string",
      "description": "The process instance id."
    },
    "archives": {
      "type": "array",
      "description": "Per-policy archive entries. Empty when the instance has not been archived.",
      "items": {
        "$ref": "#/$defs/ArchiveEntry"
      }
    }
  },
  "$defs": {
    "ArchiveEntry": {
      "type": "object",
      "description": "Archive of a process instance under a single policy.",
      "properties": {
        "archivePolicyId": {
          "type": "string",
          "description": "Archive policy id."
        },
        "archivePolicyName": {
          "type": "string",
          "description": "Archive policy name."
        },
        "archivePolicyVersion": {
          "type": "integer",
          "format": "int32",
          "description": "Archive policy version. Null if the policy has since been deleted."
        },
        "status": {
          "type": "string",
          "description": "Lifecycle status.",
          "enum": [
            "QUEUED",
            "PENDING",
            "COMPLETED",
            "FAILED",
            "RETRYING"
          ]
        },
        "createdDtm": {
          "type": "string",
          "format": "date-time",
          "description": "When the archive record was created (DB records only)."
        },
        "completedDtm": {
          "type": "string",
          "format": "date-time",
          "description": "When the archive completed (COMPLETED records only)."
        },
        "location": {
          "type": "string",
          "description": "Relative storage location of the written archive (e.g. processArchives/{policyName}/{date}/{file}.zip). Populated for COMPLETED entries only. This is the handle passed to the archive download/restore flow."
        },
        "expiresAfterDate": {
          "type": "string",
          "format": "date-time",
          "description": "When the tracking record (and its underlying archive) is scheduled to expire and be purged."
        },
        "failureReason": {
          "type": "string",
          "description": "Human-readable reason for the last failed or retrying attempt. Populated for FAILED/RETRYING entries; cleared when the archive later completes."
        }
      }
    }
  }
}