{
  "$id": "https://intentschema.org/intents/productivity/calendar/event/update/v1.json",
  "fqdn": "org.intentschema.productivity.calendar.event.update.v1",
  "title": "Update calendar event",
  "description": "Updates fields on an existing calendar event via a JSON Patch (RFC 6902) applied to the event object.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target",
      "patch"
    ],
    "properties": {
      "target": {
        "allOf": [
          {
            "$ref": "https://intentschema.org/common/target/v1.json"
          },
          {
            "required": [
              "external_id"
            ]
          }
        ]
      },
      "patch": {
        "type": "array",
        "description": "RFC 6902 JSON Patch operations applied to the event object. Editable paths: /summary, /description, /location, /start, /end, /timezone, /attendees, /recurrence, /reminders.",
        "items": {
          "type": "object",
          "required": [
            "op",
            "path"
          ],
          "properties": {
            "op": {
              "enum": [
                "add",
                "remove",
                "replace",
                "move",
                "copy",
                "test"
              ]
            },
            "path": {
              "type": "string"
            },
            "value": {},
            "from": {
              "type": "string"
            }
          }
        },
        "minItems": 1
      },
      "idempotency_key": {
        "type": "string"
      }
    }
  },
  "result": {
    "type": "object",
    "properties": {
      "external_id": {
        "type": "string"
      },
      "etag": {
        "type": "string"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  },
  "examples": [
    {
      "name": "reschedule an event by 30 minutes",
      "value": {
        "target": {
          "system": "google_calendar",
          "external_id": "evt_abc123"
        },
        "patch": [
          {
            "op": "replace",
            "path": "/start",
            "value": "2026-04-22T15:30:00-07:00"
          },
          {
            "op": "replace",
            "path": "/end",
            "value": "2026-04-22T16:00:00-07:00"
          }
        ]
      }
    },
    {
      "name": "add an attendee",
      "value": {
        "target": {
          "system": "google_calendar",
          "external_id": "evt_abc123"
        },
        "patch": [
          {
            "op": "add",
            "path": "/attendees/-",
            "value": "alice@example.com"
          }
        ]
      }
    }
  ]
}
