<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/speech/v2/cloud_speech.proto

namespace Google\Cloud\Speech\V2;

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

/**
 * Final results for a single file.
 *
 * Generated from protobuf message <code>google.cloud.speech.v2.BatchRecognizeFileResult</code>
 */
class BatchRecognizeFileResult extends \Google\Protobuf\Internal\Message
{
    /**
     * Error if one was encountered.
     *
     * Generated from protobuf field <code>.google.rpc.Status error = 2;</code>
     */
    private $error = null;
    /**
     * Generated from protobuf field <code>.google.cloud.speech.v2.RecognitionResponseMetadata metadata = 3;</code>
     */
    private $metadata = null;
    /**
     * Deprecated. Use `cloud_storage_result.native_format_uri` instead.
     *
     * Generated from protobuf field <code>string uri = 1 [deprecated = true];</code>
     * @deprecated
     */
    protected $uri = '';
    /**
     * Deprecated. Use `inline_result.transcript` instead.
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.BatchRecognizeResults transcript = 4 [deprecated = true];</code>
     * @deprecated
     */
    protected $transcript = null;
    protected $result;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Rpc\Status $error
     *           Error if one was encountered.
     *     @type \Google\Cloud\Speech\V2\RecognitionResponseMetadata $metadata
     *     @type \Google\Cloud\Speech\V2\CloudStorageResult $cloud_storage_result
     *           Recognition results written to Cloud Storage. This is
     *           populated only when
     *           [GcsOutputConfig][google.cloud.speech.v2.GcsOutputConfig] is set in
     *           the
     *           [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
     *     @type \Google\Cloud\Speech\V2\InlineResult $inline_result
     *           Recognition results. This is populated only when
     *           [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in
     *           the
     *           [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
     *     @type string $uri
     *           Deprecated. Use `cloud_storage_result.native_format_uri` instead.
     *     @type \Google\Cloud\Speech\V2\BatchRecognizeResults $transcript
     *           Deprecated. Use `inline_result.transcript` instead.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Speech\V2\CloudSpeech::initOnce();
        parent::__construct($data);
    }

    /**
     * Error if one was encountered.
     *
     * Generated from protobuf field <code>.google.rpc.Status error = 2;</code>
     * @return \Google\Rpc\Status|null
     */
    public function getError()
    {
        return $this->error;
    }

    public function hasError()
    {
        return isset($this->error);
    }

    public function clearError()
    {
        unset($this->error);
    }

    /**
     * Error if one was encountered.
     *
     * Generated from protobuf field <code>.google.rpc.Status error = 2;</code>
     * @param \Google\Rpc\Status $var
     * @return $this
     */
    public function setError($var)
    {
        GPBUtil::checkMessage($var, \Google\Rpc\Status::class);
        $this->error = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.cloud.speech.v2.RecognitionResponseMetadata metadata = 3;</code>
     * @return \Google\Cloud\Speech\V2\RecognitionResponseMetadata|null
     */
    public function getMetadata()
    {
        return $this->metadata;
    }

    public function hasMetadata()
    {
        return isset($this->metadata);
    }

    public function clearMetadata()
    {
        unset($this->metadata);
    }

    /**
     * Generated from protobuf field <code>.google.cloud.speech.v2.RecognitionResponseMetadata metadata = 3;</code>
     * @param \Google\Cloud\Speech\V2\RecognitionResponseMetadata $var
     * @return $this
     */
    public function setMetadata($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Speech\V2\RecognitionResponseMetadata::class);
        $this->metadata = $var;

        return $this;
    }

    /**
     * Recognition results written to Cloud Storage. This is
     * populated only when
     * [GcsOutputConfig][google.cloud.speech.v2.GcsOutputConfig] is set in
     * the
     * [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.CloudStorageResult cloud_storage_result = 5;</code>
     * @return \Google\Cloud\Speech\V2\CloudStorageResult|null
     */
    public function getCloudStorageResult()
    {
        return $this->readOneof(5);
    }

    public function hasCloudStorageResult()
    {
        return $this->hasOneof(5);
    }

    /**
     * Recognition results written to Cloud Storage. This is
     * populated only when
     * [GcsOutputConfig][google.cloud.speech.v2.GcsOutputConfig] is set in
     * the
     * [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.CloudStorageResult cloud_storage_result = 5;</code>
     * @param \Google\Cloud\Speech\V2\CloudStorageResult $var
     * @return $this
     */
    public function setCloudStorageResult($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Speech\V2\CloudStorageResult::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Recognition results. This is populated only when
     * [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in
     * the
     * [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.InlineResult inline_result = 6;</code>
     * @return \Google\Cloud\Speech\V2\InlineResult|null
     */
    public function getInlineResult()
    {
        return $this->readOneof(6);
    }

    public function hasInlineResult()
    {
        return $this->hasOneof(6);
    }

    /**
     * Recognition results. This is populated only when
     * [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in
     * the
     * [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.InlineResult inline_result = 6;</code>
     * @param \Google\Cloud\Speech\V2\InlineResult $var
     * @return $this
     */
    public function setInlineResult($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Speech\V2\InlineResult::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Deprecated. Use `cloud_storage_result.native_format_uri` instead.
     *
     * Generated from protobuf field <code>string uri = 1 [deprecated = true];</code>
     * @return string
     * @deprecated
     */
    public function getUri()
    {
        @trigger_error('uri is deprecated.', E_USER_DEPRECATED);
        return $this->uri;
    }

    /**
     * Deprecated. Use `cloud_storage_result.native_format_uri` instead.
     *
     * Generated from protobuf field <code>string uri = 1 [deprecated = true];</code>
     * @param string $var
     * @return $this
     * @deprecated
     */
    public function setUri($var)
    {
        @trigger_error('uri is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkString($var, True);
        $this->uri = $var;

        return $this;
    }

    /**
     * Deprecated. Use `inline_result.transcript` instead.
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.BatchRecognizeResults transcript = 4 [deprecated = true];</code>
     * @return \Google\Cloud\Speech\V2\BatchRecognizeResults|null
     * @deprecated
     */
    public function getTranscript()
    {
        @trigger_error('transcript is deprecated.', E_USER_DEPRECATED);
        return $this->transcript;
    }

    public function hasTranscript()
    {
        @trigger_error('transcript is deprecated.', E_USER_DEPRECATED);
        return isset($this->transcript);
    }

    public function clearTranscript()
    {
        @trigger_error('transcript is deprecated.', E_USER_DEPRECATED);
        unset($this->transcript);
    }

    /**
     * Deprecated. Use `inline_result.transcript` instead.
     *
     * Generated from protobuf field <code>.google.cloud.speech.v2.BatchRecognizeResults transcript = 4 [deprecated = true];</code>
     * @param \Google\Cloud\Speech\V2\BatchRecognizeResults $var
     * @return $this
     * @deprecated
     */
    public function setTranscript($var)
    {
        @trigger_error('transcript is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkMessage($var, \Google\Cloud\Speech\V2\BatchRecognizeResults::class);
        $this->transcript = $var;

        return $this;
    }

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

}

