{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openfutureforum.github.io/executive-intelligence-index/schema/research-batch.schema.json",
  "title": "Research Batch",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "batch_id",
    "protocol_id",
    "prompt_id",
    "prompt_version",
    "branch",
    "execution_started_at",
    "agent_or_researcher",
    "model_disclosure",
    "tools_used",
    "sources_considered",
    "accepted_count",
    "rejected_count",
    "held_count",
    "validation_commands",
    "validation_results",
    "limitations",
    "next_action",
    "provenance"
  ],
  "properties": {
    "batch_id": {
      "type": "string",
      "minLength": 1
    },
    "protocol_id": {
      "type": "string",
      "minLength": 1
    },
    "prompt_id": {
      "type": "string",
      "minLength": 1
    },
    "prompt_version": {
      "type": "string",
      "minLength": 1
    },
    "branch": {
      "type": "string",
      "minLength": 1
    },
    "pull_request": {
      "type": [
        "string",
        "null"
      ]
    },
    "execution_started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "execution_completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "agent_or_researcher": {
      "type": "string",
      "minLength": 1
    },
    "model_disclosure": {
      "type": "string",
      "minLength": 1
    },
    "tools_used": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "sources_considered": {
      "type": "array",
      "items": {}
    },
    "accepted_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "rejected_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "held_count": {
      "type": [
        "integer",
        "null"
      ]
    },
    "output_files": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "validation_commands": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "validation_results": {
      "type": "array",
      "items": {}
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "next_action": {
      "type": "string",
      "minLength": 1
    },
    "workflow_status": {
      "$ref": "common.schema.json#/$defs/workflowStatus"
    },
    "machine_review_status": {
      "$ref": "common.schema.json#/$defs/machineReviewStatus"
    },
    "human_review_status": {
      "$ref": "common.schema.json#/$defs/humanReviewStatus"
    },
    "reviewed_by": {
      "type": [
        "string",
        "null"
      ]
    },
    "reviewed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "provenance": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "common.schema.json#/$defs/provenance"
      }
    },
    "revision_history": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/revision"
      }
    }
  }
}
