{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-communication-services/json-schema/microsoft-azure-communication-services-play-request-schema.json",
  "title": "PlayRequest",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-communication-services-callautomation-api-openapi.yml#/components/schemas/PlayRequest",
  "required": [
    "playSources"
  ],
  "type": "object",
  "properties": {
    "playSources": {
      "description": "The source of the audio to be played.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/PlaySource"
      }
    },
    "playTo": {
      "description": "The list of call participants play provided audio to.\r\nPlays to everyone in the call when not provided.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/CommunicationIdentifierModel"
      }
    },
    "interruptCallMediaOperation": {
      "description": "If set play can barge into other existing queued-up/currently-processing requests.",
      "type": "boolean"
    },
    "playOptions": {
      "$ref": "#/$defs/PlayOptions"
    },
    "operationContext": {
      "description": "The value to identify context of the operation.",
      "type": "string"
    },
    "operationCallbackUri": {
      "description": "Set a callback URI that overrides the default callback URI set by CreateCall/AnswerCall for this operation.\r\nThis setup is per-action. If this is not set, the default callback URI set by CreateCall/AnswerCall will be used.",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "CommunicationIdentifierModel": {
      "$ref": "../../../Common/stable/2025-06-30/common.json#/components/schemas/CommunicationIdentifierModel"
    },
    "FileSource": {
      "required": [
        "uri"
      ],
      "type": "object",
      "properties": {
        "uri": {
          "description": "Uri for the audio file to be played",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "PlayOptions": {
      "required": [
        "loop"
      ],
      "type": "object",
      "properties": {
        "loop": {
          "description": "The option to play the provided audio source in loop when set to true",
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "PlaySource": {
      "required": [
        "kind"
      ],
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/$defs/PlaySourceType"
        },
        "playSourceCacheId": {
          "description": "Defines the identifier to be used for caching related media",
          "type": "string"
        },
        "file": {
          "$ref": "#/$defs/FileSource"
        },
        "text": {
          "$ref": "#/$defs/TextSource"
        },
        "ssml": {
          "$ref": "#/$defs/SsmlSource"
        }
      },
      "additionalProperties": false
    },
    "PlaySourceType": {
      "description": "Defines the types of play source",
      "enum": [
        "file",
        "text",
        "ssml"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "PlaySourceType",
        "modelAsString": true
      }
    },
    "SsmlSource": {
      "required": [
        "ssmlText"
      ],
      "type": "object",
      "properties": {
        "ssmlText": {
          "description": "Ssml string for the cognitive service to be played",
          "type": "string"
        },
        "customVoiceEndpointId": {
          "description": "Endpoint where the custom voice was deployed.",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "TextSource": {
      "required": [
        "text"
      ],
      "type": "object",
      "properties": {
        "text": {
          "description": "Text for the cognitive service to be played",
          "type": "string"
        },
        "sourceLocale": {
          "description": "Source language locale to be played\r\nRefer to available locales here: <seealso href=\"https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts\" />",
          "type": "string"
        },
        "voiceKind": {
          "$ref": "#/$defs/VoiceKind"
        },
        "voiceName": {
          "description": "Voice name to be played\r\nRefer to available Text-to-speech voices here: <seealso href=\"https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts\" />",
          "type": "string"
        },
        "customVoiceEndpointId": {
          "description": "Endpoint where the custom voice was deployed.",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "VoiceKind": {
      "description": "Audio kind type",
      "enum": [
        "male",
        "female"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "VoiceKind",
        "modelAsString": true
      }
    }
  }
}