{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "QubitBenchmark results (contract v0.2, section 6). In data/working/ each result also carries `review`; it is removed when a release is frozen.",
  "type": "array",
  "items": {
    "type": "object",
    "additionalProperties": false,
    "required": [
      "id",
      "machine_id",
      "benchmark_id",
      "method_version",
      "comparison_group",
      "value",
      "value_text",
      "unit",
      "uncertainty",
      "configuration",
      "measured_on",
      "published_on",
      "source",
      "measured_by",
      "provenance",
      "grade",
      "limitations",
      "ranking_eligible",
      "eligibility_note",
      "status",
      "superseded_by",
      "corrects",
      "history",
      "added_on",
      "updated_on",
      "page_url"
    ],
    "properties": {
      "id": {
        "type": "string",
        "pattern": "^r-\\d{6}$"
      },
      "machine_id": {
        "type": "string"
      },
      "benchmark_id": {
        "type": "string"
      },
      "method_version": {
        "type": [
          "string",
          "null"
        ]
      },
      "comparison_group": {
        "type": "string"
      },
      "value": {
        "type": [
          "number",
          "null"
        ]
      },
      "value_text": {
        "type": [
          "string",
          "null"
        ]
      },
      "unit": {
        "type": "string"
      },
      "uncertainty": {
        "type": [
          "object",
          "null"
        ],
        "additionalProperties": false,
        "required": [
          "type",
          "low",
          "high",
          "note"
        ],
        "properties": {
          "type": {
            "enum": [
              "sd",
              "ci95",
              "range",
              "other"
            ]
          },
          "low": {
            "type": [
              "number",
              "null"
            ]
          },
          "high": {
            "type": [
              "number",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "configuration": {
        "type": [
          "string",
          "null"
        ]
      },
      "measured_on": {
        "$ref": "#/$defs/fuzzy_date"
      },
      "published_on": {
        "$ref": "#/$defs/fuzzy_date"
      },
      "source": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "doi",
          "title",
          "publisher",
          "type"
        ],
        "properties": {
          "url": {
            "type": "string",
            "pattern": "^https://"
          },
          "doi": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^10\\."
          },
          "title": {
            "type": "string"
          },
          "publisher": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "enum": [
              "peer_reviewed",
              "preprint",
              "vendor_technical",
              "announcement",
              "other"
            ]
          }
        }
      },
      "measured_by": {
        "type": "string"
      },
      "provenance": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "company_reported",
          "independent_measurement",
          "peer_reviewed",
          "independently_reproduced",
          "community_submitted",
          "audited"
        ],
        "properties": {
          "company_reported": {
            "type": "boolean"
          },
          "independent_measurement": {
            "type": "boolean"
          },
          "peer_reviewed": {
            "type": "boolean"
          },
          "independently_reproduced": {
            "type": "boolean"
          },
          "community_submitted": {
            "type": "boolean"
          },
          "audited": {
            "type": "boolean"
          }
        }
      },
      "grade": {
        "enum": [
          "A",
          "B",
          "C"
        ]
      },
      "limitations": {
        "type": [
          "string",
          "null"
        ]
      },
      "ranking_eligible": {
        "type": "boolean"
      },
      "eligibility_note": {
        "type": [
          "string",
          "null"
        ]
      },
      "status": {
        "enum": [
          "active",
          "corrected",
          "superseded",
          "withdrawn",
          "disputed"
        ]
      },
      "superseded_by": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^r-\\d{6}$"
      },
      "corrects": {
        "type": [
          "string",
          "null"
        ],
        "pattern": "^r-\\d{6}$"
      },
      "history": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "date",
            "change",
            "note"
          ],
          "properties": {
            "date": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "change": {
              "enum": [
                "added",
                "corrected",
                "superseded",
                "withdrawn",
                "disputed",
                "reinstated"
              ]
            },
            "note": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      },
      "added_on": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "updated_on": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "page_url": {
        "type": "string",
        "pattern": "^https://qubitbenchmark\\.com/results/r-\\d{6}/$"
      },
      "review": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "state",
          "suggestion",
          "note",
          "evidence_quote"
        ],
        "properties": {
          "state": {
            "enum": [
              "candidate",
              "approved",
              "held",
              "rejected"
            ]
          },
          "suggestion": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence_quote": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  },
  "$defs": {
    "fuzzy_date": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "required": [
        "date",
        "precision"
      ],
      "properties": {
        "date": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "precision": {
          "enum": [
            "day",
            "month",
            "year"
          ]
        }
      }
    }
  }
}
