{
  "openapi": "3.0.3",
  "info": {
    "title": "VRNHN",
    "description": "Veiligheidsregio Noord-Holland Noord",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://www.vrnhn.nl/api"
    }
  ],
  "paths": {
    "/incidenten": {
      "get": {
        "description": "De lijst met incident-berichten op VRNHN.nl",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Filter de incidenten met een 'vanaf' datum (YYYY-MM-DD)",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "till",
            "in": "query",
            "description": "Filter de incidenten met een 'tot' datum (YYYY-MM-DD)",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Filter de incidenten door te zoeken met een zoekwoord",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Paginanummer",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Aantal resultaten per pagina (max 50)",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "De lijst met incident-berichten op VRNHN.nl",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "description": "De lijst met gevonden incidenten",
                      "items": {
                        "$ref": "#/components/schemas/incident"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/pagination"
                    },
                    "filters": {
                      "type": "object",
                      "description": "De toegepaste filters",
                      "properties": {
                        "since": {
                          "type": "string",
                          "format": "date",
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "results",
                    "pagination"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Ongeldige filterwaarde gegeven",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/incidenten/{incidentId}": {
      "get": {
        "description": "De gegevens van een enkel incident-bericht",
        "parameters": [
          {
            "name": "incidentId",
            "in": "path",
            "description": "Het ID van het incident-bericht",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "De gegevens van het incident-bericht",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/incident"
                }
              }
            }
          },
          "404": {
            "description": "Incident niet gevonden",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string",
                  "example": "<!DOCTYPE html><html lang=\"nl\"><head><title>Pagina niet gevonden | Veiligheidsregio Noord-Holland Noord</title></head><body><h1>Pagina niet gevonden</h1><p>U probeerde om een pagina op onze website te bereiken, maar deze pagina bestaat helaas niet (meer).</p></body></html>"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "incident": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "De titel van het bericht"
          },
          "text": {
            "type": "string",
            "description": "De tekst van het bericht"
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "De datum waarop het bericht is gepubliceerd"
          },
          "url": {
            "type": "string",
            "format": "url",
            "description": "De URL waarop het bericht te bekijken is"
          },
          "data_url": {
            "type": "string",
            "format": "url",
            "description": "De URL waarmee de gegevens van het bericht op te halen zijn (API)"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "url",
                  "description": "De URL naar de afbeelding"
                },
                "thumbnail_url": {
                  "type": "string",
                  "format": "url",
                  "description": "De URL naar de thumbnail van de afbeelding"
                },
                "alt": {
                  "type": "string",
                  "description": "De alternatieve tekst voor de afbeelding"
                },
                "caption": {
                  "type": "string",
                  "description": "Het onderschrift van de afbeelding"
                }
              }
            },
            "description": "De afbeeldingen van het bericht"
          }
        }
      },
      "pagination": {
        "type": "object",
        "description": "De toegepaste paginering",
        "properties": {
          "page": {
            "type": "integer",
            "description": "De huidige pagina"
          },
          "resultsPerPage": {
            "type": "integer",
            "description": "Het aantal resultaten per pagina"
          },
          "totalPages": {
            "type": "integer",
            "description": "Het totaal aantal pagina's"
          },
          "totalResults": {
            "type": "integer",
            "description": "Het totaal aantal resultaten"
          }
        }
      }
    }
  }
}
