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

namespace Google\Cloud\Firestore\V1\StructuredQuery;

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

/**
 * A filter.
 *
 * Generated from protobuf message <code>google.firestore.v1.StructuredQuery.Filter</code>
 */
class Filter extends \Google\Protobuf\Internal\Message
{
    protected $filter_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter $composite_filter
     *           A composite filter.
     *     @type \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter $field_filter
     *           A filter on a document field.
     *     @type \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter $unary_filter
     *           A filter that takes exactly one argument.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1\Query::initOnce();
        parent::__construct($data);
    }

    /**
     * A composite filter.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     * @return \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter|null
     */
    public function getCompositeFilter()
    {
        return $this->readOneof(1);
    }

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

    /**
     * A composite filter.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     * @param \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter $var
     * @return $this
     */
    public function setCompositeFilter($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery\CompositeFilter::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * A filter on a document field.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     * @return \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter|null
     */
    public function getFieldFilter()
    {
        return $this->readOneof(2);
    }

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

    /**
     * A filter on a document field.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     * @param \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter $var
     * @return $this
     */
    public function setFieldFilter($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery\FieldFilter::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * A filter that takes exactly one argument.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     * @return \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter|null
     */
    public function getUnaryFilter()
    {
        return $this->readOneof(3);
    }

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

    /**
     * A filter that takes exactly one argument.
     *
     * Generated from protobuf field <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     * @param \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter $var
     * @return $this
     */
    public function setUnaryFilter($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1\StructuredQuery\UnaryFilter::class);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Filter::class, \Google\Cloud\Firestore\V1\StructuredQuery_Filter::class);

