{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jambonz.org/schema/callbacks/play",
  "title": "Play ActionHook Payload",
  "description": "Payload sent to the play verb's actionHook when playback completes or fails.",
  "allOf": [
    { "$ref": "base" }
  ],
  "type": "object",
  "properties": {
    "reason": {
      "type": "string",
      "enum": ["playCompleted", "playFailed"],
      "description": "Outcome of playback. 'playCompleted' on success, 'playFailed' on file-not-found or other error."
    },
    "playback_seconds": {
      "type": "integer",
      "description": "Total playback duration in seconds. Present when reason is 'playCompleted'."
    },
    "playback_milliseconds": {
      "type": "integer",
      "description": "Total playback duration in milliseconds. Present when reason is 'playCompleted'."
    },
    "playback_last_offset_pos": {
      "type": "string",
      "description": "Last offset position in the audio stream. Present when reason is 'playCompleted'."
    },
    "status": {
      "type": "string",
      "enum": ["fail"],
      "description": "Set to 'fail' when playback failed (e.g. file not found)."
    }
  },
  "required": ["reason"],
  "additionalProperties": true
}
