{
  "openapi": "3.0.3",
  "info": {
    "title": "VRNHN",
    "description": "Veiligheidsregio Noord-Holland Noord",
    "version": "2.0.0"
  },
  "servers": [
    {
      "url": "https://www.vrnhn.nl/api"
    }
  ],
  "paths": {
    "/incidenten": {
      "get": {
        "description": "De lijst met incidenten in de regio",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "description": "Filter incidenten op incidentdatum vanaf deze datum (YYYY-MM-DD)",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "till",
            "in": "query",
            "description": "Filter incidenten op incidentdatum tot en met deze datum (YYYY-MM-DD)",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Filter de incidenten door te zoeken in titel of introtekst",
            "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 incidenten in de regio",
            "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
                        },
                        "till": {
                          "type": "string",
                          "format": "date",
                          "nullable": true
                        },
                        "search": {
                          "type": "string",
                          "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, inclusief updates",
        "parameters": [
          {
            "name": "incidentId",
            "in": "path",
            "description": "Het incident ID",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "De gegevens van het incident",
            "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 incident"
          },
          "intro": {
            "type": "string",
            "description": "De introtekst van het incident"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "De incidentdatum"
          },
          "url": {
            "type": "string",
            "format": "url",
            "description": "De URL waarop het incident en updates te bekijken zijn"
          },
          "data_url": {
            "type": "string",
            "format": "url",
            "description": "De URL waarmee de gegevens van het incident op te halen zijn (API)"
          },
          "theme_url": {
            "type": "string",
            "format": "url",
            "description": "Absolute URL naar de bijbehorende 'Wat kan ik doen bij'-themapagina",
            "nullable": true
          },
          "updates": {
            "type": "array",
            "description": "De updates bij dit incident, gesorteerd op aanmaakdatum (nieuwste eerst)",
            "items": {
              "$ref": "#/components/schemas/incident-update"
            }
          }
        }
      },
      "incident-update": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "De titel van de update"
          },
          "text": {
            "type": "string",
            "description": "De tekst van de update"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "De aanmaakdatum van de update"
          },
          "images": {
            "type": "array",
            "description": "De afbeeldingen van de update",
            "items": {
              "$ref": "#/components/schemas/image"
            }
          }
        }
      },
      "image": {
        "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"
          }
        }
      },
      "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"
          }
        }
      }
    }
  }
}
