{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ORA Open Lab 0.3.0 — individual execution receipt",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "protocol_version",
    "scenario_id",
    "method_id",
    "prompt_sha256",
    "protocol_sha256",
    "run_id",
    "block_id",
    "timestamp_utc",
    "execution_status",
    "model",
    "settings",
    "isolation",
    "response_text",
    "response_sha256",
    "metrics",
    "review",
    "limitations"
  ],
  "properties": {
    "protocol_version": {
      "const": "0.3.0"
    },
    "scenario_id": {
      "enum": [
        "ORA-LAB-001",
        "ORA-LAB-002"
      ]
    },
    "method_id": {
      "enum": [
        "direct",
        "expert",
        "prose",
        "ora"
      ]
    },
    "prompt_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "protocol_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "run_id": {
      "type": "string",
      "minLength": 1
    },
    "block_id": {
      "type": "string",
      "minLength": 1
    },
    "timestamp_utc": {
      "type": "string",
      "format": "date-time"
    },
    "execution_status": {
      "enum": [
        "executed",
        "failed",
        "not_executed"
      ]
    },
    "model": {
      "type": "object",
      "required": [
        "provider",
        "name",
        "version"
      ],
      "additionalProperties": false,
      "properties": {
        "provider": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "settings": {
      "type": "object",
      "description": "Observed parameters, tool configuration, order/seed and client. Unknown values must remain null."
    },
    "isolation": {
      "enum": [
        "confirmed",
        "not_confirmed",
        "contaminated",
        "not_applicable"
      ]
    },
    "response_text": {
      "type": [
        "string",
        "null"
      ]
    },
    "response_sha256": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "metrics": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "latency_ms",
        "input_tokens",
        "output_tokens",
        "cost",
        "currency",
        "word_count",
        "word_cap_pass"
      ],
      "properties": {
        "latency_ms": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "input_tokens": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "output_tokens": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "cost": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "word_count": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "word_cap_pass": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    },
    "review": {
      "type": [
        "object",
        "null"
      ],
      "description": "Review after responses locked; criterion evidence is required when score is 0 or 1.",
      "required": [
        "reviewer",
        "blinding",
        "criteria",
        "critical_failure"
      ],
      "additionalProperties": false,
      "properties": {
        "reviewer": {
          "type": "string"
        },
        "blinding": {
          "enum": [
            "confirmed",
            "not_confirmed",
            "none"
          ]
        },
        "criteria": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "score",
              "evidence"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "score": {
                "enum": [
                  0,
                  1,
                  null
                ]
              },
              "evidence": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "critical_failure": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "execution_status": {
            "const": "executed"
          }
        }
      },
      "then": {
        "properties": {
          "response_text": {
            "type": "string"
          },
          "response_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        }
      },
      "else": {
        "properties": {
          "response_text": {
            "type": "null"
          },
          "response_sha256": {
            "type": "null"
          },
          "review": {
            "type": "null"
          }
        }
      }
    }
  ]
}
