{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://alice51849.github.io/ios-app-guide/data/family-travel-missions.schema.json",
  "title": "Privacy-first family travel mission taxonomy",
  "description": "Schema for the bilingual family travel mission taxonomy.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "name",
    "nameLocalized",
    "description",
    "descriptionLocalized",
    "identifier",
    "license",
    "creator",
    "version",
    "dateCreated",
    "dateModified",
    "languages",
    "keywords",
    "scope",
    "methodology",
    "limitations",
    "privacyDesign",
    "relatedResources",
    "officialReferences",
    "participationModes",
    "scenarios"
  ],
  "properties": {
    "$schema": {
      "const": "https://alice51849.github.io/ios-app-guide/data/family-travel-missions.schema.json"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "nameLocalized": {
      "$ref": "#/$defs/localizedString"
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "descriptionLocalized": {
      "$ref": "#/$defs/localizedString"
    },
    "identifier": {
      "const": "https://alice51849.github.io/ios-app-guide/data/family-travel-missions.json"
    },
    "license": {
      "const": "https://creativecommons.org/licenses/by/4.0/"
    },
    "creator": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "dateCreated": {
      "type": "string",
      "format": "date"
    },
    "dateModified": {
      "type": "string",
      "format": "date"
    },
    "languages": {
      "const": [
        "en",
        "zh-Hant"
      ]
    },
    "keywords": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "scope": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scenarioCount",
        "targetCount",
        "participationModeCount",
        "flatRecordCount"
      ],
      "properties": {
        "scenarioCount": {
          "const": 12
        },
        "targetCount": {
          "const": 84
        },
        "participationModeCount": {
          "const": 3
        },
        "flatRecordCount": {
          "const": 252
        }
      }
    },
    "methodology": {
      "$ref": "#/$defs/localizedString"
    },
    "limitations": {
      "$ref": "#/$defs/localizedString"
    },
    "privacyDesign": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "accountRequired",
        "personalDataRequested",
        "photoTasksIncluded",
        "locationDataRequested",
        "itineraryDataRequested",
        "completionTrackingIncluded",
        "prohibitedFields"
      ],
      "properties": {
        "accountRequired": {
          "const": false
        },
        "personalDataRequested": {
          "const": false
        },
        "photoTasksIncluded": {
          "const": false
        },
        "locationDataRequested": {
          "const": false
        },
        "itineraryDataRequested": {
          "const": false
        },
        "completionTrackingIncluded": {
          "const": false
        },
        "prohibitedFields": {
          "type": "array",
          "minItems": 7,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "relatedResources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/relatedResource"
      }
    },
    "officialReferences": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/officialReference"
      }
    },
    "participationModes": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "$ref": "#/$defs/participationMode"
      }
    },
    "scenarios": {
      "type": "array",
      "minItems": 12,
      "maxItems": 12,
      "items": {
        "$ref": "#/$defs/scenario"
      }
    }
  },
  "$defs": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "localizedString": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "en",
        "zh-Hant"
      ],
      "properties": {
        "en": {
          "type": "string",
          "minLength": 1
        },
        "zh-Hant": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "relatedResource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "url"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/localizedString"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      }
    },
    "officialReference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "publisher",
        "title",
        "url",
        "supports"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "publisher": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "supports": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          }
        }
      }
    },
    "participationMode": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "promptTemplate",
        "ageBand",
        "abilityLevel"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/localizedString"
        },
        "promptTemplate": {
          "$ref": "#/$defs/localizedString"
        },
        "ageBand": {
          "type": "null"
        },
        "abilityLevel": {
          "type": "null"
        }
      }
    },
    "target": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "text"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "text": {
          "$ref": "#/$defs/localizedString"
        }
      }
    },
    "scenario": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "stationaryRequired",
        "photoTaskAllowed",
        "driverInteractionAllowed",
        "adultSupervisionRequired",
        "skipAllowed",
        "safetyBoundary",
        "officialReferenceIds",
        "targets"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/localizedString"
        },
        "stationaryRequired": {
          "const": true
        },
        "photoTaskAllowed": {
          "const": false
        },
        "driverInteractionAllowed": {
          "const": false
        },
        "adultSupervisionRequired": {
          "const": true
        },
        "skipAllowed": {
          "const": true
        },
        "safetyBoundary": {
          "$ref": "#/$defs/localizedString"
        },
        "officialReferenceIds": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/id"
          }
        },
        "targets": {
          "type": "array",
          "minItems": 7,
          "maxItems": 7,
          "items": {
            "$ref": "#/$defs/target"
          }
        }
      }
    }
  }
}
