{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.dualview.ai/docs/evidence-manifest.schema.json",
  "title": "Draft DualView comparison evidence manifest",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "studyId", "publicationType", "title", "status", "modality", "authors", "sources", "claims", "limitations"],
  "properties": {
    "schemaVersion": { "const": "0.1" },
    "studyId": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{2,79}$" },
    "publicationType": { "enum": ["release-brief", "workflow-guide", "comparison-brief", "tested-comparison", "benchmark"] },
    "title": { "type": "string", "minLength": 12 },
    "status": { "enum": ["draft", "human-reviewed"] },
    "modality": { "enum": ["image", "video", "audio", "3d", "document", "prompt-json", "multimodal"] },
    "createdAt": { "type": "string" },
    "testedAt": { "type": ["string", "null"] },
    "authors": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 2 } },
    "reviewers": { "type": "array", "items": { "type": "string", "minLength": 2 } },
    "conflicts": { "type": "string" },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "type", "url"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "type": { "enum": ["official-announcement", "model-card", "documentation", "paper", "release", "dataset", "test-artifact"] },
          "url": { "type": "string", "pattern": "^https://" },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
        }
      }
    },
    "test": {
      "type": "object",
      "additionalProperties": false,
      "required": ["protocolVersion", "inputs", "candidates", "outputs"],
      "properties": {
        "protocolVersion": { "const": "0.1" },
        "inputs": { "type": "array", "minItems": 1, "items": { "type": "object" } },
        "candidates": { "type": "array", "minItems": 2, "items": { "type": "object" } },
        "outputs": { "type": "array", "minItems": 2, "items": { "type": "object" } },
        "settings": { "type": "object" },
        "metricImplementation": { "type": "string" },
        "repeatCount": { "type": "integer", "minimum": 1 }
      }
    },
    "claims": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "type", "text", "evidenceIds"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "type": { "enum": ["official-fact", "measured-result", "observation", "recommendation"] },
          "text": { "type": "string", "minLength": 8 },
          "evidenceIds": { "type": "array", "minItems": 1, "items": { "type": "string" } }
        }
      }
    },
    "limitations": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 8 } }
  },
  "allOf": [
    {
      "if": { "properties": { "publicationType": { "enum": ["tested-comparison", "benchmark"] } } },
      "then": { "required": ["testedAt", "reviewers", "test"], "properties": { "status": { "const": "human-reviewed" }, "reviewers": { "minItems": 1 } } }
    }
  ]
}
