{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/contracts/v1/quant-run.v1.schema.json",
  "title": "QuantRun",
  "type": "object",
  "additionalProperties": false,
  "required": ["runId", "strategyVersionId", "marketSliceIds", "status", "inputHash", "engineHash", "createdAt"],
  "properties": {
    "runId": { "type": "string", "minLength": 1, "maxLength": 128 },
    "strategyVersionId": { "type": "string", "minLength": 1, "maxLength": 128 },
    "marketSliceIds": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 160 } },
    "status": { "type": "string", "enum": ["queued", "running", "succeeded", "failed", "cancelled"] },
    "inputHash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "engineHash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "resultHash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "createdAt": { "type": "string", "format": "date-time" },
    "startedAt": { "type": "string", "format": "date-time" },
    "completedAt": { "type": "string", "format": "date-time" },
    "error": { "$ref": "./error-envelope.v1.schema.json" }
  }
}
