{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/popp/json-schema/popp-process-document-response-schema.json",
  "title": "ProcessDocumentResponse",
  "description": "Result of a /v1/documents/process call.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/popp-documents-api-openapi.yml#/components/schemas/ProcessDocumentResponse",
  "type": "object",
  "required": [
    "passedValidation",
    "documentTypes"
  ],
  "properties": {
    "passedValidation": {
      "type": "boolean",
      "description": "True if every requested validation passed."
    },
    "documentTypes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Document types this upload covers. Usually a single-element list; multi-document submissions (e.g. a blood-test panel) may return more than one."
    },
    "validationErrors": {
      "type": "array",
      "description": "One entry per failed validation. Empty when passedValidation is true.",
      "items": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Validation code that failed (e.g. CHECK_NAME_MATCH)."
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation of the failure."
          }
        }
      }
    },
    "failedClassificationRules": {
      "type": "array",
      "description": "Classification short-circuit: the classificationRules from the request that the document did not satisfy. Echoes the rules exactly as submitted. Present only when classification failed on required fields.",
      "items": {
        "type": "object",
        "required": [
          "type",
          "value"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Rule kind, e.g. INCLUDES_FIELD."
          },
          "value": {
            "type": "string",
            "description": "The rule argument, e.g. the field name that was missing."
          }
        }
      }
    }
  }
}