{
  "$ref": "#/definitions/DtVoteEvents",
  "definitions": {
    "DtVoteEvents": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Vote-event ID."
          },
          "identifier": {
            "type": "string",
            "description": "Roll call or journal id"
          },
          "motion_id": {
            "type": "string"
          },
          "organization_id": {
            "type": "string"
          },
          "start_date": {
            "type": "string",
            "description": "YYYY-MM-DD or ISO datetime"
          },
          "end_date": {
            "type": "string",
            "description": "YYYY-MM-DD or ISO datetime"
          },
          "result": {
            "anyOf": [
              {
                "anyOf": [
                  {
                    "not": {}
                  },
                  {
                    "type": "string",
                    "enum": [
                      "pass",
                      "fail"
                    ]
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Outcome of the vote-event. Null/omitted if unknown."
          },
          "counts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "option": {
                  "type": "string",
                  "description": "Vote option. Recommended: yes, no, abstain, not voting, absent, secret, unknown. Other values allowed."
                },
                "value": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "option",
                "value"
              ],
              "additionalProperties": false
            },
            "description": "Aggregate counts per option."
          },
          "votes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "voter_id": {
                  "type": "string",
                  "description": "ID of the voter (person or organization)."
                },
                "option": {
                  "type": "string",
                  "description": "Vote option. Recommended: yes, no, abstain, not voting, absent, secret, unknown. Other values allowed."
                },
                "role": {
                  "type": "string",
                  "description": "e.g., Speaker, Acting"
                },
                "note": {
                  "type": "string"
                },
                "vote_event_id": {
                  "type": "string",
                  "description": "ID of the vote-event this vote belongs to."
                },
                "voter_type": {
                  "type": "string",
                  "enum": [
                    "person",
                    "organization"
                  ],
                  "description": "Disambiguates whether voter_id refers to a person or an organization."
                }
              },
              "required": [
                "voter_id",
                "option",
                "vote_event_id"
              ],
              "additionalProperties": false
            },
            "description": "Individual votes."
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "note": {
                  "type": "string"
                }
              },
              "required": [
                "url"
              ],
              "additionalProperties": false
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "note": {
                  "type": "string"
                }
              },
              "required": [
                "url"
              ],
              "additionalProperties": false
            }
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "valid",
              "invalid",
              "test",
              "other"
            ],
            "default": "valid",
            "description": "Vote-event status. Default is valid. Use invalid for annulled/mistaken votes, test for test votes, other for special cases."
          },
          "requirement": {
            "type": "string",
            "description": "Voting requirement for this vote-event (e.g., simple majority, 3/5)."
          },
          "extras": {
            "type": "object",
            "additionalProperties": {},
            "description": "Additional metadata fields not covered by the core schema (e.g., sitting number, agenda item)."
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      }
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}