{
  "$id": "https://legal.whilesmart.com/api/schemas/legal-document.json",
  "title": "Whilesmart legal document version",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "document": {
      "type": "string",
      "enum": [
        "privacy",
        "terms",
        "customer-terms",
        "dpa",
        "subprocessors",
        "cookies",
        "acceptable-use",
        "ai-and-recordings",
        "delete-my-data"
      ]
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "pattern": "^[a-z-]+-\\d{4}-\\d{2}-\\d{2}$"
    },
    "issued": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "effective": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "status": {
      "type": "string",
      "const": "published"
    },
    "summary": {
      "type": "string",
      "minLength": 1
    },
    "products": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z][a-z0-9-]*$"
      }
    },
    "changes": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "material": {
      "default": false,
      "description": "True when people must accept this version again",
      "type": "boolean"
    },
    "blocks": {
      "default": [],
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "product-sections",
              "subprocessor-table",
              "in-app-deletion",
              "deletion-request"
            ]
          },
          "after_heading": {
            "type": "string",
            "minLength": 1,
            "description": "Exact text of the level 2 heading the block follows; must match exactly once"
          },
          "products": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]*$"
            }
          }
        },
        "required": [
          "type",
          "after_heading"
        ],
        "additionalProperties": false
      }
    },
    "body": {
      "type": "string",
      "minLength": 1,
      "description": "GitHub flavoured Markdown, raw HTML is escaped"
    },
    "snapshot": {
      "description": "Frozen inventory for a published version",
      "type": "object",
      "properties": {
        "document": {
          "type": "string",
          "enum": [
            "privacy",
            "terms",
            "customer-terms",
            "dpa",
            "subprocessors",
            "cookies",
            "acceptable-use",
            "ai-and-recordings",
            "delete-my-data"
          ]
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "frozen": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "products": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "type": {
                "type": "string",
                "enum": [
                  "suite",
                  "app",
                  "mobile",
                  "website",
                  "platform"
                ]
              },
              "icon": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*\\.(svg|png)$"
              },
              "family": {
                "type": "string",
                "enum": [
                  "workspace",
                  "mindpad",
                  "pages",
                  "company"
                ]
              },
              "order": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "hosts": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "includes": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9-]*$"
                }
              },
              "summary": {
                "type": "string",
                "minLength": 1
              },
              "deletion": {
                "type": "string",
                "minLength": 1
              },
              "data": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9-]*\\.[a-z0-9-]+$"
                    },
                    "what": {
                      "type": "string",
                      "minLength": 1
                    },
                    "why": {
                      "type": "string",
                      "minLength": 1
                    },
                    "basis": {
                      "type": "object",
                      "properties": {
                        "personal": {
                          "type": "string",
                          "minLength": 1
                        },
                        "organization": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "personal",
                        "organization"
                      ],
                      "additionalProperties": false
                    },
                    "kept": {
                      "type": "string",
                      "minLength": 1
                    },
                    "processors": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9-]*$"
                      }
                    },
                    "delete": {
                      "type": "string",
                      "minLength": 1
                    },
                    "export": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "platforms": {
                      "default": [
                        "web",
                        "ios",
                        "android"
                      ],
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "web",
                          "ios",
                          "android"
                        ]
                      }
                    },
                    "apple": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "contact_info.name",
                              "contact_info.email_address",
                              "contact_info.phone_number",
                              "contact_info.physical_address",
                              "contact_info.other_contact_info",
                              "health_fitness.health",
                              "health_fitness.fitness",
                              "financial_info.payment_info",
                              "financial_info.credit_info",
                              "financial_info.other_financial_info",
                              "location.precise_location",
                              "location.coarse_location",
                              "sensitive_info.sensitive_info",
                              "contacts.contacts",
                              "user_content.emails_or_text_messages",
                              "user_content.photos_or_videos",
                              "user_content.audio_data",
                              "user_content.gameplay_content",
                              "user_content.customer_support",
                              "user_content.other_user_content",
                              "browsing_history.browsing_history",
                              "search_history.search_history",
                              "identifiers.user_id",
                              "identifiers.device_id",
                              "purchases.purchase_history",
                              "usage_data.product_interaction",
                              "usage_data.advertising_data",
                              "usage_data.other_usage_data",
                              "diagnostics.crash_data",
                              "diagnostics.performance_data",
                              "diagnostics.other_diagnostic_data",
                              "surroundings.environment_scanning",
                              "body.hands",
                              "body.head",
                              "other_data.other_data_types"
                            ]
                          },
                          "purposes": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "third_party_advertising",
                                "developer_advertising",
                                "analytics",
                                "product_personalization",
                                "app_functionality",
                                "other_purposes"
                              ]
                            }
                          },
                          "linked": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no"
                            ]
                          },
                          "tracking": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "purposes",
                          "linked",
                          "tracking"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "play": {
                      "default": [],
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "location.approximate_location",
                              "location.precise_location",
                              "personal_info.name",
                              "personal_info.email_address",
                              "personal_info.user_ids",
                              "personal_info.address",
                              "personal_info.phone_number",
                              "personal_info.race_and_ethnicity",
                              "personal_info.political_or_religious_beliefs",
                              "personal_info.sexual_orientation",
                              "personal_info.other_info",
                              "financial_info.user_payment_info",
                              "financial_info.purchase_history",
                              "financial_info.credit_score",
                              "financial_info.other_financial_info",
                              "health_and_fitness.health_info",
                              "health_and_fitness.fitness_info",
                              "messages.emails",
                              "messages.sms_or_mms",
                              "messages.other_in_app_messages",
                              "photos_and_videos.photos",
                              "photos_and_videos.videos",
                              "audio_files.voice_or_sound_recordings",
                              "audio_files.music_files",
                              "audio_files.other_audio_files",
                              "files_and_docs.files_and_docs",
                              "calendar.calendar_events",
                              "contacts.contacts",
                              "app_activity.app_interactions",
                              "app_activity.in_app_search_history",
                              "app_activity.installed_apps",
                              "app_activity.other_user_generated_content",
                              "app_activity.other_actions",
                              "web_browsing.web_browsing_history",
                              "app_info_and_performance.crash_logs",
                              "app_info_and_performance.diagnostics",
                              "app_info_and_performance.other_app_performance_data",
                              "device_or_other_ids.device_or_other_ids"
                            ]
                          },
                          "purposes": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "app_functionality",
                                "analytics",
                                "developer_communications",
                                "advertising_or_marketing",
                                "fraud_prevention_security_compliance",
                                "personalization",
                                "account_management"
                              ]
                            }
                          },
                          "optional": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no"
                            ]
                          },
                          "ephemeral": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no"
                            ]
                          },
                          "shared": {
                            "type": "string",
                            "enum": [
                              "yes",
                              "no"
                            ]
                          }
                        },
                        "required": [
                          "type",
                          "purposes",
                          "optional",
                          "ephemeral",
                          "shared"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "what",
                    "why",
                    "basis",
                    "kept",
                    "delete",
                    "export"
                  ],
                  "additionalProperties": false
                }
              },
              "listing": {
                "type": "object",
                "properties": {
                  "platforms": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "ios",
                        "android"
                      ]
                    }
                  },
                  "apple": {
                    "type": "object",
                    "properties": {
                      "tracking": {
                        "type": "string",
                        "enum": [
                          "yes",
                          "no"
                        ]
                      },
                      "notes": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "tracking"
                    ],
                    "additionalProperties": false
                  },
                  "play": {
                    "type": "object",
                    "properties": {
                      "data_shared": {
                        "type": "string",
                        "enum": [
                          "yes",
                          "no"
                        ]
                      },
                      "encrypted_in_transit": {
                        "type": "string",
                        "enum": [
                          "yes",
                          "no"
                        ]
                      },
                      "deletion_request": {
                        "type": "string",
                        "enum": [
                          "yes",
                          "no"
                        ]
                      },
                      "families_policy": {
                        "type": "string",
                        "enum": [
                          "yes",
                          "no"
                        ]
                      },
                      "notes": {
                        "default": [],
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "data_shared",
                      "encrypted_in_transit",
                      "deletion_request"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "platforms",
                  "apple",
                  "play"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "name",
              "type",
              "icon",
              "family",
              "order",
              "summary",
              "deletion"
            ],
            "additionalProperties": false
          }
        },
        "subprocessors": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "updated": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "subprocessors": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9-]*$"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "service": {
                        "type": "string",
                        "minLength": 1
                      },
                      "data": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "service",
                      "data"
                    ],
                    "additionalProperties": false
                  }
                },
                "not_subprocessors": {
                  "default": [],
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "changes": {
                  "default": [],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "date": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "change": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "date",
                      "change"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "updated",
                "subprocessors"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "document",
        "version",
        "frozen",
        "products",
        "subprocessors"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "document",
    "title",
    "version",
    "issued",
    "effective",
    "status",
    "summary",
    "products",
    "changes",
    "body"
  ],
  "additionalProperties": false
}
