{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "baselinePipelineId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "candidatePipelineId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "policy": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "protocolUri": {
          "type": "string",
          "format": "uri"
        },
        "protocolSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "endpoints": {
          "minItems": 1,
          "maxItems": 100,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "minimumSubjects": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "minimumLowerBound": {
                "type": "number",
                "exclusiveMinimum": 0,
                "exclusiveMaximum": 1
              },
              "maximumDiscordanceUpperBound": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "key",
              "minimumSubjects",
              "minimumLowerBound",
              "maximumDiscordanceUpperBound"
            ],
            "additionalProperties": false
          }
        },
        "requiredStrata": {
          "minItems": 1,
          "maxItems": 200,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "required": [
        "version",
        "protocolUri",
        "protocolSha256",
        "endpoints",
        "requiredStrata"
      ],
      "additionalProperties": false
    },
    "dataset": {
      "type": "object",
      "properties": {
        "manifestSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "truthManifestSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "consentManifestSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "split": {
          "type": "string",
          "const": "locked_external_holdout"
        },
        "trainingSubjectHashes": {
          "maxItems": 1000000,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "cases": {
          "minItems": 1,
          "maxItems": 100000,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "subjectHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "endpoint": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "strata": {
                "minItems": 1,
                "maxItems": 200,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                }
              },
              "baselinePass": {
                "type": "boolean"
              },
              "candidatePass": {
                "type": "boolean"
              },
              "severeFailure": {
                "type": "boolean"
              },
              "evidenceSha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "subjectHash",
              "endpoint",
              "strata",
              "baselinePass",
              "candidatePass",
              "severeFailure",
              "evidenceSha256"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "manifestSha256",
        "truthManifestSha256",
        "consentManifestSha256",
        "split",
        "trainingSubjectHashes",
        "cases"
      ],
      "additionalProperties": false
    },
    "gates": {
      "type": "object",
      "properties": {
        "independentTruth": {
          "type": "boolean"
        },
        "consentAllowsValidation": {
          "type": "boolean"
        },
        "referenceCompatibility": {
          "type": "boolean"
        },
        "analyticalValidation": {
          "type": "boolean"
        },
        "clinicalScopeReviewed": {
          "type": "boolean"
        },
        "reproducibleReplay": {
          "type": "boolean"
        },
        "rollbackTested": {
          "type": "boolean"
        },
        "externalSiteValidation": {
          "type": "boolean"
        },
        "prospectiveShadowValidation": {
          "type": "boolean"
        }
      },
      "required": [
        "independentTruth",
        "consentAllowsValidation",
        "referenceCompatibility",
        "analyticalValidation",
        "clinicalScopeReviewed",
        "reproducibleReplay",
        "rollbackTested",
        "externalSiteValidation",
        "prospectiveShadowValidation"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "baselinePipelineId",
    "candidatePipelineId",
    "policy",
    "dataset",
    "gates"
  ],
  "additionalProperties": false,
  "x-runtimeValidation": "Structural schema only. Cross-record identity, provenance, semantic binding and release-policy checks also run in the VERA service."
}
