{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.wherever.audio/schemas/webhooks/references/segment/v1.json",
  "type": "object",
  "properties": {
    "segmentId": {
      "type": "string",
      "description": "Stable for the life of the segment."
    },
    "segmentStart": {
      "type": "number",
      "minimum": 0,
      "description": "Position where the segment opened (seconds)"
    },
    "position": {
      "type": "number",
      "minimum": 0,
      "description": "Current position (seconds)"
    },
    "mediaDuration": {
      "type": "number",
      "minimum": 0,
      "description": "The media's actual length (seconds)"
    },
    "playbackRate": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "listenTimeReal": {
      "type": "number",
      "minimum": 0,
      "description": "Wall-clock time listened in this segment (seconds)"
    },
    "listenTimePlayback": {
      "type": "number",
      "minimum": 0,
      "description": "Real time multiplied by playback rate (seconds)"
    },
    "startedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the segment opened."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When this state was captured."
    },
    "closed": {
      "type": "boolean"
    }
  },
  "required": [
    "segmentId",
    "segmentStart",
    "position",
    "playbackRate",
    "listenTimeReal",
    "listenTimePlayback",
    "startedAt",
    "updatedAt",
    "closed"
  ],
  "title": "Playback segment",
  "description": "One stretch of continuous listening. Every field is cumulative: the latest update for a `segmentId` replaces all earlier ones."
}
