{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Device app. Records a playback event of a delivered work: started (clears the unplayed state), paused (with the position the viewer can resume from) and completed. Playback is independent of delivery and is never an acknowledgement. Events are idempotent by eventKey within the delivery; the server keeps the latest paused position.",
      "errors": [
        {
          "name": "NotMember"
        },
        {
          "name": "DeliveryNotFound"
        },
        {
          "name": "NotDevice"
        },
        {
          "name": "DeliveryWithdrawn"
        },
        {
          "name": "RequestConflict"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "deliveryId": {
              "maxLength": 64,
              "type": "string"
            },
            "event": {
              "knownValues": [
                "started",
                "paused",
                "completed"
              ],
              "type": "string"
            },
            "eventKey": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "occurredAt": {
              "format": "datetime",
              "type": "string"
            },
            "positionMs": {
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "homeId",
            "deliveryId",
            "event",
            "positionMs",
            "occurredAt",
            "eventKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "lastPositionMs": {
              "minimum": 0,
              "type": "integer"
            },
            "playbackState": {
              "knownValues": [
                "unplayed",
                "inProgress",
                "paused",
                "completed"
              ],
              "type": "string"
            },
            "recorded": {
              "type": "boolean"
            }
          },
          "required": [
            "recorded",
            "playbackState",
            "lastPositionMs"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.artwork.recordPlayback",
  "lexicon": 1
}
