<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/cx/v3/session.proto

namespace Google\Cloud\Dialogflow\Cx\V3;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * The top-level message returned from the
 * [StreamingDetectIntent][google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent]
 * method.
 * Multiple response messages can be returned in order:
 * *   If the `StreamingDetectIntentRequest.query_input.audio` field was
 *     set, the first M messages contain `recognition_result`.
 *     Each `recognition_result` represents a more complete transcript of what
 *     the user said. The last `recognition_result` has `is_final` set to
 *     `true`.
 * *   If the `StreamingDetectIntentRequest.enable_partial_response` field was
 *     true, the `detect_intent_response` field is populated for each
 *     of the following N responses, where 0 <= N <= 5.
 *     These responses set the
 *     [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3.DetectIntentResponse.response_type]
 *     field to `PARTIAL`.
 * For the last response message, the `detect_intent_response` is fully
 * populated, and
 * [DetectIntentResponse.response_type][google.cloud.dialogflow.cx.v3.DetectIntentResponse.response_type]
 * is set to `FINAL`.
 *
 * Generated from protobuf message <code>google.cloud.dialogflow.cx.v3.StreamingDetectIntentResponse</code>
 */
class StreamingDetectIntentResponse extends \Google\Protobuf\Internal\Message
{
    /**
     * Debugging info that would get populated when
     * `StreamingDetectIntentRequest.enable_debugging_info` is set to true.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.CloudConversationDebuggingInfo debugging_info = 4;</code>
     */
    protected $debugging_info = null;
    protected $response;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dialogflow\Cx\V3\StreamingRecognitionResult $recognition_result
     *           The result of speech recognition.
     *     @type \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponse $detect_intent_response
     *           The response from detect intent.
     *     @type \Google\Cloud\Dialogflow\Cx\V3\CloudConversationDebuggingInfo $debugging_info
     *           Debugging info that would get populated when
     *           `StreamingDetectIntentRequest.enable_debugging_info` is set to true.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce();
        parent::__construct($data);
    }

    /**
     * The result of speech recognition.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.StreamingRecognitionResult recognition_result = 1;</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\StreamingRecognitionResult|null
     */
    public function getRecognitionResult()
    {
        return $this->readOneof(1);
    }

    public function hasRecognitionResult()
    {
        return $this->hasOneof(1);
    }

    /**
     * The result of speech recognition.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.StreamingRecognitionResult recognition_result = 1;</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\StreamingRecognitionResult $var
     * @return $this
     */
    public function setRecognitionResult($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\StreamingRecognitionResult::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * The response from detect intent.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.DetectIntentResponse detect_intent_response = 2;</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponse|null
     */
    public function getDetectIntentResponse()
    {
        return $this->readOneof(2);
    }

    public function hasDetectIntentResponse()
    {
        return $this->hasOneof(2);
    }

    /**
     * The response from detect intent.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.DetectIntentResponse detect_intent_response = 2;</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponse $var
     * @return $this
     */
    public function setDetectIntentResponse($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponse::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Debugging info that would get populated when
     * `StreamingDetectIntentRequest.enable_debugging_info` is set to true.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.CloudConversationDebuggingInfo debugging_info = 4;</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\CloudConversationDebuggingInfo|null
     */
    public function getDebuggingInfo()
    {
        return $this->debugging_info;
    }

    public function hasDebuggingInfo()
    {
        return isset($this->debugging_info);
    }

    public function clearDebuggingInfo()
    {
        unset($this->debugging_info);
    }

    /**
     * Debugging info that would get populated when
     * `StreamingDetectIntentRequest.enable_debugging_info` is set to true.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.CloudConversationDebuggingInfo debugging_info = 4;</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\CloudConversationDebuggingInfo $var
     * @return $this
     */
    public function setDebuggingInfo($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\CloudConversationDebuggingInfo::class);
        $this->debugging_info = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getResponse()
    {
        return $this->whichOneof("response");
    }

}

