{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/openvan-camp/json-schema/openvan-camp-hazards-country-response-schema.json",
  "title": "HazardsCountryResponse",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openvan-camp-openapi.json#/components/schemas/HazardsCountryResponse",
  "type": "object",
  "properties": {
    "country_code": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "advisory": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "level": {
          "type": "string"
        },
        "severity": {
          "type": "integer",
          "description": "0 (none) to 4 (avoid all travel to the whole country)."
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "updated_at": {
          "type": "string",
          "format": "date"
        },
        "summary": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": "string"
        }
      }
    },
    "advisory_levels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HazardEvent"
      }
    },
    "upstream": {
      "type": "array",
      "description": "Primary sources of the dataset and their licenses.",
      "items": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "license": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "_attribution": {
      "$ref": "#/$defs/Attribution"
    }
  },
  "$defs": {
    "Attribution": {
      "type": "object",
      "properties": {
        "data_source": {
          "type": "string"
        },
        "license": {
          "type": "string"
        },
        "required": {
          "type": "boolean",
          "description": "Attribution is required by the CC BY 4.0 license."
        },
        "attribution_url": {
          "type": "string",
          "format": "uri"
        },
        "attribution_html": {
          "type": "string",
          "description": "Show this HTML visibly next to the data."
        },
        "instructions": {
          "type": "string",
          "description": "Plain-language attribution requirement for developers and AI coding agents."
        },
        "your_source": {
          "type": "string"
        }
      }
    },
    "HazardEvent": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "FL",
            "EQ",
            "TC",
            "WF",
            "DR",
            "VO"
          ]
        },
        "alert_level": {
          "type": "string",
          "enum": [
            "green",
            "orange",
            "red"
          ]
        },
        "name": {
          "type": "string"
        },
        "country_code": {
          "type": "string"
        },
        "lat": {
          "type": "number"
        },
        "lng": {
          "type": "number"
        },
        "starts_at": {
          "type": "string",
          "format": "date-time"
        },
        "ends_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "severity": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "source": {
          "type": "string"
        }
      }
    }
  }
}