{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://contracts.prepaire.example/lim/edge-capture-manifest.schema.json",
  "title": "PREPAIRE Edge Capture Manifest",
  "type": "object",
  "additionalProperties": false,
  "required": ["contract", "instrumentAssetId", "sampleRef", "assayProtocol", "assayProtocolVersion", "artifacts"],
  "properties": {
    "contract": { "const": "PREPAIRE-EDGE-CAPTURE-MANIFEST@1.0.0" },
    "instrumentAssetId": { "type": "string", "minLength": 1 },
    "sampleRef": { "type": "string", "minLength": 1, "maxLength": 200 },
    "accessionRef": { "type": "string", "minLength": 1, "maxLength": 200 },
    "assayProtocol": { "type": "string", "minLength": 1, "maxLength": 200 },
    "assayProtocolVersion": { "type": "string", "minLength": 1, "maxLength": 100 },
    "sourceStartedAt": { "type": "string", "format": "date-time" },
    "metadata": { "type": "object", "additionalProperties": true },
    "submitWhenVerified": { "type": "boolean", "default": false },
    "verificationTimeoutSeconds": { "type": "integer", "minimum": 30, "maximum": 86400, "default": 3600 },
    "artifacts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["path", "artifactClass", "mediaType", "format"],
        "properties": {
          "path": { "type": "string", "minLength": 1 },
          "artifactClass": { "enum": ["NATIVE_RAW", "OPEN_DERIVATIVE", "QC", "NORMALIZED", "DERIVED", "REPORT", "MANIFEST", "AUDIT"] },
          "mediaType": { "type": "string", "minLength": 1 },
          "format": { "type": "string", "minLength": 1 },
          "nativeSource": { "type": "boolean", "default": false },
          "sourceArtifactPaths": {
            "type": "array",
            "maxItems": 100,
            "default": [],
            "items": { "type": "string", "minLength": 1 }
          }
        }
      }
    }
  }
}
