{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.healthexport.dev/schemas/webhook/v1/events.json",
  "title": "MetricBridge webhook: events",
  "description": "The complete event timeline the user keeps in the app (medication starts, visits, travel, and so on). Replace what you stored: an event missing from the list was deleted.",
  "allOf": [{ "$ref": "common.json#/$defs/typedDocument" }],
  "type": "object",
  "properties": {
    "type": { "const": "events" },
    "data": {
      "type": "object",
      "required": ["metrics", "events"],
      "properties": {
        "events": {
          "type": "object",
          "required": ["mode", "events"],
          "properties": {
            "mode": { "const": "replace" },
            "events": {
              "type": "array",
              "items": {
                "type": "object",
                "required": ["id", "date", "type", "title"],
                "properties": {
                  "id": { "type": "string" },
                  "date": { "$ref": "common.json#/$defs/isoDay" },
                  "endDate": { "$ref": "common.json#/$defs/isoDay" },
                  "type": { "type": "string", "description": "medication | habit | visit | life | shift | episode | travel | other. Accept unknown values." },
                  "title": { "type": "string" },
                  "note": { "type": "string" },
                  "tags": { "type": "array", "items": { "type": "string" } }
                }
              }
            }
          }
        }
      }
    }
  }
}
