{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://blackshard.com.au/open-data/tools/schema/au-breach-figures.schema.json",
  "title": "Australian breach and cybercrime figures",
  "description": "The figures behind https://blackshard.com.au/tools/incident-cost-estimator, each with its publisher, edition, locator, URL and retrieval date. The compilation is published under CC BY 4.0; each figure is its publisher's, under the licence or terms noted on its source.",
  "type": "object",
  "required": ["title", "description", "version", "licence", "licenceUrl", "attribution", "tool", "sources", "figures"],
  "additionalProperties": false,
  "properties": {
    "title": { "type": "string", "minLength": 1 },
    "description": { "type": "string", "minLength": 1 },
    "version": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
    "licence": { "const": "CC BY 4.0" },
    "licenceUrl": { "const": "https://creativecommons.org/licenses/by/4.0/" },
    "attribution": { "type": "string", "minLength": 1 },
    "tool": { "type": "string", "pattern": "^https://blackshard\\.com\\.au/tools/[a-z0-9-]+$" },
    "sources": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/source" } },
    "figures": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/figure" } }
  },
  "$defs": {
    "source": {
      "type": "object",
      "required": ["publisher", "edition", "url", "retrieved", "licence"],
      "additionalProperties": false,
      "properties": {
        "publisher": { "type": "string", "minLength": 1 },
        "edition": { "type": "string", "minLength": 1 },
        "url": { "type": "string", "pattern": "^https://" },
        "retrieved": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
        "licence": { "type": "string", "minLength": 1 }
      }
    },
    "figure": {
      "type": "object",
      "required": ["id", "label", "value", "unit", "period", "edition", "publisher", "url", "retrieved", "locator", "licence"],
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
        "label": { "type": "string", "minLength": 1 },
        "value": { "type": "number", "minimum": 0 },
        "unit": { "enum": ["AUD", "count", "percent", "multiple", "penalty units"] },
        "period": { "type": "string", "minLength": 1 },
        "edition": { "type": "string", "minLength": 1 },
        "publisher": { "type": "string", "minLength": 1 },
        "url": { "type": "string", "pattern": "^https://" },
        "retrieved": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
        "locator": { "type": "string", "minLength": 1 },
        "licence": { "type": "string", "minLength": 1 },
        "note": { "type": "string", "minLength": 1 }
      }
    }
  }
}
