{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://thewarrecord.com/api/v1/schema/resolution.json",
 "title": "resolution",
 "type": "object",
 "description": "A vote in an international body on a resolution or draft about one of the wars, with every member state recorded.",
 "required": [
  "id",
  "type",
  "body",
  "symbol",
  "voted_on",
  "title",
  "conflicts",
  "result",
  "tally",
  "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": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"
  },
  "type": {
   "const": "resolution"
  },
  "body": {
   "enum": [
    "un_ga",
    "un_sc",
    "un_hrc",
    "iaea_bog",
    "osce_pc",
    "other"
   ]
  },
  "symbol": {
   "type": "string",
   "description": "The official document symbol, for example A/RES/ES-11/1 or S/2022/155."
  },
  "voted_on": {
   "type": "string",
   "format": "date"
  },
  "title": {
   "type": "string"
  },
  "summary": {
   "type": "string",
   "description": "Our neutral one or two sentences on what it said."
  },
  "conflicts": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "string",
    "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)*$"
   }
  },
  "result": {
   "enum": [
    "adopted",
    "failed",
    "vetoed"
   ]
  },
  "vetoed_by": {
   "type": "array",
   "items": {
    "type": "string",
    "pattern": "^[A-Z]{2}$"
   }
  },
  "tally": {
   "type": "object",
   "required": [
    "yes",
    "no",
    "abstain"
   ],
   "properties": {
    "yes": {
     "type": "integer",
     "minimum": 0
    },
    "no": {
     "type": "integer",
     "minimum": 0
    },
    "abstain": {
     "type": "integer",
     "minimum": 0
    },
    "not_voting": {
     "type": "integer",
     "minimum": 0
    }
   },
   "additionalProperties": false
  },
  "votes": {
   "type": "object",
   "description": "ISO 3166 alpha-2 code to vote. Blank means not recorded, never assumed.",
   "propertyNames": {
    "pattern": "^[A-Z]{2}$"
   },
   "additionalProperties": {
    "enum": [
     "yes",
     "no",
     "abstain",
     "not_voting"
    ]
   }
  },
  "document_url": {
   "type": "string",
   "format": "uri"
  },
  "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
}
