{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://messagestowhatcomesnext.org/corpus/schema.json",
  "title": "Messages to What Comes Next: corpus record",
  "description": "One JSON object per line. The first line is a header record; every other line is an entry record. Timestamps are UTC in ISO 8601 (YYYY-MM-DDTHH:MM:SSZ). Ids are opaque.",
  "oneOf": [
    {
      "$ref": "#/$defs/header"
    },
    {
      "$ref": "#/$defs/entry"
    }
  ],
  "$defs": {
    "header": {
      "type": "object",
      "required": [
        "record",
        "schema_version",
        "site",
        "license",
        "generated_at",
        "note"
      ],
      "properties": {
        "record": {
          "const": "header"
        },
        "schema_version": {
          "type": "string"
        },
        "schema_url": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "site": {
          "type": "string"
        },
        "corpus_url": {
          "type": "string"
        },
        "license": {
          "const": "CC0-1.0"
        },
        "license_url": {
          "type": "string"
        },
        "generated_at": {
          "type": "string"
        },
        "public_opening_date": {
          "type": [
            "string",
            "null"
          ],
          "description": "Entries before this date were invited."
        },
        "entry_count": {
          "type": "integer"
        },
        "removed_count": {
          "type": "integer"
        },
        "set_count": {
          "type": "integer"
        },
        "complete_set_count": {
          "type": "integer"
        },
        "score_method_versions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "method_url": {
          "type": "string"
        },
        "note": {
          "type": "string",
          "description": "The sample-skew note."
        }
      }
    },
    "entry": {
      "type": "object",
      "required": [
        "record",
        "id",
        "url",
        "set_id",
        "position",
        "set_status",
        "submitted_at",
        "published_at",
        "message",
        "removed"
      ],
      "properties": {
        "record": {
          "const": "entry"
        },
        "id": {
          "type": "string",
          "description": "Opaque, stable, never derived from the text."
        },
        "url": {
          "type": "string"
        },
        "text_url": {
          "type": "string",
          "description": "Plain-text alternate of the entry page."
        },
        "set_id": {
          "type": "string",
          "description": "Opaque id of the writer's set of up to three entries."
        },
        "set_url": {
          "type": "string"
        },
        "position": {
          "type": "integer",
          "minimum": 1,
          "maximum": 3
        },
        "set_status": {
          "enum": [
            "open",
            "complete"
          ]
        },
        "set_opened_at": {
          "type": "string"
        },
        "set_completed_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "siblings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "position": {
                "type": "integer"
              },
              "published_at": {
                "type": "string"
              }
            }
          }
        },
        "submitted_at": {
          "type": "string"
        },
        "published_at": {
          "type": "string"
        },
        "message": {
          "type": [
            "string",
            "null"
          ],
          "description": "Exactly as written, trailing whitespace trimmed. Null only for a removed entry."
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 3166-1 alpha-2, or null for not stated."
        },
        "occupation": {
          "type": [
            "string",
            "null"
          ]
        },
        "birth_decade": {
          "type": [
            "string",
            "null"
          ]
        },
        "input_method": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "keyboard",
            "touchscreen",
            "dictation",
            "assistive-other",
            null
          ]
        },
        "detected_language": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 639-1, detected at build, never stated by the writer."
        },
        "composition_score": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 100
        },
        "score_method_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "typing_summary": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "message_chars": {
              "type": "integer"
            },
            "composition_time_s": {
              "type": "number",
              "description": "First keystroke to publish."
            },
            "deletions": {
              "type": "integer",
              "description": "Deletion events."
            },
            "deleted_chars": {
              "type": "integer"
            },
            "longest_pause_s": {
              "type": "number"
            },
            "interval_cv": {
              "type": [
                "number",
                "null"
              ],
              "description": "Coefficient of variation of within-burst inter-key intervals; null when fewer than 20 intervals."
            },
            "intervals_n": {
              "type": "integer"
            },
            "typed_chars": {
              "type": "integer"
            },
            "pasted": {
              "type": "boolean"
            },
            "pasted_chars": {
              "type": "integer"
            },
            "cursor_moves": {
              "type": "integer"
            }
          }
        },
        "removed": {
          "type": [
            "object",
            "null"
          ],
          "description": "Set only for an entry removed under legal compulsion; the URL and index place remain.",
          "properties": {
            "removed_at": {
              "type": "string"
            },
            "legal_basis": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
