{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://backpr.com/standard/v1/export.schema.json",
  "$comment": "Open Youth Registration format 1.x, BackPR, https://backpr.com/open-youth-registration. CC BY 4.0: https://creativecommons.org/licenses/by/4.0/",
  "title": "Export file",
  "description": "The top-level object of an Open Youth Registration file. A family's own file is an export file with one family and no programs or registrations. Custom fields must start with x- (for example x-bunk); other names are reserved for this format. Software that rewrites a file must keep fields it doesn't recognize.",
  "type": "object",
  "properties": {
    "format": {
      "const": "open-youth-registration"
    },
    "version": {
      "type": "string",
      "pattern": "^1\\.(0|[1-9][0-9]*)$",
      "description": "Format version, for example 1.0. Every 1.x reader accepts earlier 1.x files."
    },
    "exportedAt": {
      "$ref": "common.schema.json#/$defs/dateTime"
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$",
      "description": "ISO 4217 code for every amount in the file. If absent, USD."
    },
    "source": {
      "type": "object",
      "properties": {
        "system": {
          "type": "string"
        },
        "organization": {
          "type": "string"
        }
      }
    },
    "families": {
      "type": "array",
      "items": {
        "$ref": "family.schema.json"
      }
    },
    "programs": {
      "type": "array",
      "items": {
        "$ref": "program.schema.json"
      }
    },
    "registrations": {
      "type": "array",
      "items": {
        "$ref": "registration.schema.json"
      }
    }
  },
  "required": [
    "format",
    "version"
  ],
  "additionalProperties": true
}