{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://thewarrecord.com/api/v1/schema/statement.json",
 "title": "statement",
 "type": "object",
 "required": [
  "id",
  "type",
  "conflict",
  "speaker",
  "audience",
  "language",
  "said_on",
  "text",
  "citations",
  "record_state",
  "schema_version"
 ],
 "properties": {
  "record_state": {
   "enum": [
    "active",
    "merged",
    "withdrawn"
   ]
  },
  "merged_into": {
   "type": "string"
  },
  "withdrawn_reason": {
   "type": "string"
  },
  "schema_version": {
   "const": 1
  },
  "created_at": {
   "type": "string",
   "format": "date-time"
  },
  "last_changed": {
   "type": "string",
   "format": "date-time"
  },
  "id": {
   "type": "string",
   "pattern": "^st-\\d{8}-[0-9a-hjkmnp-tv-z]{4}$"
  },
  "type": {
   "const": "statement"
  },
  "conflict": {
   "type": "string",
   "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"
  },
  "speaker": {
   "type": "string",
   "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"
  },
  "audience": {
   "enum": [
    "domestic",
    "foreign",
    "international_body",
    "mixed"
   ]
  },
  "language": {
   "type": "string"
  },
  "said_on": {
   "type": "string",
   "format": "date"
  },
  "text": {
   "type": "string",
   "description": "Our neutral summary of what was said; any quotation lives in a citation excerpt."
  },
  "topic": {
   "type": "string"
  },
  "pair": {
   "type": "string",
   "description": "The statement on the same topic to the other audience (the two-audience ledger)."
  },
  "citations": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "object",
    "required": [
     "source",
     "url",
     "origin",
     "role",
     "published_at",
     "accessed_at"
    ],
    "properties": {
     "source": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"
     },
     "url": {
      "type": "string",
      "format": "uri"
     },
     "archive_url": {
      "type": "string",
      "format": "uri"
     },
     "origin": {
      "type": "string",
      "minLength": 3,
      "description": "The first-hand material this citation relies on. Independence is counted on distinct origins, not outlets."
     },
     "role": {
      "enum": [
       "evidence",
       "corroboration",
       "contradiction",
       "claim_origin",
       "count",
       "visual",
       "sensor"
      ]
     },
     "supports": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "published_at": {
      "type": "string",
      "format": "date-time"
     },
     "accessed_at": {
      "type": "string",
      "format": "date-time"
     },
     "language": {
      "type": "string"
     },
     "excerpt": {
      "type": "string",
      "maxLength": 200
     }
    },
    "additionalProperties": false
   }
  }
 },
 "additionalProperties": false
}
