{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://scenarios.ginc.org/data/schema/edition.schema.json",
  "title": "GINC Scenarios — edition record",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "edition",
    "name",
    "status",
    "version",
    "library_version",
    "release_date",
    "framing",
    "scores_source",
    "panel",
    "paper_url",
    "data_url",
    "citation",
    "ranking",
    "library_only",
    "findings"
  ],
  "definitions": {
    "scenarioId": {
      "type": "string",
      "pattern": "^S[0-9]{2}$"
    },
    "movement": {
      "enum": [
        "new",
        "up",
        "down",
        "unchanged"
      ]
    }
  },
  "properties": {
    "edition": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "status": {
      "enum": [
        "development",
        "released"
      ]
    },
    "version": {
      "type": "string"
    },
    "library_version": {
      "type": "string"
    },
    "release_date": {
      "type": [
        "string",
        "null"
      ]
    },
    "release_note": {
      "type": "string"
    },
    "release_venue": {
      "type": "string"
    },
    "framing": {
      "type": "string"
    },
    "horizons": {
      "type": "object"
    },
    "scores_source": {
      "enum": [
        "ginc-desk-v0.2",
        "panel-2027"
      ]
    },
    "scores_note": {
      "type": "string"
    },
    "panel": {
      "type": [
        "object",
        "null"
      ]
    },
    "previous_edition": {
      "type": [
        "integer",
        "null"
      ]
    },
    "paper_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "data_url": {
      "type": "string"
    },
    "citation": {
      "type": "string"
    },
    "ranking": {
      "type": "array",
      "minItems": 10,
      "maxItems": 10,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "rank",
          "id",
          "movement"
        ],
        "properties": {
          "rank": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "id": {
            "$ref": "#/definitions/scenarioId"
          },
          "movement": {
            "$ref": "#/definitions/movement"
          }
        }
      }
    },
    "library_only": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "movement"
        ],
        "properties": {
          "id": {
            "$ref": "#/definitions/scenarioId"
          },
          "movement": {
            "$ref": "#/definitions/movement"
          }
        }
      }
    },
    "judgements": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ids",
          "note"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "$ref": "#/definitions/scenarioId"
            }
          },
          "note": {
            "type": "string"
          }
        }
      }
    },
    "ranking_basis": {
      "type": "string"
    },
    "findings": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "n",
          "text"
        ],
        "properties": {
          "n": {
            "type": "integer"
          },
          "placeholder": {
            "type": "boolean"
          },
          "text": {
            "type": "string",
            "maxWords": 80
          }
        }
      }
    }
  }
}