{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.healthexport.dev/schemas/webhook/v1/timezone-changes.json",
  "title": "MetricBridge webhook: timezone.changes",
  "description": "The complete time zone log. Replace what you stored. A day on which a change lands is a travel day (it was not 24 hours long).",
  "allOf": [{ "$ref": "common.json#/$defs/typedDocument" }],
  "type": "object",
  "properties": {
    "type": { "const": "timezone.changes" },
    "data": {
      "type": "object",
      "required": ["metrics", "timeZones"],
      "properties": {
        "timeZones": {
          "type": "object",
          "required": ["mode", "currentTz", "changes"],
          "properties": {
            "mode": { "const": "replace" },
            "currentTz": { "$ref": "common.json#/$defs/ianaZone" },
            "changes": {
              "type": "array",
              "items": {
                "type": "object",
                "required": ["from", "tz", "utcOffsetMin"],
                "properties": {
                  "from": { "$ref": "common.json#/$defs/isoDay", "description": "From this local day onward the phone was in tz." },
                  "tz": { "$ref": "common.json#/$defs/ianaZone" },
                  "utcOffsetMin": { "type": "integer" }
                }
              }
            },
            "note": { "type": "string" }
          }
        }
      }
    }
  }
}
