<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/firestore/v1/firestore.proto

namespace Google\Cloud\Firestore\V1;

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

/**
 * The response for [Firestore.Listen][google.firestore.v1.Firestore.Listen].
 *
 * Generated from protobuf message <code>google.firestore.v1.ListenResponse</code>
 */
class ListenResponse extends \Google\Protobuf\Internal\Message
{
    protected $response_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Firestore\V1\TargetChange $target_change
     *           Targets have changed.
     *     @type \Google\Cloud\Firestore\V1\DocumentChange $document_change
     *           A [Document][google.firestore.v1.Document] has changed.
     *     @type \Google\Cloud\Firestore\V1\DocumentDelete $document_delete
     *           A [Document][google.firestore.v1.Document] has been deleted.
     *     @type \Google\Cloud\Firestore\V1\DocumentRemove $document_remove
     *           A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer
     *           relevant to that target).
     *     @type \Google\Cloud\Firestore\V1\ExistenceFilter $filter
     *           A filter to apply to the set of documents previously returned for the
     *           given target.
     *           Returned when documents may have been removed from the given target, but
     *           the exact documents are unknown.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Firestore::initOnce();
        parent::__construct($data);
    }

    /**
     * Targets have changed.
     *
     * Generated from protobuf field <code>.google.firestore.v1.TargetChange target_change = 2;</code>
     * @return \Google\Cloud\Firestore\V1\TargetChange
     */
    public function getTargetChange()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Targets have changed.
     *
     * Generated from protobuf field <code>.google.firestore.v1.TargetChange target_change = 2;</code>
     * @param \Google\Cloud\Firestore\V1\TargetChange $var
     * @return $this
     */
    public function setTargetChange($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\TargetChange::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * A [Document][google.firestore.v1.Document] has changed.
     *
     * Generated from protobuf field <code>.google.firestore.v1.DocumentChange document_change = 3;</code>
     * @return \Google\Cloud\Firestore\V1\DocumentChange
     */
    public function getDocumentChange()
    {
        return $this->readOneof(3);
    }

    public function hasDocumentChange()
    {
        return $this->hasOneof(3);
    }

    /**
     * A [Document][google.firestore.v1.Document] has changed.
     *
     * Generated from protobuf field <code>.google.firestore.v1.DocumentChange document_change = 3;</code>
     * @param \Google\Cloud\Firestore\V1\DocumentChange $var
     * @return $this
     */
    public function setDocumentChange($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentChange::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * A [Document][google.firestore.v1.Document] has been deleted.
     *
     * Generated from protobuf field <code>.google.firestore.v1.DocumentDelete document_delete = 4;</code>
     * @return \Google\Cloud\Firestore\V1\DocumentDelete
     */
    public function getDocumentDelete()
    {
        return $this->readOneof(4);
    }

    public function hasDocumentDelete()
    {
        return $this->hasOneof(4);
    }

    /**
     * A [Document][google.firestore.v1.Document] has been deleted.
     *
     * Generated from protobuf field <code>.google.firestore.v1.DocumentDelete document_delete = 4;</code>
     * @param \Google\Cloud\Firestore\V1\DocumentDelete $var
     * @return $this
     */
    public function setDocumentDelete($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentDelete::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer
     * relevant to that target).
     *
     * Generated from protobuf field <code>.google.firestore.v1.DocumentRemove document_remove = 6;</code>
     * @return \Google\Cloud\Firestore\V1\DocumentRemove
     */
    public function getDocumentRemove()
    {
        return $this->readOneof(6);
    }

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

    /**
     * A [Document][google.firestore.v1.Document] has been removed from a target (because it is no longer
     * relevant to that target).
     *
     * Generated from protobuf field <code>.google.firestore.v1.DocumentRemove document_remove = 6;</code>
     * @param \Google\Cloud\Firestore\V1\DocumentRemove $var
     * @return $this
     */
    public function setDocumentRemove($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\DocumentRemove::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * A filter to apply to the set of documents previously returned for the
     * given target.
     * Returned when documents may have been removed from the given target, but
     * the exact documents are unknown.
     *
     * Generated from protobuf field <code>.google.firestore.v1.ExistenceFilter filter = 5;</code>
     * @return \Google\Cloud\Firestore\V1\ExistenceFilter
     */
    public function getFilter()
    {
        return $this->readOneof(5);
    }

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

    /**
     * A filter to apply to the set of documents previously returned for the
     * given target.
     * Returned when documents may have been removed from the given target, but
     * the exact documents are unknown.
     *
     * Generated from protobuf field <code>.google.firestore.v1.ExistenceFilter filter = 5;</code>
     * @param \Google\Cloud\Firestore\V1\ExistenceFilter $var
     * @return $this
     */
    public function setFilter($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\ExistenceFilter::class);
        $this->writeOneof(5, $var);

        return $this;
    }

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

}

