{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://backpr.com/standard/v1/consent.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": "Consent",
  "description": "A permission or acknowledgment a guardian gave or declined. Never overwrite or delete a consent; when a guardian changes an answer, add a new entry. For each type and child, the entry with the latest signedAt is current. If it has revokedAt, treat the consent as not given. 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": {
    "id": {
      "$ref": "common.schema.json#/$defs/id"
    },
    "type": {
      "enum": [
        "emergency-medical-care",
        "photo-media",
        "field-trip",
        "swimming",
        "sunscreen-insect-repellent",
        "medication",
        "policy-acknowledgment",
        "waiver",
        "other"
      ]
    },
    "granted": {
      "type": "boolean",
      "description": "true if given, false if declined."
    },
    "scope": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Details, for example for photo-media: newsletters, website, social-media, news."
    },
    "participantIds": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Children this applies to, by participant id. If absent or empty, it applies to every child in the family."
    },
    "signedBy": {
      "type": "string",
      "description": "Guardian id."
    },
    "signedAt": {
      "$ref": "common.schema.json#/$defs/dateTime"
    },
    "documentTitle": {
      "type": "string"
    },
    "documentVersion": {
      "type": "string"
    },
    "text": {
      "type": "string",
      "description": "The wording the guardian agreed to, if available."
    },
    "expires": {
      "$ref": "common.schema.json#/$defs/date"
    },
    "revokedAt": {
      "$ref": "common.schema.json#/$defs/dateTime"
    },
    "revokedBy": {
      "type": "string",
      "description": "Guardian id."
    }
  },
  "required": [
    "id",
    "type",
    "granted"
  ],
  "additionalProperties": true
}