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

namespace Google\Cloud\Firestore\V1;

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

/**
 * A digest of all the documents that match a given target.
 *
 * Generated from protobuf message <code>google.firestore.v1.ExistenceFilter</code>
 */
class ExistenceFilter extends \Google\Protobuf\Internal\Message
{
    /**
     * The target ID to which this filter applies.
     *
     * Generated from protobuf field <code>int32 target_id = 1;</code>
     */
    private $target_id = 0;
    /**
     * The total count of documents that match
     * [target_id][google.firestore.v1.ExistenceFilter.target_id].
     * If different from the count of documents in the client that match, the
     * client must manually determine which documents no longer match the target.
     * The client can use the `unchanged_names` bloom filter to assist with
     * this determination.
     *
     * Generated from protobuf field <code>int32 count = 2;</code>
     */
    private $count = 0;
    /**
     * A bloom filter that contains the UTF-8 byte encodings of the resource names
     * of the documents that match
     * [target_id][google.firestore.v1.ExistenceFilter.target_id], in the form
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`
     * that have NOT changed since the query results indicated by the resume token
     * or timestamp given in `Target.resume_type`.
     * This bloom filter may be omitted at the server's discretion, such as if it
     * is deemed that the client will not make use of it or if it is too
     * computationally expensive to calculate or transmit. Clients must gracefully
     * handle this field being absent by falling back to the logic used before
     * this field existed; that is, re-add the target without a resume token to
     * figure out which documents in the client's cache are out of sync.
     *
     * Generated from protobuf field <code>.google.firestore.v1.BloomFilter unchanged_names = 3;</code>
     */
    private $unchanged_names = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $target_id
     *           The target ID to which this filter applies.
     *     @type int $count
     *           The total count of documents that match
     *           [target_id][google.firestore.v1.ExistenceFilter.target_id].
     *           If different from the count of documents in the client that match, the
     *           client must manually determine which documents no longer match the target.
     *           The client can use the `unchanged_names` bloom filter to assist with
     *           this determination.
     *     @type \Google\Cloud\Firestore\V1\BloomFilter $unchanged_names
     *           A bloom filter that contains the UTF-8 byte encodings of the resource names
     *           of the documents that match
     *           [target_id][google.firestore.v1.ExistenceFilter.target_id], in the form
     *           `projects/{project_id}/databases/{database_id}/documents/{document_path}`
     *           that have NOT changed since the query results indicated by the resume token
     *           or timestamp given in `Target.resume_type`.
     *           This bloom filter may be omitted at the server's discretion, such as if it
     *           is deemed that the client will not make use of it or if it is too
     *           computationally expensive to calculate or transmit. Clients must gracefully
     *           handle this field being absent by falling back to the logic used before
     *           this field existed; that is, re-add the target without a resume token to
     *           figure out which documents in the client's cache are out of sync.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Write::initOnce();
        parent::__construct($data);
    }

    /**
     * The target ID to which this filter applies.
     *
     * Generated from protobuf field <code>int32 target_id = 1;</code>
     * @return int
     */
    public function getTargetId()
    {
        return $this->target_id;
    }

    /**
     * The target ID to which this filter applies.
     *
     * Generated from protobuf field <code>int32 target_id = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setTargetId($var)
    {
        GPBUtil::checkInt32($var);
        $this->target_id = $var;

        return $this;
    }

    /**
     * The total count of documents that match
     * [target_id][google.firestore.v1.ExistenceFilter.target_id].
     * If different from the count of documents in the client that match, the
     * client must manually determine which documents no longer match the target.
     * The client can use the `unchanged_names` bloom filter to assist with
     * this determination.
     *
     * Generated from protobuf field <code>int32 count = 2;</code>
     * @return int
     */
    public function getCount()
    {
        return $this->count;
    }

    /**
     * The total count of documents that match
     * [target_id][google.firestore.v1.ExistenceFilter.target_id].
     * If different from the count of documents in the client that match, the
     * client must manually determine which documents no longer match the target.
     * The client can use the `unchanged_names` bloom filter to assist with
     * this determination.
     *
     * Generated from protobuf field <code>int32 count = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->count = $var;

        return $this;
    }

    /**
     * A bloom filter that contains the UTF-8 byte encodings of the resource names
     * of the documents that match
     * [target_id][google.firestore.v1.ExistenceFilter.target_id], in the form
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`
     * that have NOT changed since the query results indicated by the resume token
     * or timestamp given in `Target.resume_type`.
     * This bloom filter may be omitted at the server's discretion, such as if it
     * is deemed that the client will not make use of it or if it is too
     * computationally expensive to calculate or transmit. Clients must gracefully
     * handle this field being absent by falling back to the logic used before
     * this field existed; that is, re-add the target without a resume token to
     * figure out which documents in the client's cache are out of sync.
     *
     * Generated from protobuf field <code>.google.firestore.v1.BloomFilter unchanged_names = 3;</code>
     * @return \Google\Cloud\Firestore\V1\BloomFilter|null
     */
    public function getUnchangedNames()
    {
        return $this->unchanged_names;
    }

    public function hasUnchangedNames()
    {
        return isset($this->unchanged_names);
    }

    public function clearUnchangedNames()
    {
        unset($this->unchanged_names);
    }

    /**
     * A bloom filter that contains the UTF-8 byte encodings of the resource names
     * of the documents that match
     * [target_id][google.firestore.v1.ExistenceFilter.target_id], in the form
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`
     * that have NOT changed since the query results indicated by the resume token
     * or timestamp given in `Target.resume_type`.
     * This bloom filter may be omitted at the server's discretion, such as if it
     * is deemed that the client will not make use of it or if it is too
     * computationally expensive to calculate or transmit. Clients must gracefully
     * handle this field being absent by falling back to the logic used before
     * this field existed; that is, re-add the target without a resume token to
     * figure out which documents in the client's cache are out of sync.
     *
     * Generated from protobuf field <code>.google.firestore.v1.BloomFilter unchanged_names = 3;</code>
     * @param \Google\Cloud\Firestore\V1\BloomFilter $var
     * @return $this
     */
    public function setUnchangedNames($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\BloomFilter::class);
        $this->unchanged_names = $var;

        return $this;
    }

}

