{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arpi-ai/json-schema/arpi-ai-diag-result-response-schema.json",
  "title": "DiagResultResponse",
  "description": "Analysis result response. HTTP status reflects job state: 200 = COMPLETED, 202 = PENDING, 500 = FAILED.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arpi-ai-openapi.json#/components/schemas/DiagResultResponse",
  "type": "object",
  "properties": {
    "jobId": {
      "type": "string",
      "description": "Job ID"
    },
    "status": {
      "type": "string",
      "description": "Current job status",
      "enum": [
        "PENDING",
        "COMPLETED",
        "FAILED"
      ]
    },
    "outputFiles": {
      "type": "array",
      "description": "List of output files produced by the analysis. Empty while PENDING.",
      "items": {
        "$ref": "#/$defs/OutputFile"
      }
    },
    "thresholds": {
      "type": "object",
      "description": "Fixed EB biomarker grade cutoffs (diagKey → thresholds). Static catalog — identical for every job and present in every status. Use it to interpret raw biomarker scores.",
      "additionalProperties": {
        "$ref": "#/$defs/BiomarkerThresholdResponse"
      }
    }
  },
  "required": [
    "jobId",
    "outputFiles",
    "status",
    "thresholds"
  ],
  "$defs": {
    "BiomarkerThresholdResponse": {
      "type": "object",
      "description": "Fixed grade cutoffs for an EB biomarker field. Each value is the inclusive entry threshold (%) for the next grade band: `score < intermediate` = LOW, `< high` = INTERMEDIATE, `< veryHigh` = HIGH, otherwise VERY_HIGH.",
      "properties": {
        "intermediate": {
          "type": "number",
          "format": "double",
          "description": "INTERMEDIATE band entry threshold (%)"
        },
        "high": {
          "type": "number",
          "format": "double",
          "description": "HIGH band entry threshold (%)"
        },
        "veryHigh": {
          "type": "number",
          "format": "double",
          "description": "VERY_HIGH band entry threshold (%)"
        }
      },
      "required": [
        "intermediate",
        "high",
        "veryHigh"
      ]
    },
    "OutputFile": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "presignedUrl": {
          "type": "string"
        },
        "analysisType": {
          "type": "string"
        }
      },
      "required": [
        "analysisType",
        "key",
        "presignedUrl"
      ]
    }
  }
}