{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "qp_schema.json",
  "title": "qp",
  "description": "A parliamentary question",
  "type": "object",
  "required": [
    "_id",
    "_source_url",
    "number",
    "subject",
    "type",
    "date",
    "completed",
    "authors",
    "destinations",
    "answer",
    "events"
  ],
  "additionalProperties": false,
  "properties": {
    "_id": {
      "description": "The internal id in the website of the parliamentary question. This id is unique across all parliamentary questions.",
      "type": "integer",
      "minimum": 1
    },
    "_source_url": {
      "description": "The URL to website of the parliamentary question.",
      "type": "string",
      "format": "uri"
    },
    "number": {
      "description": "The number of the parliamentary question.",
      "type": "integer",
      "minimum": 1
    },
    "subject": {
      "description": "The subject of the parliamentary question.",
      "type": "string",
      "minLength": 1
    },
    "type": {
      "description": "The type of the parliamentary question.",
      "type": "string",
      "enum": [
        "written",
        "oral",
        "urgent",
        "enlarged"
      ]
    },
    "date": {
      "description": "The date on which the parliamentary question was asked.",
      "type": "string",
      "format": "date"
    },
    "completed": {
      "description": "If true, the parliamentary question is answered, withdrawn, inadmissible or expired.",
      "type": "boolean"
    },
    "authors": {
      "description": "The list of authors of the parliamentary question.",
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "The name of the author.",
            "type": "string",
            "minLength": 1,
            "pattern": "^(\\w| |-|\\'|\\.)+$"
          },
          "title": {
            "description": "The title of the author.",
            "type": "string",
            "minLength": 1,
            "pattern": "^(\\w| |-|\\'|,)+$"
          }
        },
        "required": [
          "name",
          "title"
        ],
        "additionalProperties": false
      }
    },
    "destinations": {
      "description": "The list of recipients of the parliamentary question.",
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "The name of the recipient.",
            "type": "string",
            "minLength": 1,
            "pattern": "^(\\w| |-|\\'|\\.)+$"
          },
          "title": {
            "description": "The title of the recipient.",
            "type": "string",
            "minLength": 1,
            "pattern": "^(\\w| |-|\\'|,)+$"
          }
        },
        "required": [
          "name",
          "title"
        ],
        "additionalProperties": false
      }
    },
    "events": {
      "description": "The list of events associated with the parliamentary question.",
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "date",
          "description"
        ],
        "additionalProperties": false,
        "properties": {
          "date": {
            "description": "The date when the event occured.",
            "type": "string",
            "format": "date"
          },
          "description": {
            "description": "A description what happened.",
            "type": "string",
            "minLength": 1
          },
          "intervenants": {
            "description": "A list of people associated with the event.",
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "documents": {
            "description": "Documents associated with the event.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "document_url": {
                  "description": "A URL pointing to an associated document of the event.",
                  "type": "string",
                  "format": "uri"
                },
                "title": {
                  "description": "The title of the URL.",
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "document_url",
                "title"
              ],
              "additionalProperties": false
            }
          }
        }
      }
    },
    "answer": {
      "description": "Data concerning the answer to the parliamentary question.",
      "type": "object",
      "required": [
        "status",
        "delayed"
      ],
      "additionalProperties": false,
      "properties": {
        "status": {
          "description": "The current status of the answer.",
          "type": "string",
          "enum": [
            "waiting",
            "withdrawn",
            "inadmissible",
            "answered",
            "expired"
          ]
        },
        "delayed": {
          "description": "True if the answer is delayed.",
          "type": "boolean"
        },
        "type": {
          "description": "The type of the answer.",
          "type": "string",
          "enum": [
            "written",
            "oral"
          ]
        },
        "legislature_number": {
          "description": "The number of the legislature when the answer was given.",
          "type": "number",
          "minimum": 1
        },
        "session_number": {
          "description": "The parliamentary session number when the answer was given.",
          "type": "number",
          "minimum": 1
        },
        "document_url": {
          "description": "The url to the PDF of the answer or the video of the session, when the anwer was given.",
          "type": "string",
          "format": "uri"
        },
        "date": {
          "description": "The date when the answer was given.",
          "type": "string",
          "format": "date"
        },
        "authors": {
          "description": "The list of authors of the answer.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "description": "The name of the author of the answer.",
                "type": "string",
                "minLength": 1,
                "pattern": "^(\\w| |-|\\'|\\.)+$"
              },
              "title": {
                "description": "The title of the author of the answer.",
                "type": "string",
                "minLength": 1,
                "pattern": "^(\\w| |-|\\'|,)+$"
              }
            },
            "required": [
              "name"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "document_url": {
      "description": "The URL to the PDF of the parliamentary question.",
      "type": "string",
      "format": "uri"
    },
    "legislature_number": {
      "description": "The number of the legislature when the parliamentary question was asked.",
      "type": "number",
      "minimum": 1
    },
    "session_number": {
      "description": "The parliamentary session number when the parliamentary question was asked.",
      "type": "number",
      "minimum": 1
    }
  }
}
