/*
 * Copyright 2026 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: google/firestore/v1/query.proto
// Protobuf Java Version: 4.33.2

package com.google.firestore.v1;

/**
 *
 *
 * <pre>
 * A Firestore query.
 *
 * The query stages are executed in the following order:
 * 1. from
 * 2. where
 * 3. select
 * 4. order_by + start_at + end_at
 * 5. offset
 * 6. limit
 * 7. find_nearest
 * </pre>
 *
 * Protobuf type {@code google.firestore.v1.StructuredQuery}
 */
@com.google.protobuf.Generated
public final class StructuredQuery extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery)
    StructuredQueryOrBuilder {
  private static final long serialVersionUID = 0L;

  static {
    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
        com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
        /* major= */ 4,
        /* minor= */ 33,
        /* patch= */ 2,
        /* suffix= */ "",
        "StructuredQuery");
  }

  // Use StructuredQuery.newBuilder() to construct.
  private StructuredQuery(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }

  private StructuredQuery() {
    from_ = java.util.Collections.emptyList();
    orderBy_ = java.util.Collections.emptyList();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.firestore.v1.QueryProto
        .internal_static_google_firestore_v1_StructuredQuery_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.firestore.v1.QueryProto
        .internal_static_google_firestore_v1_StructuredQuery_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.firestore.v1.StructuredQuery.class,
            com.google.firestore.v1.StructuredQuery.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * A sort direction.
   * </pre>
   *
   * Protobuf enum {@code google.firestore.v1.StructuredQuery.Direction}
   */
  public enum Direction implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * Unspecified.
     * </pre>
     *
     * <code>DIRECTION_UNSPECIFIED = 0;</code>
     */
    DIRECTION_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * Ascending.
     * </pre>
     *
     * <code>ASCENDING = 1;</code>
     */
    ASCENDING(1),
    /**
     *
     *
     * <pre>
     * Descending.
     * </pre>
     *
     * <code>DESCENDING = 2;</code>
     */
    DESCENDING(2),
    UNRECOGNIZED(-1),
    ;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "Direction");
    }

    /**
     *
     *
     * <pre>
     * Unspecified.
     * </pre>
     *
     * <code>DIRECTION_UNSPECIFIED = 0;</code>
     */
    public static final int DIRECTION_UNSPECIFIED_VALUE = 0;

    /**
     *
     *
     * <pre>
     * Ascending.
     * </pre>
     *
     * <code>ASCENDING = 1;</code>
     */
    public static final int ASCENDING_VALUE = 1;

    /**
     *
     *
     * <pre>
     * Descending.
     * </pre>
     *
     * <code>DESCENDING = 2;</code>
     */
    public static final int DESCENDING_VALUE = 2;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static Direction valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static Direction forNumber(int value) {
      switch (value) {
        case 0:
          return DIRECTION_UNSPECIFIED;
        case 1:
          return ASCENDING;
        case 2:
          return DESCENDING;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<Direction> internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<Direction> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<Direction>() {
          public Direction findValueByNumber(int number) {
            return Direction.forNumber(number);
          }
        };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return com.google.firestore.v1.StructuredQuery.getDescriptor().getEnumTypes().get(0);
    }

    private static final Direction[] VALUES = values();

    public static Direction valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private Direction(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.firestore.v1.StructuredQuery.Direction)
  }

  public interface CollectionSelectorOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.CollectionSelector)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The collection ID.
     * When set, selects only collections with this ID.
     * </pre>
     *
     * <code>string collection_id = 2;</code>
     *
     * @return The collectionId.
     */
    java.lang.String getCollectionId();

    /**
     *
     *
     * <pre>
     * The collection ID.
     * When set, selects only collections with this ID.
     * </pre>
     *
     * <code>string collection_id = 2;</code>
     *
     * @return The bytes for collectionId.
     */
    com.google.protobuf.ByteString getCollectionIdBytes();

    /**
     *
     *
     * <pre>
     * When false, selects only collections that are immediate children of
     * the `parent` specified in the containing `RunQueryRequest`.
     * When true, selects all descendant collections.
     * </pre>
     *
     * <code>bool all_descendants = 3;</code>
     *
     * @return The allDescendants.
     */
    boolean getAllDescendants();
  }

  /**
   *
   *
   * <pre>
   * A selection of a collection, such as `messages as m1`.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.CollectionSelector}
   */
  public static final class CollectionSelector extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.CollectionSelector)
      CollectionSelectorOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "CollectionSelector");
    }

    // Use CollectionSelector.newBuilder() to construct.
    private CollectionSelector(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private CollectionSelector() {
      collectionId_ = "";
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_CollectionSelector_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_CollectionSelector_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.CollectionSelector.class,
              com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder.class);
    }

    public static final int COLLECTION_ID_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private volatile java.lang.Object collectionId_ = "";

    /**
     *
     *
     * <pre>
     * The collection ID.
     * When set, selects only collections with this ID.
     * </pre>
     *
     * <code>string collection_id = 2;</code>
     *
     * @return The collectionId.
     */
    @java.lang.Override
    public java.lang.String getCollectionId() {
      java.lang.Object ref = collectionId_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        collectionId_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * The collection ID.
     * When set, selects only collections with this ID.
     * </pre>
     *
     * <code>string collection_id = 2;</code>
     *
     * @return The bytes for collectionId.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getCollectionIdBytes() {
      java.lang.Object ref = collectionId_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        collectionId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int ALL_DESCENDANTS_FIELD_NUMBER = 3;
    private boolean allDescendants_ = false;

    /**
     *
     *
     * <pre>
     * When false, selects only collections that are immediate children of
     * the `parent` specified in the containing `RunQueryRequest`.
     * When true, selects all descendant collections.
     * </pre>
     *
     * <code>bool all_descendants = 3;</code>
     *
     * @return The allDescendants.
     */
    @java.lang.Override
    public boolean getAllDescendants() {
      return allDescendants_;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(collectionId_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 2, collectionId_);
      }
      if (allDescendants_ != false) {
        output.writeBool(3, allDescendants_);
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(collectionId_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(2, collectionId_);
      }
      if (allDescendants_ != false) {
        size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, allDescendants_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.CollectionSelector)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.CollectionSelector other =
          (com.google.firestore.v1.StructuredQuery.CollectionSelector) obj;

      if (!getCollectionId().equals(other.getCollectionId())) return false;
      if (getAllDescendants() != other.getAllDescendants()) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + COLLECTION_ID_FIELD_NUMBER;
      hash = (53 * hash) + getCollectionId().hashCode();
      hash = (37 * hash) + ALL_DESCENDANTS_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllDescendants());
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.firestore.v1.StructuredQuery.CollectionSelector prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A selection of a collection, such as `messages as m1`.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.CollectionSelector}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.CollectionSelector)
        com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_CollectionSelector_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_CollectionSelector_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.CollectionSelector.class,
                com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.CollectionSelector.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        collectionId_ = "";
        allDescendants_ = false;
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_CollectionSelector_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CollectionSelector
          getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.CollectionSelector.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CollectionSelector build() {
        com.google.firestore.v1.StructuredQuery.CollectionSelector result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CollectionSelector buildPartial() {
        com.google.firestore.v1.StructuredQuery.CollectionSelector result =
            new com.google.firestore.v1.StructuredQuery.CollectionSelector(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(
          com.google.firestore.v1.StructuredQuery.CollectionSelector result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.collectionId_ = collectionId_;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.allDescendants_ = allDescendants_;
        }
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.CollectionSelector) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.CollectionSelector) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.CollectionSelector other) {
        if (other
            == com.google.firestore.v1.StructuredQuery.CollectionSelector.getDefaultInstance())
          return this;
        if (!other.getCollectionId().isEmpty()) {
          collectionId_ = other.collectionId_;
          bitField0_ |= 0x00000001;
          onChanged();
        }
        if (other.getAllDescendants() != false) {
          setAllDescendants(other.getAllDescendants());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 18:
                {
                  collectionId_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 18
              case 24:
                {
                  allDescendants_ = input.readBool();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 24
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private java.lang.Object collectionId_ = "";

      /**
       *
       *
       * <pre>
       * The collection ID.
       * When set, selects only collections with this ID.
       * </pre>
       *
       * <code>string collection_id = 2;</code>
       *
       * @return The collectionId.
       */
      public java.lang.String getCollectionId() {
        java.lang.Object ref = collectionId_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          collectionId_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * The collection ID.
       * When set, selects only collections with this ID.
       * </pre>
       *
       * <code>string collection_id = 2;</code>
       *
       * @return The bytes for collectionId.
       */
      public com.google.protobuf.ByteString getCollectionIdBytes() {
        java.lang.Object ref = collectionId_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          collectionId_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * The collection ID.
       * When set, selects only collections with this ID.
       * </pre>
       *
       * <code>string collection_id = 2;</code>
       *
       * @param value The collectionId to set.
       * @return This builder for chaining.
       */
      public Builder setCollectionId(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        collectionId_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The collection ID.
       * When set, selects only collections with this ID.
       * </pre>
       *
       * <code>string collection_id = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearCollectionId() {
        collectionId_ = getDefaultInstance().getCollectionId();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The collection ID.
       * When set, selects only collections with this ID.
       * </pre>
       *
       * <code>string collection_id = 2;</code>
       *
       * @param value The bytes for collectionId to set.
       * @return This builder for chaining.
       */
      public Builder setCollectionIdBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        collectionId_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      private boolean allDescendants_;

      /**
       *
       *
       * <pre>
       * When false, selects only collections that are immediate children of
       * the `parent` specified in the containing `RunQueryRequest`.
       * When true, selects all descendant collections.
       * </pre>
       *
       * <code>bool all_descendants = 3;</code>
       *
       * @return The allDescendants.
       */
      @java.lang.Override
      public boolean getAllDescendants() {
        return allDescendants_;
      }

      /**
       *
       *
       * <pre>
       * When false, selects only collections that are immediate children of
       * the `parent` specified in the containing `RunQueryRequest`.
       * When true, selects all descendant collections.
       * </pre>
       *
       * <code>bool all_descendants = 3;</code>
       *
       * @param value The allDescendants to set.
       * @return This builder for chaining.
       */
      public Builder setAllDescendants(boolean value) {

        allDescendants_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * When false, selects only collections that are immediate children of
       * the `parent` specified in the containing `RunQueryRequest`.
       * When true, selects all descendant collections.
       * </pre>
       *
       * <code>bool all_descendants = 3;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearAllDescendants() {
        bitField0_ = (bitField0_ & ~0x00000002);
        allDescendants_ = false;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.CollectionSelector)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.CollectionSelector)
    private static final com.google.firestore.v1.StructuredQuery.CollectionSelector
        DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.CollectionSelector();
    }

    public static com.google.firestore.v1.StructuredQuery.CollectionSelector getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<CollectionSelector> PARSER =
        new com.google.protobuf.AbstractParser<CollectionSelector>() {
          @java.lang.Override
          public CollectionSelector parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<CollectionSelector> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<CollectionSelector> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.CollectionSelector getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface FilterOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.Filter)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * A composite filter.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     *
     * @return Whether the compositeFilter field is set.
     */
    boolean hasCompositeFilter();

    /**
     *
     *
     * <pre>
     * A composite filter.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     *
     * @return The compositeFilter.
     */
    com.google.firestore.v1.StructuredQuery.CompositeFilter getCompositeFilter();

    /**
     *
     *
     * <pre>
     * A composite filter.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     */
    com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder getCompositeFilterOrBuilder();

    /**
     *
     *
     * <pre>
     * A filter on a document field.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     *
     * @return Whether the fieldFilter field is set.
     */
    boolean hasFieldFilter();

    /**
     *
     *
     * <pre>
     * A filter on a document field.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     *
     * @return The fieldFilter.
     */
    com.google.firestore.v1.StructuredQuery.FieldFilter getFieldFilter();

    /**
     *
     *
     * <pre>
     * A filter on a document field.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     */
    com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder getFieldFilterOrBuilder();

    /**
     *
     *
     * <pre>
     * A filter that takes exactly one argument.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     *
     * @return Whether the unaryFilter field is set.
     */
    boolean hasUnaryFilter();

    /**
     *
     *
     * <pre>
     * A filter that takes exactly one argument.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     *
     * @return The unaryFilter.
     */
    com.google.firestore.v1.StructuredQuery.UnaryFilter getUnaryFilter();

    /**
     *
     *
     * <pre>
     * A filter that takes exactly one argument.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     */
    com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder getUnaryFilterOrBuilder();

    com.google.firestore.v1.StructuredQuery.Filter.FilterTypeCase getFilterTypeCase();
  }

  /**
   *
   *
   * <pre>
   * A filter.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.Filter}
   */
  public static final class Filter extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.Filter)
      FilterOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "Filter");
    }

    // Use Filter.newBuilder() to construct.
    private Filter(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private Filter() {}

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_Filter_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_Filter_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.Filter.class,
              com.google.firestore.v1.StructuredQuery.Filter.Builder.class);
    }

    private int filterTypeCase_ = 0;

    @SuppressWarnings("serial")
    private java.lang.Object filterType_;

    public enum FilterTypeCase
        implements
            com.google.protobuf.Internal.EnumLite,
            com.google.protobuf.AbstractMessage.InternalOneOfEnum {
      COMPOSITE_FILTER(1),
      FIELD_FILTER(2),
      UNARY_FILTER(3),
      FILTERTYPE_NOT_SET(0);
      private final int value;

      private FilterTypeCase(int value) {
        this.value = value;
      }

      /**
       * @param value The number of the enum to look for.
       * @return The enum associated with the given number.
       * @deprecated Use {@link #forNumber(int)} instead.
       */
      @java.lang.Deprecated
      public static FilterTypeCase valueOf(int value) {
        return forNumber(value);
      }

      public static FilterTypeCase forNumber(int value) {
        switch (value) {
          case 1:
            return COMPOSITE_FILTER;
          case 2:
            return FIELD_FILTER;
          case 3:
            return UNARY_FILTER;
          case 0:
            return FILTERTYPE_NOT_SET;
          default:
            return null;
        }
      }

      public int getNumber() {
        return this.value;
      }
    };

    public FilterTypeCase getFilterTypeCase() {
      return FilterTypeCase.forNumber(filterTypeCase_);
    }

    public static final int COMPOSITE_FILTER_FIELD_NUMBER = 1;

    /**
     *
     *
     * <pre>
     * A composite filter.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     *
     * @return Whether the compositeFilter field is set.
     */
    @java.lang.Override
    public boolean hasCompositeFilter() {
      return filterTypeCase_ == 1;
    }

    /**
     *
     *
     * <pre>
     * A composite filter.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     *
     * @return The compositeFilter.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.CompositeFilter getCompositeFilter() {
      if (filterTypeCase_ == 1) {
        return (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_;
      }
      return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
    }

    /**
     *
     *
     * <pre>
     * A composite filter.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder
        getCompositeFilterOrBuilder() {
      if (filterTypeCase_ == 1) {
        return (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_;
      }
      return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
    }

    public static final int FIELD_FILTER_FIELD_NUMBER = 2;

    /**
     *
     *
     * <pre>
     * A filter on a document field.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     *
     * @return Whether the fieldFilter field is set.
     */
    @java.lang.Override
    public boolean hasFieldFilter() {
      return filterTypeCase_ == 2;
    }

    /**
     *
     *
     * <pre>
     * A filter on a document field.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     *
     * @return The fieldFilter.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldFilter getFieldFilter() {
      if (filterTypeCase_ == 2) {
        return (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_;
      }
      return com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
    }

    /**
     *
     *
     * <pre>
     * A filter on a document field.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder getFieldFilterOrBuilder() {
      if (filterTypeCase_ == 2) {
        return (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_;
      }
      return com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
    }

    public static final int UNARY_FILTER_FIELD_NUMBER = 3;

    /**
     *
     *
     * <pre>
     * A filter that takes exactly one argument.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     *
     * @return Whether the unaryFilter field is set.
     */
    @java.lang.Override
    public boolean hasUnaryFilter() {
      return filterTypeCase_ == 3;
    }

    /**
     *
     *
     * <pre>
     * A filter that takes exactly one argument.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     *
     * @return The unaryFilter.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.UnaryFilter getUnaryFilter() {
      if (filterTypeCase_ == 3) {
        return (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_;
      }
      return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
    }

    /**
     *
     *
     * <pre>
     * A filter that takes exactly one argument.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder getUnaryFilterOrBuilder() {
      if (filterTypeCase_ == 3) {
        return (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_;
      }
      return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (filterTypeCase_ == 1) {
        output.writeMessage(
            1, (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_);
      }
      if (filterTypeCase_ == 2) {
        output.writeMessage(2, (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_);
      }
      if (filterTypeCase_ == 3) {
        output.writeMessage(3, (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_);
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (filterTypeCase_ == 1) {
        size +=
            com.google.protobuf.CodedOutputStream.computeMessageSize(
                1, (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_);
      }
      if (filterTypeCase_ == 2) {
        size +=
            com.google.protobuf.CodedOutputStream.computeMessageSize(
                2, (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_);
      }
      if (filterTypeCase_ == 3) {
        size +=
            com.google.protobuf.CodedOutputStream.computeMessageSize(
                3, (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.Filter)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.Filter other =
          (com.google.firestore.v1.StructuredQuery.Filter) obj;

      if (!getFilterTypeCase().equals(other.getFilterTypeCase())) return false;
      switch (filterTypeCase_) {
        case 1:
          if (!getCompositeFilter().equals(other.getCompositeFilter())) return false;
          break;
        case 2:
          if (!getFieldFilter().equals(other.getFieldFilter())) return false;
          break;
        case 3:
          if (!getUnaryFilter().equals(other.getUnaryFilter())) return false;
          break;
        case 0:
        default:
      }
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      switch (filterTypeCase_) {
        case 1:
          hash = (37 * hash) + COMPOSITE_FILTER_FIELD_NUMBER;
          hash = (53 * hash) + getCompositeFilter().hashCode();
          break;
        case 2:
          hash = (37 * hash) + FIELD_FILTER_FIELD_NUMBER;
          hash = (53 * hash) + getFieldFilter().hashCode();
          break;
        case 3:
          hash = (37 * hash) + UNARY_FILTER_FIELD_NUMBER;
          hash = (53 * hash) + getUnaryFilter().hashCode();
          break;
        case 0:
        default:
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Filter parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(com.google.firestore.v1.StructuredQuery.Filter prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A filter.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.Filter}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.Filter)
        com.google.firestore.v1.StructuredQuery.FilterOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Filter_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Filter_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.Filter.class,
                com.google.firestore.v1.StructuredQuery.Filter.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.Filter.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        if (compositeFilterBuilder_ != null) {
          compositeFilterBuilder_.clear();
        }
        if (fieldFilterBuilder_ != null) {
          fieldFilterBuilder_.clear();
        }
        if (unaryFilterBuilder_ != null) {
          unaryFilterBuilder_.clear();
        }
        filterTypeCase_ = 0;
        filterType_ = null;
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Filter_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Filter getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Filter build() {
        com.google.firestore.v1.StructuredQuery.Filter result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Filter buildPartial() {
        com.google.firestore.v1.StructuredQuery.Filter result =
            new com.google.firestore.v1.StructuredQuery.Filter(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        buildPartialOneofs(result);
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.Filter result) {
        int from_bitField0_ = bitField0_;
      }

      private void buildPartialOneofs(com.google.firestore.v1.StructuredQuery.Filter result) {
        result.filterTypeCase_ = filterTypeCase_;
        result.filterType_ = this.filterType_;
        if (filterTypeCase_ == 1 && compositeFilterBuilder_ != null) {
          result.filterType_ = compositeFilterBuilder_.build();
        }
        if (filterTypeCase_ == 2 && fieldFilterBuilder_ != null) {
          result.filterType_ = fieldFilterBuilder_.build();
        }
        if (filterTypeCase_ == 3 && unaryFilterBuilder_ != null) {
          result.filterType_ = unaryFilterBuilder_.build();
        }
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.Filter) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.Filter) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.Filter other) {
        if (other == com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance())
          return this;
        switch (other.getFilterTypeCase()) {
          case COMPOSITE_FILTER:
            {
              mergeCompositeFilter(other.getCompositeFilter());
              break;
            }
          case FIELD_FILTER:
            {
              mergeFieldFilter(other.getFieldFilter());
              break;
            }
          case UNARY_FILTER:
            {
              mergeUnaryFilter(other.getUnaryFilter());
              break;
            }
          case FILTERTYPE_NOT_SET:
            {
              break;
            }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  input.readMessage(
                      internalGetCompositeFilterFieldBuilder().getBuilder(), extensionRegistry);
                  filterTypeCase_ = 1;
                  break;
                } // case 10
              case 18:
                {
                  input.readMessage(
                      internalGetFieldFilterFieldBuilder().getBuilder(), extensionRegistry);
                  filterTypeCase_ = 2;
                  break;
                } // case 18
              case 26:
                {
                  input.readMessage(
                      internalGetUnaryFilterFieldBuilder().getBuilder(), extensionRegistry);
                  filterTypeCase_ = 3;
                  break;
                } // case 26
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int filterTypeCase_ = 0;
      private java.lang.Object filterType_;

      public FilterTypeCase getFilterTypeCase() {
        return FilterTypeCase.forNumber(filterTypeCase_);
      }

      public Builder clearFilterType() {
        filterTypeCase_ = 0;
        filterType_ = null;
        onChanged();
        return this;
      }

      private int bitField0_;

      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.CompositeFilter,
              com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder,
              com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder>
          compositeFilterBuilder_;

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       *
       * @return Whether the compositeFilter field is set.
       */
      @java.lang.Override
      public boolean hasCompositeFilter() {
        return filterTypeCase_ == 1;
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       *
       * @return The compositeFilter.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CompositeFilter getCompositeFilter() {
        if (compositeFilterBuilder_ == null) {
          if (filterTypeCase_ == 1) {
            return (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_;
          }
          return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
        } else {
          if (filterTypeCase_ == 1) {
            return compositeFilterBuilder_.getMessage();
          }
          return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      public Builder setCompositeFilter(
          com.google.firestore.v1.StructuredQuery.CompositeFilter value) {
        if (compositeFilterBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          filterType_ = value;
          onChanged();
        } else {
          compositeFilterBuilder_.setMessage(value);
        }
        filterTypeCase_ = 1;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      public Builder setCompositeFilter(
          com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder builderForValue) {
        if (compositeFilterBuilder_ == null) {
          filterType_ = builderForValue.build();
          onChanged();
        } else {
          compositeFilterBuilder_.setMessage(builderForValue.build());
        }
        filterTypeCase_ = 1;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      public Builder mergeCompositeFilter(
          com.google.firestore.v1.StructuredQuery.CompositeFilter value) {
        if (compositeFilterBuilder_ == null) {
          if (filterTypeCase_ == 1
              && filterType_
                  != com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance()) {
            filterType_ =
                com.google.firestore.v1.StructuredQuery.CompositeFilter.newBuilder(
                        (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_)
                    .mergeFrom(value)
                    .buildPartial();
          } else {
            filterType_ = value;
          }
          onChanged();
        } else {
          if (filterTypeCase_ == 1) {
            compositeFilterBuilder_.mergeFrom(value);
          } else {
            compositeFilterBuilder_.setMessage(value);
          }
        }
        filterTypeCase_ = 1;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      public Builder clearCompositeFilter() {
        if (compositeFilterBuilder_ == null) {
          if (filterTypeCase_ == 1) {
            filterTypeCase_ = 0;
            filterType_ = null;
            onChanged();
          }
        } else {
          if (filterTypeCase_ == 1) {
            filterTypeCase_ = 0;
            filterType_ = null;
          }
          compositeFilterBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      public com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder
          getCompositeFilterBuilder() {
        return internalGetCompositeFilterFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder
          getCompositeFilterOrBuilder() {
        if ((filterTypeCase_ == 1) && (compositeFilterBuilder_ != null)) {
          return compositeFilterBuilder_.getMessageOrBuilder();
        } else {
          if (filterTypeCase_ == 1) {
            return (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_;
          }
          return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * A composite filter.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter composite_filter = 1;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.CompositeFilter,
              com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder,
              com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder>
          internalGetCompositeFilterFieldBuilder() {
        if (compositeFilterBuilder_ == null) {
          if (!(filterTypeCase_ == 1)) {
            filterType_ =
                com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
          }
          compositeFilterBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.CompositeFilter,
                  com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder,
                  com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder>(
                  (com.google.firestore.v1.StructuredQuery.CompositeFilter) filterType_,
                  getParentForChildren(),
                  isClean());
          filterType_ = null;
        }
        filterTypeCase_ = 1;
        onChanged();
        return compositeFilterBuilder_;
      }

      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldFilter,
              com.google.firestore.v1.StructuredQuery.FieldFilter.Builder,
              com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder>
          fieldFilterBuilder_;

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       *
       * @return Whether the fieldFilter field is set.
       */
      @java.lang.Override
      public boolean hasFieldFilter() {
        return filterTypeCase_ == 2;
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       *
       * @return The fieldFilter.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldFilter getFieldFilter() {
        if (fieldFilterBuilder_ == null) {
          if (filterTypeCase_ == 2) {
            return (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_;
          }
          return com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
        } else {
          if (filterTypeCase_ == 2) {
            return fieldFilterBuilder_.getMessage();
          }
          return com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      public Builder setFieldFilter(com.google.firestore.v1.StructuredQuery.FieldFilter value) {
        if (fieldFilterBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          filterType_ = value;
          onChanged();
        } else {
          fieldFilterBuilder_.setMessage(value);
        }
        filterTypeCase_ = 2;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      public Builder setFieldFilter(
          com.google.firestore.v1.StructuredQuery.FieldFilter.Builder builderForValue) {
        if (fieldFilterBuilder_ == null) {
          filterType_ = builderForValue.build();
          onChanged();
        } else {
          fieldFilterBuilder_.setMessage(builderForValue.build());
        }
        filterTypeCase_ = 2;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      public Builder mergeFieldFilter(com.google.firestore.v1.StructuredQuery.FieldFilter value) {
        if (fieldFilterBuilder_ == null) {
          if (filterTypeCase_ == 2
              && filterType_
                  != com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance()) {
            filterType_ =
                com.google.firestore.v1.StructuredQuery.FieldFilter.newBuilder(
                        (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_)
                    .mergeFrom(value)
                    .buildPartial();
          } else {
            filterType_ = value;
          }
          onChanged();
        } else {
          if (filterTypeCase_ == 2) {
            fieldFilterBuilder_.mergeFrom(value);
          } else {
            fieldFilterBuilder_.setMessage(value);
          }
        }
        filterTypeCase_ = 2;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      public Builder clearFieldFilter() {
        if (fieldFilterBuilder_ == null) {
          if (filterTypeCase_ == 2) {
            filterTypeCase_ = 0;
            filterType_ = null;
            onChanged();
          }
        } else {
          if (filterTypeCase_ == 2) {
            filterTypeCase_ = 0;
            filterType_ = null;
          }
          fieldFilterBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldFilter.Builder getFieldFilterBuilder() {
        return internalGetFieldFilterFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder
          getFieldFilterOrBuilder() {
        if ((filterTypeCase_ == 2) && (fieldFilterBuilder_ != null)) {
          return fieldFilterBuilder_.getMessageOrBuilder();
        } else {
          if (filterTypeCase_ == 2) {
            return (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_;
          }
          return com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * A filter on a document field.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter field_filter = 2;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldFilter,
              com.google.firestore.v1.StructuredQuery.FieldFilter.Builder,
              com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder>
          internalGetFieldFilterFieldBuilder() {
        if (fieldFilterBuilder_ == null) {
          if (!(filterTypeCase_ == 2)) {
            filterType_ = com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
          }
          fieldFilterBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.FieldFilter,
                  com.google.firestore.v1.StructuredQuery.FieldFilter.Builder,
                  com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder>(
                  (com.google.firestore.v1.StructuredQuery.FieldFilter) filterType_,
                  getParentForChildren(),
                  isClean());
          filterType_ = null;
        }
        filterTypeCase_ = 2;
        onChanged();
        return fieldFilterBuilder_;
      }

      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.UnaryFilter,
              com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder,
              com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder>
          unaryFilterBuilder_;

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       *
       * @return Whether the unaryFilter field is set.
       */
      @java.lang.Override
      public boolean hasUnaryFilter() {
        return filterTypeCase_ == 3;
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       *
       * @return The unaryFilter.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.UnaryFilter getUnaryFilter() {
        if (unaryFilterBuilder_ == null) {
          if (filterTypeCase_ == 3) {
            return (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_;
          }
          return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
        } else {
          if (filterTypeCase_ == 3) {
            return unaryFilterBuilder_.getMessage();
          }
          return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      public Builder setUnaryFilter(com.google.firestore.v1.StructuredQuery.UnaryFilter value) {
        if (unaryFilterBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          filterType_ = value;
          onChanged();
        } else {
          unaryFilterBuilder_.setMessage(value);
        }
        filterTypeCase_ = 3;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      public Builder setUnaryFilter(
          com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder builderForValue) {
        if (unaryFilterBuilder_ == null) {
          filterType_ = builderForValue.build();
          onChanged();
        } else {
          unaryFilterBuilder_.setMessage(builderForValue.build());
        }
        filterTypeCase_ = 3;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      public Builder mergeUnaryFilter(com.google.firestore.v1.StructuredQuery.UnaryFilter value) {
        if (unaryFilterBuilder_ == null) {
          if (filterTypeCase_ == 3
              && filterType_
                  != com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance()) {
            filterType_ =
                com.google.firestore.v1.StructuredQuery.UnaryFilter.newBuilder(
                        (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_)
                    .mergeFrom(value)
                    .buildPartial();
          } else {
            filterType_ = value;
          }
          onChanged();
        } else {
          if (filterTypeCase_ == 3) {
            unaryFilterBuilder_.mergeFrom(value);
          } else {
            unaryFilterBuilder_.setMessage(value);
          }
        }
        filterTypeCase_ = 3;
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      public Builder clearUnaryFilter() {
        if (unaryFilterBuilder_ == null) {
          if (filterTypeCase_ == 3) {
            filterTypeCase_ = 0;
            filterType_ = null;
            onChanged();
          }
        } else {
          if (filterTypeCase_ == 3) {
            filterTypeCase_ = 0;
            filterType_ = null;
          }
          unaryFilterBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      public com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder getUnaryFilterBuilder() {
        return internalGetUnaryFilterFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder
          getUnaryFilterOrBuilder() {
        if ((filterTypeCase_ == 3) && (unaryFilterBuilder_ != null)) {
          return unaryFilterBuilder_.getMessageOrBuilder();
        } else {
          if (filterTypeCase_ == 3) {
            return (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_;
          }
          return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * A filter that takes exactly one argument.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter unary_filter = 3;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.UnaryFilter,
              com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder,
              com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder>
          internalGetUnaryFilterFieldBuilder() {
        if (unaryFilterBuilder_ == null) {
          if (!(filterTypeCase_ == 3)) {
            filterType_ = com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
          }
          unaryFilterBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.UnaryFilter,
                  com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder,
                  com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder>(
                  (com.google.firestore.v1.StructuredQuery.UnaryFilter) filterType_,
                  getParentForChildren(),
                  isClean());
          filterType_ = null;
        }
        filterTypeCase_ = 3;
        onChanged();
        return unaryFilterBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.Filter)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.Filter)
    private static final com.google.firestore.v1.StructuredQuery.Filter DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.Filter();
    }

    public static com.google.firestore.v1.StructuredQuery.Filter getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Filter> PARSER =
        new com.google.protobuf.AbstractParser<Filter>() {
          @java.lang.Override
          public Filter parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<Filter> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<Filter> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.Filter getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface CompositeFilterOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.CompositeFilter)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The operator for combining multiple filters.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
     *
     * @return The enum numeric value on the wire for op.
     */
    int getOpValue();

    /**
     *
     *
     * <pre>
     * The operator for combining multiple filters.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
     *
     * @return The op.
     */
    com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator getOp();

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    java.util.List<com.google.firestore.v1.StructuredQuery.Filter> getFiltersList();

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    com.google.firestore.v1.StructuredQuery.Filter getFilters(int index);

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    int getFiltersCount();

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    java.util.List<? extends com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
        getFiltersOrBuilderList();

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    com.google.firestore.v1.StructuredQuery.FilterOrBuilder getFiltersOrBuilder(int index);
  }

  /**
   *
   *
   * <pre>
   * A filter that merges multiple other filters using the given operator.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.CompositeFilter}
   */
  public static final class CompositeFilter extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.CompositeFilter)
      CompositeFilterOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "CompositeFilter");
    }

    // Use CompositeFilter.newBuilder() to construct.
    private CompositeFilter(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private CompositeFilter() {
      op_ = 0;
      filters_ = java.util.Collections.emptyList();
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_CompositeFilter_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_CompositeFilter_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.CompositeFilter.class,
              com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder.class);
    }

    /**
     *
     *
     * <pre>
     * A composite filter operator.
     * </pre>
     *
     * Protobuf enum {@code google.firestore.v1.StructuredQuery.CompositeFilter.Operator}
     */
    public enum Operator implements com.google.protobuf.ProtocolMessageEnum {
      /**
       *
       *
       * <pre>
       * Unspecified. This value must not be used.
       * </pre>
       *
       * <code>OPERATOR_UNSPECIFIED = 0;</code>
       */
      OPERATOR_UNSPECIFIED(0),
      /**
       *
       *
       * <pre>
       * Documents are required to satisfy all of the combined filters.
       * </pre>
       *
       * <code>AND = 1;</code>
       */
      AND(1),
      /**
       *
       *
       * <pre>
       * Documents are required to satisfy at least one of the combined filters.
       * </pre>
       *
       * <code>OR = 2;</code>
       */
      OR(2),
      UNRECOGNIZED(-1),
      ;

      static {
        com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
            com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
            /* major= */ 4,
            /* minor= */ 33,
            /* patch= */ 2,
            /* suffix= */ "",
            "Operator");
      }

      /**
       *
       *
       * <pre>
       * Unspecified. This value must not be used.
       * </pre>
       *
       * <code>OPERATOR_UNSPECIFIED = 0;</code>
       */
      public static final int OPERATOR_UNSPECIFIED_VALUE = 0;

      /**
       *
       *
       * <pre>
       * Documents are required to satisfy all of the combined filters.
       * </pre>
       *
       * <code>AND = 1;</code>
       */
      public static final int AND_VALUE = 1;

      /**
       *
       *
       * <pre>
       * Documents are required to satisfy at least one of the combined filters.
       * </pre>
       *
       * <code>OR = 2;</code>
       */
      public static final int OR_VALUE = 2;

      public final int getNumber() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalArgumentException(
              "Can't get the number of an unknown enum value.");
        }
        return value;
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       * @deprecated Use {@link #forNumber(int)} instead.
       */
      @java.lang.Deprecated
      public static Operator valueOf(int value) {
        return forNumber(value);
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       */
      public static Operator forNumber(int value) {
        switch (value) {
          case 0:
            return OPERATOR_UNSPECIFIED;
          case 1:
            return AND;
          case 2:
            return OR;
          default:
            return null;
        }
      }

      public static com.google.protobuf.Internal.EnumLiteMap<Operator> internalGetValueMap() {
        return internalValueMap;
      }

      private static final com.google.protobuf.Internal.EnumLiteMap<Operator> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<Operator>() {
            public Operator findValueByNumber(int number) {
              return Operator.forNumber(number);
            }
          };

      public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalStateException(
              "Can't get the descriptor of an unrecognized enum value.");
        }
        return getDescriptor().getValues().get(ordinal());
      }

      public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
        return getDescriptor();
      }

      public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
        return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDescriptor()
            .getEnumTypes()
            .get(0);
      }

      private static final Operator[] VALUES = values();

      public static Operator valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
        if (desc.getType() != getDescriptor()) {
          throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
        }
        if (desc.getIndex() == -1) {
          return UNRECOGNIZED;
        }
        return VALUES[desc.getIndex()];
      }

      private final int value;

      private Operator(int value) {
        this.value = value;
      }

      // @@protoc_insertion_point(enum_scope:google.firestore.v1.StructuredQuery.CompositeFilter.Operator)
    }

    public static final int OP_FIELD_NUMBER = 1;
    private int op_ = 0;

    /**
     *
     *
     * <pre>
     * The operator for combining multiple filters.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
     *
     * @return The enum numeric value on the wire for op.
     */
    @java.lang.Override
    public int getOpValue() {
      return op_;
    }

    /**
     *
     *
     * <pre>
     * The operator for combining multiple filters.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
     *
     * @return The op.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator getOp() {
      com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator result =
          com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator.forNumber(op_);
      return result == null
          ? com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator.UNRECOGNIZED
          : result;
    }

    public static final int FILTERS_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private java.util.List<com.google.firestore.v1.StructuredQuery.Filter> filters_;

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    @java.lang.Override
    public java.util.List<com.google.firestore.v1.StructuredQuery.Filter> getFiltersList() {
      return filters_;
    }

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    @java.lang.Override
    public java.util.List<? extends com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
        getFiltersOrBuilderList() {
      return filters_;
    }

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    @java.lang.Override
    public int getFiltersCount() {
      return filters_.size();
    }

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.Filter getFilters(int index) {
      return filters_.get(index);
    }

    /**
     *
     *
     * <pre>
     * The list of filters to combine.
     *
     * Requires:
     *
     * * At least one filter is present.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FilterOrBuilder getFiltersOrBuilder(int index) {
      return filters_.get(index);
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (op_
          != com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator.OPERATOR_UNSPECIFIED
              .getNumber()) {
        output.writeEnum(1, op_);
      }
      for (int i = 0; i < filters_.size(); i++) {
        output.writeMessage(2, filters_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (op_
          != com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator.OPERATOR_UNSPECIFIED
              .getNumber()) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, op_);
      }
      for (int i = 0; i < filters_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, filters_.get(i));
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.CompositeFilter)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.CompositeFilter other =
          (com.google.firestore.v1.StructuredQuery.CompositeFilter) obj;

      if (op_ != other.op_) return false;
      if (!getFiltersList().equals(other.getFiltersList())) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + OP_FIELD_NUMBER;
      hash = (53 * hash) + op_;
      if (getFiltersCount() > 0) {
        hash = (37 * hash) + FILTERS_FIELD_NUMBER;
        hash = (53 * hash) + getFiltersList().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.firestore.v1.StructuredQuery.CompositeFilter prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A filter that merges multiple other filters using the given operator.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.CompositeFilter}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.CompositeFilter)
        com.google.firestore.v1.StructuredQuery.CompositeFilterOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_CompositeFilter_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_CompositeFilter_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.CompositeFilter.class,
                com.google.firestore.v1.StructuredQuery.CompositeFilter.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.CompositeFilter.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        op_ = 0;
        if (filtersBuilder_ == null) {
          filters_ = java.util.Collections.emptyList();
        } else {
          filters_ = null;
          filtersBuilder_.clear();
        }
        bitField0_ = (bitField0_ & ~0x00000002);
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_CompositeFilter_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CompositeFilter getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CompositeFilter build() {
        com.google.firestore.v1.StructuredQuery.CompositeFilter result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CompositeFilter buildPartial() {
        com.google.firestore.v1.StructuredQuery.CompositeFilter result =
            new com.google.firestore.v1.StructuredQuery.CompositeFilter(this);
        buildPartialRepeatedFields(result);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartialRepeatedFields(
          com.google.firestore.v1.StructuredQuery.CompositeFilter result) {
        if (filtersBuilder_ == null) {
          if (((bitField0_ & 0x00000002) != 0)) {
            filters_ = java.util.Collections.unmodifiableList(filters_);
            bitField0_ = (bitField0_ & ~0x00000002);
          }
          result.filters_ = filters_;
        } else {
          result.filters_ = filtersBuilder_.build();
        }
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.CompositeFilter result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.op_ = op_;
        }
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.CompositeFilter) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.CompositeFilter) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.CompositeFilter other) {
        if (other == com.google.firestore.v1.StructuredQuery.CompositeFilter.getDefaultInstance())
          return this;
        if (other.op_ != 0) {
          setOpValue(other.getOpValue());
        }
        if (filtersBuilder_ == null) {
          if (!other.filters_.isEmpty()) {
            if (filters_.isEmpty()) {
              filters_ = other.filters_;
              bitField0_ = (bitField0_ & ~0x00000002);
            } else {
              ensureFiltersIsMutable();
              filters_.addAll(other.filters_);
            }
            onChanged();
          }
        } else {
          if (!other.filters_.isEmpty()) {
            if (filtersBuilder_.isEmpty()) {
              filtersBuilder_.dispose();
              filtersBuilder_ = null;
              filters_ = other.filters_;
              bitField0_ = (bitField0_ & ~0x00000002);
              filtersBuilder_ =
                  com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                      ? internalGetFiltersFieldBuilder()
                      : null;
            } else {
              filtersBuilder_.addAllMessages(other.filters_);
            }
          }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 8:
                {
                  op_ = input.readEnum();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 8
              case 18:
                {
                  com.google.firestore.v1.StructuredQuery.Filter m =
                      input.readMessage(
                          com.google.firestore.v1.StructuredQuery.Filter.parser(),
                          extensionRegistry);
                  if (filtersBuilder_ == null) {
                    ensureFiltersIsMutable();
                    filters_.add(m);
                  } else {
                    filtersBuilder_.addMessage(m);
                  }
                  break;
                } // case 18
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private int op_ = 0;

      /**
       *
       *
       * <pre>
       * The operator for combining multiple filters.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
       *
       * @return The enum numeric value on the wire for op.
       */
      @java.lang.Override
      public int getOpValue() {
        return op_;
      }

      /**
       *
       *
       * <pre>
       * The operator for combining multiple filters.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
       *
       * @param value The enum numeric value on the wire for op to set.
       * @return This builder for chaining.
       */
      public Builder setOpValue(int value) {
        op_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The operator for combining multiple filters.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
       *
       * @return The op.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator getOp() {
        com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator result =
            com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator.forNumber(op_);
        return result == null
            ? com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator.UNRECOGNIZED
            : result;
      }

      /**
       *
       *
       * <pre>
       * The operator for combining multiple filters.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
       *
       * @param value The op to set.
       * @return This builder for chaining.
       */
      public Builder setOp(com.google.firestore.v1.StructuredQuery.CompositeFilter.Operator value) {
        if (value == null) {
          throw new NullPointerException();
        }
        bitField0_ |= 0x00000001;
        op_ = value.getNumber();
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The operator for combining multiple filters.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.CompositeFilter.Operator op = 1;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearOp() {
        bitField0_ = (bitField0_ & ~0x00000001);
        op_ = 0;
        onChanged();
        return this;
      }

      private java.util.List<com.google.firestore.v1.StructuredQuery.Filter> filters_ =
          java.util.Collections.emptyList();

      private void ensureFiltersIsMutable() {
        if (!((bitField0_ & 0x00000002) != 0)) {
          filters_ =
              new java.util.ArrayList<com.google.firestore.v1.StructuredQuery.Filter>(filters_);
          bitField0_ |= 0x00000002;
        }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
              com.google.firestore.v1.StructuredQuery.Filter,
              com.google.firestore.v1.StructuredQuery.Filter.Builder,
              com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
          filtersBuilder_;

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public java.util.List<com.google.firestore.v1.StructuredQuery.Filter> getFiltersList() {
        if (filtersBuilder_ == null) {
          return java.util.Collections.unmodifiableList(filters_);
        } else {
          return filtersBuilder_.getMessageList();
        }
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public int getFiltersCount() {
        if (filtersBuilder_ == null) {
          return filters_.size();
        } else {
          return filtersBuilder_.getCount();
        }
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.Filter getFilters(int index) {
        if (filtersBuilder_ == null) {
          return filters_.get(index);
        } else {
          return filtersBuilder_.getMessage(index);
        }
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder setFilters(int index, com.google.firestore.v1.StructuredQuery.Filter value) {
        if (filtersBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureFiltersIsMutable();
          filters_.set(index, value);
          onChanged();
        } else {
          filtersBuilder_.setMessage(index, value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder setFilters(
          int index, com.google.firestore.v1.StructuredQuery.Filter.Builder builderForValue) {
        if (filtersBuilder_ == null) {
          ensureFiltersIsMutable();
          filters_.set(index, builderForValue.build());
          onChanged();
        } else {
          filtersBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder addFilters(com.google.firestore.v1.StructuredQuery.Filter value) {
        if (filtersBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureFiltersIsMutable();
          filters_.add(value);
          onChanged();
        } else {
          filtersBuilder_.addMessage(value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder addFilters(int index, com.google.firestore.v1.StructuredQuery.Filter value) {
        if (filtersBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureFiltersIsMutable();
          filters_.add(index, value);
          onChanged();
        } else {
          filtersBuilder_.addMessage(index, value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder addFilters(
          com.google.firestore.v1.StructuredQuery.Filter.Builder builderForValue) {
        if (filtersBuilder_ == null) {
          ensureFiltersIsMutable();
          filters_.add(builderForValue.build());
          onChanged();
        } else {
          filtersBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder addFilters(
          int index, com.google.firestore.v1.StructuredQuery.Filter.Builder builderForValue) {
        if (filtersBuilder_ == null) {
          ensureFiltersIsMutable();
          filters_.add(index, builderForValue.build());
          onChanged();
        } else {
          filtersBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder addAllFilters(
          java.lang.Iterable<? extends com.google.firestore.v1.StructuredQuery.Filter> values) {
        if (filtersBuilder_ == null) {
          ensureFiltersIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(values, filters_);
          onChanged();
        } else {
          filtersBuilder_.addAllMessages(values);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder clearFilters() {
        if (filtersBuilder_ == null) {
          filters_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
          onChanged();
        } else {
          filtersBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public Builder removeFilters(int index) {
        if (filtersBuilder_ == null) {
          ensureFiltersIsMutable();
          filters_.remove(index);
          onChanged();
        } else {
          filtersBuilder_.remove(index);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.Filter.Builder getFiltersBuilder(int index) {
        return internalGetFiltersFieldBuilder().getBuilder(index);
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FilterOrBuilder getFiltersOrBuilder(
          int index) {
        if (filtersBuilder_ == null) {
          return filters_.get(index);
        } else {
          return filtersBuilder_.getMessageOrBuilder(index);
        }
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public java.util.List<? extends com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
          getFiltersOrBuilderList() {
        if (filtersBuilder_ != null) {
          return filtersBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(filters_);
        }
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.Filter.Builder addFiltersBuilder() {
        return internalGetFiltersFieldBuilder()
            .addBuilder(com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance());
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.Filter.Builder addFiltersBuilder(int index) {
        return internalGetFiltersFieldBuilder()
            .addBuilder(index, com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance());
      }

      /**
       *
       *
       * <pre>
       * The list of filters to combine.
       *
       * Requires:
       *
       * * At least one filter is present.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.Filter filters = 2;</code>
       */
      public java.util.List<com.google.firestore.v1.StructuredQuery.Filter.Builder>
          getFiltersBuilderList() {
        return internalGetFiltersFieldBuilder().getBuilderList();
      }

      private com.google.protobuf.RepeatedFieldBuilder<
              com.google.firestore.v1.StructuredQuery.Filter,
              com.google.firestore.v1.StructuredQuery.Filter.Builder,
              com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
          internalGetFiltersFieldBuilder() {
        if (filtersBuilder_ == null) {
          filtersBuilder_ =
              new com.google.protobuf.RepeatedFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.Filter,
                  com.google.firestore.v1.StructuredQuery.Filter.Builder,
                  com.google.firestore.v1.StructuredQuery.FilterOrBuilder>(
                  filters_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
          filters_ = null;
        }
        return filtersBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.CompositeFilter)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.CompositeFilter)
    private static final com.google.firestore.v1.StructuredQuery.CompositeFilter DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.CompositeFilter();
    }

    public static com.google.firestore.v1.StructuredQuery.CompositeFilter getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<CompositeFilter> PARSER =
        new com.google.protobuf.AbstractParser<CompositeFilter>() {
          @java.lang.Override
          public CompositeFilter parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<CompositeFilter> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<CompositeFilter> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.CompositeFilter getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface FieldFilterOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.FieldFilter)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The field to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return Whether the field field is set.
     */
    boolean hasField();

    /**
     *
     *
     * <pre>
     * The field to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return The field.
     */
    com.google.firestore.v1.StructuredQuery.FieldReference getField();

    /**
     *
     *
     * <pre>
     * The field to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     */
    com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder();

    /**
     *
     *
     * <pre>
     * The operator to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
     *
     * @return The enum numeric value on the wire for op.
     */
    int getOpValue();

    /**
     *
     *
     * <pre>
     * The operator to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
     *
     * @return The op.
     */
    com.google.firestore.v1.StructuredQuery.FieldFilter.Operator getOp();

    /**
     *
     *
     * <pre>
     * The value to compare to.
     * </pre>
     *
     * <code>.google.firestore.v1.Value value = 3;</code>
     *
     * @return Whether the value field is set.
     */
    boolean hasValue();

    /**
     *
     *
     * <pre>
     * The value to compare to.
     * </pre>
     *
     * <code>.google.firestore.v1.Value value = 3;</code>
     *
     * @return The value.
     */
    com.google.firestore.v1.Value getValue();

    /**
     *
     *
     * <pre>
     * The value to compare to.
     * </pre>
     *
     * <code>.google.firestore.v1.Value value = 3;</code>
     */
    com.google.firestore.v1.ValueOrBuilder getValueOrBuilder();
  }

  /**
   *
   *
   * <pre>
   * A filter on a specific field.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.FieldFilter}
   */
  public static final class FieldFilter extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.FieldFilter)
      FieldFilterOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "FieldFilter");
    }

    // Use FieldFilter.newBuilder() to construct.
    private FieldFilter(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private FieldFilter() {
      op_ = 0;
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_FieldFilter_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_FieldFilter_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.FieldFilter.class,
              com.google.firestore.v1.StructuredQuery.FieldFilter.Builder.class);
    }

    /**
     *
     *
     * <pre>
     * A field filter operator.
     * </pre>
     *
     * Protobuf enum {@code google.firestore.v1.StructuredQuery.FieldFilter.Operator}
     */
    public enum Operator implements com.google.protobuf.ProtocolMessageEnum {
      /**
       *
       *
       * <pre>
       * Unspecified. This value must not be used.
       * </pre>
       *
       * <code>OPERATOR_UNSPECIFIED = 0;</code>
       */
      OPERATOR_UNSPECIFIED(0),
      /**
       *
       *
       * <pre>
       * The given `field` is less than the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>LESS_THAN = 1;</code>
       */
      LESS_THAN(1),
      /**
       *
       *
       * <pre>
       * The given `field` is less than or equal to the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>LESS_THAN_OR_EQUAL = 2;</code>
       */
      LESS_THAN_OR_EQUAL(2),
      /**
       *
       *
       * <pre>
       * The given `field` is greater than the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>GREATER_THAN = 3;</code>
       */
      GREATER_THAN(3),
      /**
       *
       *
       * <pre>
       * The given `field` is greater than or equal to the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>GREATER_THAN_OR_EQUAL = 4;</code>
       */
      GREATER_THAN_OR_EQUAL(4),
      /**
       *
       *
       * <pre>
       * The given `field` is equal to the given `value`.
       * </pre>
       *
       * <code>EQUAL = 5;</code>
       */
      EQUAL(5),
      /**
       *
       *
       * <pre>
       * The given `field` is not equal to the given `value`.
       *
       * Requires:
       *
       * * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>NOT_EQUAL = 6;</code>
       */
      NOT_EQUAL(6),
      /**
       *
       *
       * <pre>
       * The given `field` is an array that contains the given `value`.
       * </pre>
       *
       * <code>ARRAY_CONTAINS = 7;</code>
       */
      ARRAY_CONTAINS(7),
      /**
       *
       *
       * <pre>
       * The given `field` is equal to at least one value in the given array.
       *
       * Requires:
       *
       * * That `value` is a non-empty `ArrayValue`, subject to disjunction
       * limits.
       * * No `NOT_IN` filters in the same query.
       * </pre>
       *
       * <code>IN = 8;</code>
       */
      IN(8),
      /**
       *
       *
       * <pre>
       * The given `field` is an array that contains any of the values in the
       * given array.
       *
       * Requires:
       *
       * * That `value` is a non-empty `ArrayValue`, subject to disjunction
       * limits.
       * * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction.
       * * No `NOT_IN` filters in the same query.
       * </pre>
       *
       * <code>ARRAY_CONTAINS_ANY = 9;</code>
       */
      ARRAY_CONTAINS_ANY(9),
      /**
       *
       *
       * <pre>
       * The value of the `field` is not in the given array.
       *
       * Requires:
       *
       * * That `value` is a non-empty `ArrayValue` with at most 10 values.
       * * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`,
       * `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>NOT_IN = 10;</code>
       */
      NOT_IN(10),
      UNRECOGNIZED(-1),
      ;

      static {
        com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
            com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
            /* major= */ 4,
            /* minor= */ 33,
            /* patch= */ 2,
            /* suffix= */ "",
            "Operator");
      }

      /**
       *
       *
       * <pre>
       * Unspecified. This value must not be used.
       * </pre>
       *
       * <code>OPERATOR_UNSPECIFIED = 0;</code>
       */
      public static final int OPERATOR_UNSPECIFIED_VALUE = 0;

      /**
       *
       *
       * <pre>
       * The given `field` is less than the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>LESS_THAN = 1;</code>
       */
      public static final int LESS_THAN_VALUE = 1;

      /**
       *
       *
       * <pre>
       * The given `field` is less than or equal to the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>LESS_THAN_OR_EQUAL = 2;</code>
       */
      public static final int LESS_THAN_OR_EQUAL_VALUE = 2;

      /**
       *
       *
       * <pre>
       * The given `field` is greater than the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>GREATER_THAN = 3;</code>
       */
      public static final int GREATER_THAN_VALUE = 3;

      /**
       *
       *
       * <pre>
       * The given `field` is greater than or equal to the given `value`.
       *
       * Requires:
       *
       * * That `field` come first in `order_by`.
       * </pre>
       *
       * <code>GREATER_THAN_OR_EQUAL = 4;</code>
       */
      public static final int GREATER_THAN_OR_EQUAL_VALUE = 4;

      /**
       *
       *
       * <pre>
       * The given `field` is equal to the given `value`.
       * </pre>
       *
       * <code>EQUAL = 5;</code>
       */
      public static final int EQUAL_VALUE = 5;

      /**
       *
       *
       * <pre>
       * The given `field` is not equal to the given `value`.
       *
       * Requires:
       *
       * * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>NOT_EQUAL = 6;</code>
       */
      public static final int NOT_EQUAL_VALUE = 6;

      /**
       *
       *
       * <pre>
       * The given `field` is an array that contains the given `value`.
       * </pre>
       *
       * <code>ARRAY_CONTAINS = 7;</code>
       */
      public static final int ARRAY_CONTAINS_VALUE = 7;

      /**
       *
       *
       * <pre>
       * The given `field` is equal to at least one value in the given array.
       *
       * Requires:
       *
       * * That `value` is a non-empty `ArrayValue`, subject to disjunction
       * limits.
       * * No `NOT_IN` filters in the same query.
       * </pre>
       *
       * <code>IN = 8;</code>
       */
      public static final int IN_VALUE = 8;

      /**
       *
       *
       * <pre>
       * The given `field` is an array that contains any of the values in the
       * given array.
       *
       * Requires:
       *
       * * That `value` is a non-empty `ArrayValue`, subject to disjunction
       * limits.
       * * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction.
       * * No `NOT_IN` filters in the same query.
       * </pre>
       *
       * <code>ARRAY_CONTAINS_ANY = 9;</code>
       */
      public static final int ARRAY_CONTAINS_ANY_VALUE = 9;

      /**
       *
       *
       * <pre>
       * The value of the `field` is not in the given array.
       *
       * Requires:
       *
       * * That `value` is a non-empty `ArrayValue` with at most 10 values.
       * * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`,
       * `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>NOT_IN = 10;</code>
       */
      public static final int NOT_IN_VALUE = 10;

      public final int getNumber() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalArgumentException(
              "Can't get the number of an unknown enum value.");
        }
        return value;
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       * @deprecated Use {@link #forNumber(int)} instead.
       */
      @java.lang.Deprecated
      public static Operator valueOf(int value) {
        return forNumber(value);
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       */
      public static Operator forNumber(int value) {
        switch (value) {
          case 0:
            return OPERATOR_UNSPECIFIED;
          case 1:
            return LESS_THAN;
          case 2:
            return LESS_THAN_OR_EQUAL;
          case 3:
            return GREATER_THAN;
          case 4:
            return GREATER_THAN_OR_EQUAL;
          case 5:
            return EQUAL;
          case 6:
            return NOT_EQUAL;
          case 7:
            return ARRAY_CONTAINS;
          case 8:
            return IN;
          case 9:
            return ARRAY_CONTAINS_ANY;
          case 10:
            return NOT_IN;
          default:
            return null;
        }
      }

      public static com.google.protobuf.Internal.EnumLiteMap<Operator> internalGetValueMap() {
        return internalValueMap;
      }

      private static final com.google.protobuf.Internal.EnumLiteMap<Operator> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<Operator>() {
            public Operator findValueByNumber(int number) {
              return Operator.forNumber(number);
            }
          };

      public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalStateException(
              "Can't get the descriptor of an unrecognized enum value.");
        }
        return getDescriptor().getValues().get(ordinal());
      }

      public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
        return getDescriptor();
      }

      public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
        return com.google.firestore.v1.StructuredQuery.FieldFilter.getDescriptor()
            .getEnumTypes()
            .get(0);
      }

      private static final Operator[] VALUES = values();

      public static Operator valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
        if (desc.getType() != getDescriptor()) {
          throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
        }
        if (desc.getIndex() == -1) {
          return UNRECOGNIZED;
        }
        return VALUES[desc.getIndex()];
      }

      private final int value;

      private Operator(int value) {
        this.value = value;
      }

      // @@protoc_insertion_point(enum_scope:google.firestore.v1.StructuredQuery.FieldFilter.Operator)
    }

    private int bitField0_;
    public static final int FIELD_FIELD_NUMBER = 1;
    private com.google.firestore.v1.StructuredQuery.FieldReference field_;

    /**
     *
     *
     * <pre>
     * The field to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return Whether the field field is set.
     */
    @java.lang.Override
    public boolean hasField() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * The field to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return The field.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReference getField() {
      return field_ == null
          ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
          : field_;
    }

    /**
     *
     *
     * <pre>
     * The field to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder() {
      return field_ == null
          ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
          : field_;
    }

    public static final int OP_FIELD_NUMBER = 2;
    private int op_ = 0;

    /**
     *
     *
     * <pre>
     * The operator to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
     *
     * @return The enum numeric value on the wire for op.
     */
    @java.lang.Override
    public int getOpValue() {
      return op_;
    }

    /**
     *
     *
     * <pre>
     * The operator to filter by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
     *
     * @return The op.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldFilter.Operator getOp() {
      com.google.firestore.v1.StructuredQuery.FieldFilter.Operator result =
          com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.forNumber(op_);
      return result == null
          ? com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.UNRECOGNIZED
          : result;
    }

    public static final int VALUE_FIELD_NUMBER = 3;
    private com.google.firestore.v1.Value value_;

    /**
     *
     *
     * <pre>
     * The value to compare to.
     * </pre>
     *
     * <code>.google.firestore.v1.Value value = 3;</code>
     *
     * @return Whether the value field is set.
     */
    @java.lang.Override
    public boolean hasValue() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * The value to compare to.
     * </pre>
     *
     * <code>.google.firestore.v1.Value value = 3;</code>
     *
     * @return The value.
     */
    @java.lang.Override
    public com.google.firestore.v1.Value getValue() {
      return value_ == null ? com.google.firestore.v1.Value.getDefaultInstance() : value_;
    }

    /**
     *
     *
     * <pre>
     * The value to compare to.
     * </pre>
     *
     * <code>.google.firestore.v1.Value value = 3;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.ValueOrBuilder getValueOrBuilder() {
      return value_ == null ? com.google.firestore.v1.Value.getDefaultInstance() : value_;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (((bitField0_ & 0x00000001) != 0)) {
        output.writeMessage(1, getField());
      }
      if (op_
          != com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.OPERATOR_UNSPECIFIED
              .getNumber()) {
        output.writeEnum(2, op_);
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        output.writeMessage(3, getValue());
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getField());
      }
      if (op_
          != com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.OPERATOR_UNSPECIFIED
              .getNumber()) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, op_);
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getValue());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.FieldFilter)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.FieldFilter other =
          (com.google.firestore.v1.StructuredQuery.FieldFilter) obj;

      if (hasField() != other.hasField()) return false;
      if (hasField()) {
        if (!getField().equals(other.getField())) return false;
      }
      if (op_ != other.op_) return false;
      if (hasValue() != other.hasValue()) return false;
      if (hasValue()) {
        if (!getValue().equals(other.getValue())) return false;
      }
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      if (hasField()) {
        hash = (37 * hash) + FIELD_FIELD_NUMBER;
        hash = (53 * hash) + getField().hashCode();
      }
      hash = (37 * hash) + OP_FIELD_NUMBER;
      hash = (53 * hash) + op_;
      if (hasValue()) {
        hash = (37 * hash) + VALUE_FIELD_NUMBER;
        hash = (53 * hash) + getValue().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.firestore.v1.StructuredQuery.FieldFilter prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A filter on a specific field.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.FieldFilter}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.FieldFilter)
        com.google.firestore.v1.StructuredQuery.FieldFilterOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FieldFilter_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FieldFilter_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.FieldFilter.class,
                com.google.firestore.v1.StructuredQuery.FieldFilter.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.FieldFilter.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          internalGetFieldFieldBuilder();
          internalGetValueFieldBuilder();
        }
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        field_ = null;
        if (fieldBuilder_ != null) {
          fieldBuilder_.dispose();
          fieldBuilder_ = null;
        }
        op_ = 0;
        value_ = null;
        if (valueBuilder_ != null) {
          valueBuilder_.dispose();
          valueBuilder_ = null;
        }
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FieldFilter_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldFilter getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldFilter build() {
        com.google.firestore.v1.StructuredQuery.FieldFilter result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldFilter buildPartial() {
        com.google.firestore.v1.StructuredQuery.FieldFilter result =
            new com.google.firestore.v1.StructuredQuery.FieldFilter(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.FieldFilter result) {
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.field_ = fieldBuilder_ == null ? field_ : fieldBuilder_.build();
          to_bitField0_ |= 0x00000001;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.op_ = op_;
        }
        if (((from_bitField0_ & 0x00000004) != 0)) {
          result.value_ = valueBuilder_ == null ? value_ : valueBuilder_.build();
          to_bitField0_ |= 0x00000002;
        }
        result.bitField0_ |= to_bitField0_;
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.FieldFilter) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.FieldFilter) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.FieldFilter other) {
        if (other == com.google.firestore.v1.StructuredQuery.FieldFilter.getDefaultInstance())
          return this;
        if (other.hasField()) {
          mergeField(other.getField());
        }
        if (other.op_ != 0) {
          setOpValue(other.getOpValue());
        }
        if (other.hasValue()) {
          mergeValue(other.getValue());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  input.readMessage(internalGetFieldFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 16:
                {
                  op_ = input.readEnum();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 16
              case 26:
                {
                  input.readMessage(internalGetValueFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000004;
                  break;
                } // case 26
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private com.google.firestore.v1.StructuredQuery.FieldReference field_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          fieldBuilder_;

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       *
       * @return Whether the field field is set.
       */
      public boolean hasField() {
        return ((bitField0_ & 0x00000001) != 0);
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       *
       * @return The field.
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference getField() {
        if (fieldBuilder_ == null) {
          return field_ == null
              ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
              : field_;
        } else {
          return fieldBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder setField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          field_ = value;
        } else {
          fieldBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder setField(
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (fieldBuilder_ == null) {
          field_ = builderForValue.build();
        } else {
          fieldBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder mergeField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)
              && field_ != null
              && field_
                  != com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()) {
            getFieldBuilder().mergeFrom(value);
          } else {
            field_ = value;
          }
        } else {
          fieldBuilder_.mergeFrom(value);
        }
        if (field_ != null) {
          bitField0_ |= 0x00000001;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder clearField() {
        bitField0_ = (bitField0_ & ~0x00000001);
        field_ = null;
        if (fieldBuilder_ != null) {
          fieldBuilder_.dispose();
          fieldBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder getFieldBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return internalGetFieldFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder() {
        if (fieldBuilder_ != null) {
          return fieldBuilder_.getMessageOrBuilder();
        } else {
          return field_ == null
              ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
              : field_;
        }
      }

      /**
       *
       *
       * <pre>
       * The field to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          internalGetFieldFieldBuilder() {
        if (fieldBuilder_ == null) {
          fieldBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.FieldReference,
                  com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
                  com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>(
                  getField(), getParentForChildren(), isClean());
          field_ = null;
        }
        return fieldBuilder_;
      }

      private int op_ = 0;

      /**
       *
       *
       * <pre>
       * The operator to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
       *
       * @return The enum numeric value on the wire for op.
       */
      @java.lang.Override
      public int getOpValue() {
        return op_;
      }

      /**
       *
       *
       * <pre>
       * The operator to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
       *
       * @param value The enum numeric value on the wire for op to set.
       * @return This builder for chaining.
       */
      public Builder setOpValue(int value) {
        op_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The operator to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
       *
       * @return The op.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldFilter.Operator getOp() {
        com.google.firestore.v1.StructuredQuery.FieldFilter.Operator result =
            com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.forNumber(op_);
        return result == null
            ? com.google.firestore.v1.StructuredQuery.FieldFilter.Operator.UNRECOGNIZED
            : result;
      }

      /**
       *
       *
       * <pre>
       * The operator to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
       *
       * @param value The op to set.
       * @return This builder for chaining.
       */
      public Builder setOp(com.google.firestore.v1.StructuredQuery.FieldFilter.Operator value) {
        if (value == null) {
          throw new NullPointerException();
        }
        bitField0_ |= 0x00000002;
        op_ = value.getNumber();
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The operator to filter by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldFilter.Operator op = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearOp() {
        bitField0_ = (bitField0_ & ~0x00000002);
        op_ = 0;
        onChanged();
        return this;
      }

      private com.google.firestore.v1.Value value_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.Value,
              com.google.firestore.v1.Value.Builder,
              com.google.firestore.v1.ValueOrBuilder>
          valueBuilder_;

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       *
       * @return Whether the value field is set.
       */
      public boolean hasValue() {
        return ((bitField0_ & 0x00000004) != 0);
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       *
       * @return The value.
       */
      public com.google.firestore.v1.Value getValue() {
        if (valueBuilder_ == null) {
          return value_ == null ? com.google.firestore.v1.Value.getDefaultInstance() : value_;
        } else {
          return valueBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      public Builder setValue(com.google.firestore.v1.Value value) {
        if (valueBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          value_ = value;
        } else {
          valueBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      public Builder setValue(com.google.firestore.v1.Value.Builder builderForValue) {
        if (valueBuilder_ == null) {
          value_ = builderForValue.build();
        } else {
          valueBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      public Builder mergeValue(com.google.firestore.v1.Value value) {
        if (valueBuilder_ == null) {
          if (((bitField0_ & 0x00000004) != 0)
              && value_ != null
              && value_ != com.google.firestore.v1.Value.getDefaultInstance()) {
            getValueBuilder().mergeFrom(value);
          } else {
            value_ = value;
          }
        } else {
          valueBuilder_.mergeFrom(value);
        }
        if (value_ != null) {
          bitField0_ |= 0x00000004;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      public Builder clearValue() {
        bitField0_ = (bitField0_ & ~0x00000004);
        value_ = null;
        if (valueBuilder_ != null) {
          valueBuilder_.dispose();
          valueBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      public com.google.firestore.v1.Value.Builder getValueBuilder() {
        bitField0_ |= 0x00000004;
        onChanged();
        return internalGetValueFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      public com.google.firestore.v1.ValueOrBuilder getValueOrBuilder() {
        if (valueBuilder_ != null) {
          return valueBuilder_.getMessageOrBuilder();
        } else {
          return value_ == null ? com.google.firestore.v1.Value.getDefaultInstance() : value_;
        }
      }

      /**
       *
       *
       * <pre>
       * The value to compare to.
       * </pre>
       *
       * <code>.google.firestore.v1.Value value = 3;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.Value,
              com.google.firestore.v1.Value.Builder,
              com.google.firestore.v1.ValueOrBuilder>
          internalGetValueFieldBuilder() {
        if (valueBuilder_ == null) {
          valueBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.Value,
                  com.google.firestore.v1.Value.Builder,
                  com.google.firestore.v1.ValueOrBuilder>(
                  getValue(), getParentForChildren(), isClean());
          value_ = null;
        }
        return valueBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.FieldFilter)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.FieldFilter)
    private static final com.google.firestore.v1.StructuredQuery.FieldFilter DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.FieldFilter();
    }

    public static com.google.firestore.v1.StructuredQuery.FieldFilter getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<FieldFilter> PARSER =
        new com.google.protobuf.AbstractParser<FieldFilter>() {
          @java.lang.Override
          public FieldFilter parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<FieldFilter> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<FieldFilter> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldFilter getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface UnaryFilterOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.UnaryFilter)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The unary operator to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
     *
     * @return The enum numeric value on the wire for op.
     */
    int getOpValue();

    /**
     *
     *
     * <pre>
     * The unary operator to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
     *
     * @return The op.
     */
    com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator getOp();

    /**
     *
     *
     * <pre>
     * The field to which to apply the operator.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
     *
     * @return Whether the field field is set.
     */
    boolean hasField();

    /**
     *
     *
     * <pre>
     * The field to which to apply the operator.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
     *
     * @return The field.
     */
    com.google.firestore.v1.StructuredQuery.FieldReference getField();

    /**
     *
     *
     * <pre>
     * The field to which to apply the operator.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
     */
    com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder();

    com.google.firestore.v1.StructuredQuery.UnaryFilter.OperandTypeCase getOperandTypeCase();
  }

  /**
   *
   *
   * <pre>
   * A filter with a single operand.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.UnaryFilter}
   */
  public static final class UnaryFilter extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.UnaryFilter)
      UnaryFilterOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "UnaryFilter");
    }

    // Use UnaryFilter.newBuilder() to construct.
    private UnaryFilter(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private UnaryFilter() {
      op_ = 0;
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_UnaryFilter_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_UnaryFilter_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.UnaryFilter.class,
              com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder.class);
    }

    /**
     *
     *
     * <pre>
     * A unary operator.
     * </pre>
     *
     * Protobuf enum {@code google.firestore.v1.StructuredQuery.UnaryFilter.Operator}
     */
    public enum Operator implements com.google.protobuf.ProtocolMessageEnum {
      /**
       *
       *
       * <pre>
       * Unspecified. This value must not be used.
       * </pre>
       *
       * <code>OPERATOR_UNSPECIFIED = 0;</code>
       */
      OPERATOR_UNSPECIFIED(0),
      /**
       *
       *
       * <pre>
       * The given `field` is equal to `NaN`.
       * </pre>
       *
       * <code>IS_NAN = 2;</code>
       */
      IS_NAN(2),
      /**
       *
       *
       * <pre>
       * The given `field` is equal to `NULL`.
       * </pre>
       *
       * <code>IS_NULL = 3;</code>
       */
      IS_NULL(3),
      /**
       *
       *
       * <pre>
       * The given `field` is not equal to `NaN`.
       *
       * Requires:
       *
       * * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>IS_NOT_NAN = 4;</code>
       */
      IS_NOT_NAN(4),
      /**
       *
       *
       * <pre>
       * The given `field` is not equal to `NULL`.
       *
       * Requires:
       *
       * * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>IS_NOT_NULL = 5;</code>
       */
      IS_NOT_NULL(5),
      UNRECOGNIZED(-1),
      ;

      static {
        com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
            com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
            /* major= */ 4,
            /* minor= */ 33,
            /* patch= */ 2,
            /* suffix= */ "",
            "Operator");
      }

      /**
       *
       *
       * <pre>
       * Unspecified. This value must not be used.
       * </pre>
       *
       * <code>OPERATOR_UNSPECIFIED = 0;</code>
       */
      public static final int OPERATOR_UNSPECIFIED_VALUE = 0;

      /**
       *
       *
       * <pre>
       * The given `field` is equal to `NaN`.
       * </pre>
       *
       * <code>IS_NAN = 2;</code>
       */
      public static final int IS_NAN_VALUE = 2;

      /**
       *
       *
       * <pre>
       * The given `field` is equal to `NULL`.
       * </pre>
       *
       * <code>IS_NULL = 3;</code>
       */
      public static final int IS_NULL_VALUE = 3;

      /**
       *
       *
       * <pre>
       * The given `field` is not equal to `NaN`.
       *
       * Requires:
       *
       * * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>IS_NOT_NAN = 4;</code>
       */
      public static final int IS_NOT_NAN_VALUE = 4;

      /**
       *
       *
       * <pre>
       * The given `field` is not equal to `NULL`.
       *
       * Requires:
       *
       * * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
       * * That `field` comes first in the `order_by`.
       * </pre>
       *
       * <code>IS_NOT_NULL = 5;</code>
       */
      public static final int IS_NOT_NULL_VALUE = 5;

      public final int getNumber() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalArgumentException(
              "Can't get the number of an unknown enum value.");
        }
        return value;
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       * @deprecated Use {@link #forNumber(int)} instead.
       */
      @java.lang.Deprecated
      public static Operator valueOf(int value) {
        return forNumber(value);
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       */
      public static Operator forNumber(int value) {
        switch (value) {
          case 0:
            return OPERATOR_UNSPECIFIED;
          case 2:
            return IS_NAN;
          case 3:
            return IS_NULL;
          case 4:
            return IS_NOT_NAN;
          case 5:
            return IS_NOT_NULL;
          default:
            return null;
        }
      }

      public static com.google.protobuf.Internal.EnumLiteMap<Operator> internalGetValueMap() {
        return internalValueMap;
      }

      private static final com.google.protobuf.Internal.EnumLiteMap<Operator> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<Operator>() {
            public Operator findValueByNumber(int number) {
              return Operator.forNumber(number);
            }
          };

      public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalStateException(
              "Can't get the descriptor of an unrecognized enum value.");
        }
        return getDescriptor().getValues().get(ordinal());
      }

      public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
        return getDescriptor();
      }

      public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
        return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDescriptor()
            .getEnumTypes()
            .get(0);
      }

      private static final Operator[] VALUES = values();

      public static Operator valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
        if (desc.getType() != getDescriptor()) {
          throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
        }
        if (desc.getIndex() == -1) {
          return UNRECOGNIZED;
        }
        return VALUES[desc.getIndex()];
      }

      private final int value;

      private Operator(int value) {
        this.value = value;
      }

      // @@protoc_insertion_point(enum_scope:google.firestore.v1.StructuredQuery.UnaryFilter.Operator)
    }

    private int operandTypeCase_ = 0;

    @SuppressWarnings("serial")
    private java.lang.Object operandType_;

    public enum OperandTypeCase
        implements
            com.google.protobuf.Internal.EnumLite,
            com.google.protobuf.AbstractMessage.InternalOneOfEnum {
      FIELD(2),
      OPERANDTYPE_NOT_SET(0);
      private final int value;

      private OperandTypeCase(int value) {
        this.value = value;
      }

      /**
       * @param value The number of the enum to look for.
       * @return The enum associated with the given number.
       * @deprecated Use {@link #forNumber(int)} instead.
       */
      @java.lang.Deprecated
      public static OperandTypeCase valueOf(int value) {
        return forNumber(value);
      }

      public static OperandTypeCase forNumber(int value) {
        switch (value) {
          case 2:
            return FIELD;
          case 0:
            return OPERANDTYPE_NOT_SET;
          default:
            return null;
        }
      }

      public int getNumber() {
        return this.value;
      }
    };

    public OperandTypeCase getOperandTypeCase() {
      return OperandTypeCase.forNumber(operandTypeCase_);
    }

    public static final int OP_FIELD_NUMBER = 1;
    private int op_ = 0;

    /**
     *
     *
     * <pre>
     * The unary operator to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
     *
     * @return The enum numeric value on the wire for op.
     */
    @java.lang.Override
    public int getOpValue() {
      return op_;
    }

    /**
     *
     *
     * <pre>
     * The unary operator to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
     *
     * @return The op.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator getOp() {
      com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator result =
          com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator.forNumber(op_);
      return result == null
          ? com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator.UNRECOGNIZED
          : result;
    }

    public static final int FIELD_FIELD_NUMBER = 2;

    /**
     *
     *
     * <pre>
     * The field to which to apply the operator.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
     *
     * @return Whether the field field is set.
     */
    @java.lang.Override
    public boolean hasField() {
      return operandTypeCase_ == 2;
    }

    /**
     *
     *
     * <pre>
     * The field to which to apply the operator.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
     *
     * @return The field.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReference getField() {
      if (operandTypeCase_ == 2) {
        return (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_;
      }
      return com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
    }

    /**
     *
     *
     * <pre>
     * The field to which to apply the operator.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder() {
      if (operandTypeCase_ == 2) {
        return (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_;
      }
      return com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (op_
          != com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator.OPERATOR_UNSPECIFIED
              .getNumber()) {
        output.writeEnum(1, op_);
      }
      if (operandTypeCase_ == 2) {
        output.writeMessage(
            2, (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_);
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (op_
          != com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator.OPERATOR_UNSPECIFIED
              .getNumber()) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, op_);
      }
      if (operandTypeCase_ == 2) {
        size +=
            com.google.protobuf.CodedOutputStream.computeMessageSize(
                2, (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.UnaryFilter)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.UnaryFilter other =
          (com.google.firestore.v1.StructuredQuery.UnaryFilter) obj;

      if (op_ != other.op_) return false;
      if (!getOperandTypeCase().equals(other.getOperandTypeCase())) return false;
      switch (operandTypeCase_) {
        case 2:
          if (!getField().equals(other.getField())) return false;
          break;
        case 0:
        default:
      }
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + OP_FIELD_NUMBER;
      hash = (53 * hash) + op_;
      switch (operandTypeCase_) {
        case 2:
          hash = (37 * hash) + FIELD_FIELD_NUMBER;
          hash = (53 * hash) + getField().hashCode();
          break;
        case 0:
        default:
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.firestore.v1.StructuredQuery.UnaryFilter prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A filter with a single operand.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.UnaryFilter}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.UnaryFilter)
        com.google.firestore.v1.StructuredQuery.UnaryFilterOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_UnaryFilter_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_UnaryFilter_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.UnaryFilter.class,
                com.google.firestore.v1.StructuredQuery.UnaryFilter.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.UnaryFilter.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        op_ = 0;
        if (fieldBuilder_ != null) {
          fieldBuilder_.clear();
        }
        operandTypeCase_ = 0;
        operandType_ = null;
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_UnaryFilter_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.UnaryFilter getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.UnaryFilter build() {
        com.google.firestore.v1.StructuredQuery.UnaryFilter result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.UnaryFilter buildPartial() {
        com.google.firestore.v1.StructuredQuery.UnaryFilter result =
            new com.google.firestore.v1.StructuredQuery.UnaryFilter(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        buildPartialOneofs(result);
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.UnaryFilter result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.op_ = op_;
        }
      }

      private void buildPartialOneofs(com.google.firestore.v1.StructuredQuery.UnaryFilter result) {
        result.operandTypeCase_ = operandTypeCase_;
        result.operandType_ = this.operandType_;
        if (operandTypeCase_ == 2 && fieldBuilder_ != null) {
          result.operandType_ = fieldBuilder_.build();
        }
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.UnaryFilter) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.UnaryFilter) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.UnaryFilter other) {
        if (other == com.google.firestore.v1.StructuredQuery.UnaryFilter.getDefaultInstance())
          return this;
        if (other.op_ != 0) {
          setOpValue(other.getOpValue());
        }
        switch (other.getOperandTypeCase()) {
          case FIELD:
            {
              mergeField(other.getField());
              break;
            }
          case OPERANDTYPE_NOT_SET:
            {
              break;
            }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 8:
                {
                  op_ = input.readEnum();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 8
              case 18:
                {
                  input.readMessage(internalGetFieldFieldBuilder().getBuilder(), extensionRegistry);
                  operandTypeCase_ = 2;
                  break;
                } // case 18
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int operandTypeCase_ = 0;
      private java.lang.Object operandType_;

      public OperandTypeCase getOperandTypeCase() {
        return OperandTypeCase.forNumber(operandTypeCase_);
      }

      public Builder clearOperandType() {
        operandTypeCase_ = 0;
        operandType_ = null;
        onChanged();
        return this;
      }

      private int bitField0_;

      private int op_ = 0;

      /**
       *
       *
       * <pre>
       * The unary operator to apply.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
       *
       * @return The enum numeric value on the wire for op.
       */
      @java.lang.Override
      public int getOpValue() {
        return op_;
      }

      /**
       *
       *
       * <pre>
       * The unary operator to apply.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
       *
       * @param value The enum numeric value on the wire for op to set.
       * @return This builder for chaining.
       */
      public Builder setOpValue(int value) {
        op_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The unary operator to apply.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
       *
       * @return The op.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator getOp() {
        com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator result =
            com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator.forNumber(op_);
        return result == null
            ? com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator.UNRECOGNIZED
            : result;
      }

      /**
       *
       *
       * <pre>
       * The unary operator to apply.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
       *
       * @param value The op to set.
       * @return This builder for chaining.
       */
      public Builder setOp(com.google.firestore.v1.StructuredQuery.UnaryFilter.Operator value) {
        if (value == null) {
          throw new NullPointerException();
        }
        bitField0_ |= 0x00000001;
        op_ = value.getNumber();
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The unary operator to apply.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.UnaryFilter.Operator op = 1;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearOp() {
        bitField0_ = (bitField0_ & ~0x00000001);
        op_ = 0;
        onChanged();
        return this;
      }

      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          fieldBuilder_;

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       *
       * @return Whether the field field is set.
       */
      @java.lang.Override
      public boolean hasField() {
        return operandTypeCase_ == 2;
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       *
       * @return The field.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldReference getField() {
        if (fieldBuilder_ == null) {
          if (operandTypeCase_ == 2) {
            return (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_;
          }
          return com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
        } else {
          if (operandTypeCase_ == 2) {
            return fieldBuilder_.getMessage();
          }
          return com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      public Builder setField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          operandType_ = value;
          onChanged();
        } else {
          fieldBuilder_.setMessage(value);
        }
        operandTypeCase_ = 2;
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      public Builder setField(
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (fieldBuilder_ == null) {
          operandType_ = builderForValue.build();
          onChanged();
        } else {
          fieldBuilder_.setMessage(builderForValue.build());
        }
        operandTypeCase_ = 2;
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      public Builder mergeField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldBuilder_ == null) {
          if (operandTypeCase_ == 2
              && operandType_
                  != com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()) {
            operandType_ =
                com.google.firestore.v1.StructuredQuery.FieldReference.newBuilder(
                        (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_)
                    .mergeFrom(value)
                    .buildPartial();
          } else {
            operandType_ = value;
          }
          onChanged();
        } else {
          if (operandTypeCase_ == 2) {
            fieldBuilder_.mergeFrom(value);
          } else {
            fieldBuilder_.setMessage(value);
          }
        }
        operandTypeCase_ = 2;
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      public Builder clearField() {
        if (fieldBuilder_ == null) {
          if (operandTypeCase_ == 2) {
            operandTypeCase_ = 0;
            operandType_ = null;
            onChanged();
          }
        } else {
          if (operandTypeCase_ == 2) {
            operandTypeCase_ = 0;
            operandType_ = null;
          }
          fieldBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder getFieldBuilder() {
        return internalGetFieldFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder() {
        if ((operandTypeCase_ == 2) && (fieldBuilder_ != null)) {
          return fieldBuilder_.getMessageOrBuilder();
        } else {
          if (operandTypeCase_ == 2) {
            return (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_;
          }
          return com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
        }
      }

      /**
       *
       *
       * <pre>
       * The field to which to apply the operator.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 2;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          internalGetFieldFieldBuilder() {
        if (fieldBuilder_ == null) {
          if (!(operandTypeCase_ == 2)) {
            operandType_ =
                com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
          }
          fieldBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.FieldReference,
                  com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
                  com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>(
                  (com.google.firestore.v1.StructuredQuery.FieldReference) operandType_,
                  getParentForChildren(),
                  isClean());
          operandType_ = null;
        }
        operandTypeCase_ = 2;
        onChanged();
        return fieldBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.UnaryFilter)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.UnaryFilter)
    private static final com.google.firestore.v1.StructuredQuery.UnaryFilter DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.UnaryFilter();
    }

    public static com.google.firestore.v1.StructuredQuery.UnaryFilter getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<UnaryFilter> PARSER =
        new com.google.protobuf.AbstractParser<UnaryFilter>() {
          @java.lang.Override
          public UnaryFilter parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<UnaryFilter> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<UnaryFilter> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.UnaryFilter getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface OrderOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.Order)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The field to order by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return Whether the field field is set.
     */
    boolean hasField();

    /**
     *
     *
     * <pre>
     * The field to order by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return The field.
     */
    com.google.firestore.v1.StructuredQuery.FieldReference getField();

    /**
     *
     *
     * <pre>
     * The field to order by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     */
    com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder();

    /**
     *
     *
     * <pre>
     * The direction to order by. Defaults to `ASCENDING`.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
     *
     * @return The enum numeric value on the wire for direction.
     */
    int getDirectionValue();

    /**
     *
     *
     * <pre>
     * The direction to order by. Defaults to `ASCENDING`.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
     *
     * @return The direction.
     */
    com.google.firestore.v1.StructuredQuery.Direction getDirection();
  }

  /**
   *
   *
   * <pre>
   * An order on a field.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.Order}
   */
  public static final class Order extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.Order)
      OrderOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "Order");
    }

    // Use Order.newBuilder() to construct.
    private Order(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private Order() {
      direction_ = 0;
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_Order_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_Order_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.Order.class,
              com.google.firestore.v1.StructuredQuery.Order.Builder.class);
    }

    private int bitField0_;
    public static final int FIELD_FIELD_NUMBER = 1;
    private com.google.firestore.v1.StructuredQuery.FieldReference field_;

    /**
     *
     *
     * <pre>
     * The field to order by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return Whether the field field is set.
     */
    @java.lang.Override
    public boolean hasField() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * The field to order by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     *
     * @return The field.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReference getField() {
      return field_ == null
          ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
          : field_;
    }

    /**
     *
     *
     * <pre>
     * The field to order by.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder() {
      return field_ == null
          ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
          : field_;
    }

    public static final int DIRECTION_FIELD_NUMBER = 2;
    private int direction_ = 0;

    /**
     *
     *
     * <pre>
     * The direction to order by. Defaults to `ASCENDING`.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
     *
     * @return The enum numeric value on the wire for direction.
     */
    @java.lang.Override
    public int getDirectionValue() {
      return direction_;
    }

    /**
     *
     *
     * <pre>
     * The direction to order by. Defaults to `ASCENDING`.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
     *
     * @return The direction.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.Direction getDirection() {
      com.google.firestore.v1.StructuredQuery.Direction result =
          com.google.firestore.v1.StructuredQuery.Direction.forNumber(direction_);
      return result == null
          ? com.google.firestore.v1.StructuredQuery.Direction.UNRECOGNIZED
          : result;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (((bitField0_ & 0x00000001) != 0)) {
        output.writeMessage(1, getField());
      }
      if (direction_
          != com.google.firestore.v1.StructuredQuery.Direction.DIRECTION_UNSPECIFIED.getNumber()) {
        output.writeEnum(2, direction_);
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getField());
      }
      if (direction_
          != com.google.firestore.v1.StructuredQuery.Direction.DIRECTION_UNSPECIFIED.getNumber()) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, direction_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.Order)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.Order other =
          (com.google.firestore.v1.StructuredQuery.Order) obj;

      if (hasField() != other.hasField()) return false;
      if (hasField()) {
        if (!getField().equals(other.getField())) return false;
      }
      if (direction_ != other.direction_) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      if (hasField()) {
        hash = (37 * hash) + FIELD_FIELD_NUMBER;
        hash = (53 * hash) + getField().hashCode();
      }
      hash = (37 * hash) + DIRECTION_FIELD_NUMBER;
      hash = (53 * hash) + direction_;
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Order parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(com.google.firestore.v1.StructuredQuery.Order prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * An order on a field.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.Order}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.Order)
        com.google.firestore.v1.StructuredQuery.OrderOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Order_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Order_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.Order.class,
                com.google.firestore.v1.StructuredQuery.Order.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.Order.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          internalGetFieldFieldBuilder();
        }
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        field_ = null;
        if (fieldBuilder_ != null) {
          fieldBuilder_.dispose();
          fieldBuilder_ = null;
        }
        direction_ = 0;
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Order_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Order getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.Order.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Order build() {
        com.google.firestore.v1.StructuredQuery.Order result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Order buildPartial() {
        com.google.firestore.v1.StructuredQuery.Order result =
            new com.google.firestore.v1.StructuredQuery.Order(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.Order result) {
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.field_ = fieldBuilder_ == null ? field_ : fieldBuilder_.build();
          to_bitField0_ |= 0x00000001;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.direction_ = direction_;
        }
        result.bitField0_ |= to_bitField0_;
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.Order) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.Order) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.Order other) {
        if (other == com.google.firestore.v1.StructuredQuery.Order.getDefaultInstance())
          return this;
        if (other.hasField()) {
          mergeField(other.getField());
        }
        if (other.direction_ != 0) {
          setDirectionValue(other.getDirectionValue());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  input.readMessage(internalGetFieldFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 16:
                {
                  direction_ = input.readEnum();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 16
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private com.google.firestore.v1.StructuredQuery.FieldReference field_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          fieldBuilder_;

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       *
       * @return Whether the field field is set.
       */
      public boolean hasField() {
        return ((bitField0_ & 0x00000001) != 0);
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       *
       * @return The field.
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference getField() {
        if (fieldBuilder_ == null) {
          return field_ == null
              ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
              : field_;
        } else {
          return fieldBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder setField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          field_ = value;
        } else {
          fieldBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder setField(
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (fieldBuilder_ == null) {
          field_ = builderForValue.build();
        } else {
          fieldBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder mergeField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)
              && field_ != null
              && field_
                  != com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()) {
            getFieldBuilder().mergeFrom(value);
          } else {
            field_ = value;
          }
        } else {
          fieldBuilder_.mergeFrom(value);
        }
        if (field_ != null) {
          bitField0_ |= 0x00000001;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public Builder clearField() {
        bitField0_ = (bitField0_ & ~0x00000001);
        field_ = null;
        if (fieldBuilder_ != null) {
          fieldBuilder_.dispose();
          fieldBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder getFieldBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return internalGetFieldFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldOrBuilder() {
        if (fieldBuilder_ != null) {
          return fieldBuilder_.getMessageOrBuilder();
        } else {
          return field_ == null
              ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
              : field_;
        }
      }

      /**
       *
       *
       * <pre>
       * The field to order by.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.FieldReference field = 1;</code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          internalGetFieldFieldBuilder() {
        if (fieldBuilder_ == null) {
          fieldBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.FieldReference,
                  com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
                  com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>(
                  getField(), getParentForChildren(), isClean());
          field_ = null;
        }
        return fieldBuilder_;
      }

      private int direction_ = 0;

      /**
       *
       *
       * <pre>
       * The direction to order by. Defaults to `ASCENDING`.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
       *
       * @return The enum numeric value on the wire for direction.
       */
      @java.lang.Override
      public int getDirectionValue() {
        return direction_;
      }

      /**
       *
       *
       * <pre>
       * The direction to order by. Defaults to `ASCENDING`.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
       *
       * @param value The enum numeric value on the wire for direction to set.
       * @return This builder for chaining.
       */
      public Builder setDirectionValue(int value) {
        direction_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The direction to order by. Defaults to `ASCENDING`.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
       *
       * @return The direction.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Direction getDirection() {
        com.google.firestore.v1.StructuredQuery.Direction result =
            com.google.firestore.v1.StructuredQuery.Direction.forNumber(direction_);
        return result == null
            ? com.google.firestore.v1.StructuredQuery.Direction.UNRECOGNIZED
            : result;
      }

      /**
       *
       *
       * <pre>
       * The direction to order by. Defaults to `ASCENDING`.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
       *
       * @param value The direction to set.
       * @return This builder for chaining.
       */
      public Builder setDirection(com.google.firestore.v1.StructuredQuery.Direction value) {
        if (value == null) {
          throw new NullPointerException();
        }
        bitField0_ |= 0x00000002;
        direction_ = value.getNumber();
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * The direction to order by. Defaults to `ASCENDING`.
       * </pre>
       *
       * <code>.google.firestore.v1.StructuredQuery.Direction direction = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearDirection() {
        bitField0_ = (bitField0_ & ~0x00000002);
        direction_ = 0;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.Order)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.Order)
    private static final com.google.firestore.v1.StructuredQuery.Order DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.Order();
    }

    public static com.google.firestore.v1.StructuredQuery.Order getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Order> PARSER =
        new com.google.protobuf.AbstractParser<Order>() {
          @java.lang.Override
          public Order parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<Order> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<Order> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.Order getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface FieldReferenceOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.FieldReference)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * A reference to a field in a document.
     *
     * Requires:
     *
     * * MUST be a dot-delimited (`.`) string of segments, where each segment
     * conforms to [document field name][google.firestore.v1.Document.fields]
     * limitations.
     * </pre>
     *
     * <code>string field_path = 2;</code>
     *
     * @return The fieldPath.
     */
    java.lang.String getFieldPath();

    /**
     *
     *
     * <pre>
     * A reference to a field in a document.
     *
     * Requires:
     *
     * * MUST be a dot-delimited (`.`) string of segments, where each segment
     * conforms to [document field name][google.firestore.v1.Document.fields]
     * limitations.
     * </pre>
     *
     * <code>string field_path = 2;</code>
     *
     * @return The bytes for fieldPath.
     */
    com.google.protobuf.ByteString getFieldPathBytes();
  }

  /**
   *
   *
   * <pre>
   * A reference to a field in a document, ex: `stats.operations`.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.FieldReference}
   */
  public static final class FieldReference extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.FieldReference)
      FieldReferenceOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "FieldReference");
    }

    // Use FieldReference.newBuilder() to construct.
    private FieldReference(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private FieldReference() {
      fieldPath_ = "";
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_FieldReference_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_FieldReference_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.FieldReference.class,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder.class);
    }

    public static final int FIELD_PATH_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private volatile java.lang.Object fieldPath_ = "";

    /**
     *
     *
     * <pre>
     * A reference to a field in a document.
     *
     * Requires:
     *
     * * MUST be a dot-delimited (`.`) string of segments, where each segment
     * conforms to [document field name][google.firestore.v1.Document.fields]
     * limitations.
     * </pre>
     *
     * <code>string field_path = 2;</code>
     *
     * @return The fieldPath.
     */
    @java.lang.Override
    public java.lang.String getFieldPath() {
      java.lang.Object ref = fieldPath_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        fieldPath_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * A reference to a field in a document.
     *
     * Requires:
     *
     * * MUST be a dot-delimited (`.`) string of segments, where each segment
     * conforms to [document field name][google.firestore.v1.Document.fields]
     * limitations.
     * </pre>
     *
     * <code>string field_path = 2;</code>
     *
     * @return The bytes for fieldPath.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getFieldPathBytes() {
      java.lang.Object ref = fieldPath_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        fieldPath_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(fieldPath_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 2, fieldPath_);
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(fieldPath_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(2, fieldPath_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.FieldReference)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.FieldReference other =
          (com.google.firestore.v1.StructuredQuery.FieldReference) obj;

      if (!getFieldPath().equals(other.getFieldPath())) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + FIELD_PATH_FIELD_NUMBER;
      hash = (53 * hash) + getFieldPath().hashCode();
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.firestore.v1.StructuredQuery.FieldReference prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * A reference to a field in a document, ex: `stats.operations`.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.FieldReference}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.FieldReference)
        com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FieldReference_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FieldReference_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.FieldReference.class,
                com.google.firestore.v1.StructuredQuery.FieldReference.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.FieldReference.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        fieldPath_ = "";
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FieldReference_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldReference getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldReference build() {
        com.google.firestore.v1.StructuredQuery.FieldReference result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FieldReference buildPartial() {
        com.google.firestore.v1.StructuredQuery.FieldReference result =
            new com.google.firestore.v1.StructuredQuery.FieldReference(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.FieldReference result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.fieldPath_ = fieldPath_;
        }
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.FieldReference) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.FieldReference) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.FieldReference other) {
        if (other == com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance())
          return this;
        if (!other.getFieldPath().isEmpty()) {
          fieldPath_ = other.fieldPath_;
          bitField0_ |= 0x00000001;
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 18:
                {
                  fieldPath_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 18
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private java.lang.Object fieldPath_ = "";

      /**
       *
       *
       * <pre>
       * A reference to a field in a document.
       *
       * Requires:
       *
       * * MUST be a dot-delimited (`.`) string of segments, where each segment
       * conforms to [document field name][google.firestore.v1.Document.fields]
       * limitations.
       * </pre>
       *
       * <code>string field_path = 2;</code>
       *
       * @return The fieldPath.
       */
      public java.lang.String getFieldPath() {
        java.lang.Object ref = fieldPath_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          fieldPath_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * A reference to a field in a document.
       *
       * Requires:
       *
       * * MUST be a dot-delimited (`.`) string of segments, where each segment
       * conforms to [document field name][google.firestore.v1.Document.fields]
       * limitations.
       * </pre>
       *
       * <code>string field_path = 2;</code>
       *
       * @return The bytes for fieldPath.
       */
      public com.google.protobuf.ByteString getFieldPathBytes() {
        java.lang.Object ref = fieldPath_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          fieldPath_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * A reference to a field in a document.
       *
       * Requires:
       *
       * * MUST be a dot-delimited (`.`) string of segments, where each segment
       * conforms to [document field name][google.firestore.v1.Document.fields]
       * limitations.
       * </pre>
       *
       * <code>string field_path = 2;</code>
       *
       * @param value The fieldPath to set.
       * @return This builder for chaining.
       */
      public Builder setFieldPath(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        fieldPath_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * A reference to a field in a document.
       *
       * Requires:
       *
       * * MUST be a dot-delimited (`.`) string of segments, where each segment
       * conforms to [document field name][google.firestore.v1.Document.fields]
       * limitations.
       * </pre>
       *
       * <code>string field_path = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearFieldPath() {
        fieldPath_ = getDefaultInstance().getFieldPath();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * A reference to a field in a document.
       *
       * Requires:
       *
       * * MUST be a dot-delimited (`.`) string of segments, where each segment
       * conforms to [document field name][google.firestore.v1.Document.fields]
       * limitations.
       * </pre>
       *
       * <code>string field_path = 2;</code>
       *
       * @param value The bytes for fieldPath to set.
       * @return This builder for chaining.
       */
      public Builder setFieldPathBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        fieldPath_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.FieldReference)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.FieldReference)
    private static final com.google.firestore.v1.StructuredQuery.FieldReference DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.FieldReference();
    }

    public static com.google.firestore.v1.StructuredQuery.FieldReference getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<FieldReference> PARSER =
        new com.google.protobuf.AbstractParser<FieldReference>() {
          @java.lang.Override
          public FieldReference parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<FieldReference> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<FieldReference> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReference getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface ProjectionOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.Projection)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    java.util.List<com.google.firestore.v1.StructuredQuery.FieldReference> getFieldsList();

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    com.google.firestore.v1.StructuredQuery.FieldReference getFields(int index);

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    int getFieldsCount();

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    java.util.List<? extends com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
        getFieldsOrBuilderList();

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldsOrBuilder(int index);
  }

  /**
   *
   *
   * <pre>
   * The projection of document's fields to return.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.Projection}
   */
  public static final class Projection extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.Projection)
      ProjectionOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "Projection");
    }

    // Use Projection.newBuilder() to construct.
    private Projection(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private Projection() {
      fields_ = java.util.Collections.emptyList();
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_Projection_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_Projection_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.Projection.class,
              com.google.firestore.v1.StructuredQuery.Projection.Builder.class);
    }

    public static final int FIELDS_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private java.util.List<com.google.firestore.v1.StructuredQuery.FieldReference> fields_;

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    @java.lang.Override
    public java.util.List<com.google.firestore.v1.StructuredQuery.FieldReference> getFieldsList() {
      return fields_;
    }

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    @java.lang.Override
    public java.util.List<? extends com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
        getFieldsOrBuilderList() {
      return fields_;
    }

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    @java.lang.Override
    public int getFieldsCount() {
      return fields_.size();
    }

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReference getFields(int index) {
      return fields_.get(index);
    }

    /**
     *
     *
     * <pre>
     * The fields to return.
     *
     * If empty, all fields are returned. To only return the name
     * of the document, use `['__name__']`.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldsOrBuilder(
        int index) {
      return fields_.get(index);
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      for (int i = 0; i < fields_.size(); i++) {
        output.writeMessage(2, fields_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      for (int i = 0; i < fields_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, fields_.get(i));
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.Projection)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.Projection other =
          (com.google.firestore.v1.StructuredQuery.Projection) obj;

      if (!getFieldsList().equals(other.getFieldsList())) return false;
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      if (getFieldsCount() > 0) {
        hash = (37 * hash) + FIELDS_FIELD_NUMBER;
        hash = (53 * hash) + getFieldsList().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.Projection parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(com.google.firestore.v1.StructuredQuery.Projection prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * The projection of document's fields to return.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.Projection}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.Projection)
        com.google.firestore.v1.StructuredQuery.ProjectionOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Projection_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Projection_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.Projection.class,
                com.google.firestore.v1.StructuredQuery.Projection.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.Projection.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        if (fieldsBuilder_ == null) {
          fields_ = java.util.Collections.emptyList();
        } else {
          fields_ = null;
          fieldsBuilder_.clear();
        }
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_Projection_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Projection getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Projection build() {
        com.google.firestore.v1.StructuredQuery.Projection result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.Projection buildPartial() {
        com.google.firestore.v1.StructuredQuery.Projection result =
            new com.google.firestore.v1.StructuredQuery.Projection(this);
        buildPartialRepeatedFields(result);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartialRepeatedFields(
          com.google.firestore.v1.StructuredQuery.Projection result) {
        if (fieldsBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)) {
            fields_ = java.util.Collections.unmodifiableList(fields_);
            bitField0_ = (bitField0_ & ~0x00000001);
          }
          result.fields_ = fields_;
        } else {
          result.fields_ = fieldsBuilder_.build();
        }
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.Projection result) {
        int from_bitField0_ = bitField0_;
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.Projection) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.Projection) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.Projection other) {
        if (other == com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance())
          return this;
        if (fieldsBuilder_ == null) {
          if (!other.fields_.isEmpty()) {
            if (fields_.isEmpty()) {
              fields_ = other.fields_;
              bitField0_ = (bitField0_ & ~0x00000001);
            } else {
              ensureFieldsIsMutable();
              fields_.addAll(other.fields_);
            }
            onChanged();
          }
        } else {
          if (!other.fields_.isEmpty()) {
            if (fieldsBuilder_.isEmpty()) {
              fieldsBuilder_.dispose();
              fieldsBuilder_ = null;
              fields_ = other.fields_;
              bitField0_ = (bitField0_ & ~0x00000001);
              fieldsBuilder_ =
                  com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                      ? internalGetFieldsFieldBuilder()
                      : null;
            } else {
              fieldsBuilder_.addAllMessages(other.fields_);
            }
          }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 18:
                {
                  com.google.firestore.v1.StructuredQuery.FieldReference m =
                      input.readMessage(
                          com.google.firestore.v1.StructuredQuery.FieldReference.parser(),
                          extensionRegistry);
                  if (fieldsBuilder_ == null) {
                    ensureFieldsIsMutable();
                    fields_.add(m);
                  } else {
                    fieldsBuilder_.addMessage(m);
                  }
                  break;
                } // case 18
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private java.util.List<com.google.firestore.v1.StructuredQuery.FieldReference> fields_ =
          java.util.Collections.emptyList();

      private void ensureFieldsIsMutable() {
        if (!((bitField0_ & 0x00000001) != 0)) {
          fields_ =
              new java.util.ArrayList<com.google.firestore.v1.StructuredQuery.FieldReference>(
                  fields_);
          bitField0_ |= 0x00000001;
        }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          fieldsBuilder_;

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public java.util.List<com.google.firestore.v1.StructuredQuery.FieldReference>
          getFieldsList() {
        if (fieldsBuilder_ == null) {
          return java.util.Collections.unmodifiableList(fields_);
        } else {
          return fieldsBuilder_.getMessageList();
        }
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public int getFieldsCount() {
        if (fieldsBuilder_ == null) {
          return fields_.size();
        } else {
          return fieldsBuilder_.getCount();
        }
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference getFields(int index) {
        if (fieldsBuilder_ == null) {
          return fields_.get(index);
        } else {
          return fieldsBuilder_.getMessage(index);
        }
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder setFields(
          int index, com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureFieldsIsMutable();
          fields_.set(index, value);
          onChanged();
        } else {
          fieldsBuilder_.setMessage(index, value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder setFields(
          int index,
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (fieldsBuilder_ == null) {
          ensureFieldsIsMutable();
          fields_.set(index, builderForValue.build());
          onChanged();
        } else {
          fieldsBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder addFields(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureFieldsIsMutable();
          fields_.add(value);
          onChanged();
        } else {
          fieldsBuilder_.addMessage(value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder addFields(
          int index, com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (fieldsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureFieldsIsMutable();
          fields_.add(index, value);
          onChanged();
        } else {
          fieldsBuilder_.addMessage(index, value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder addFields(
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (fieldsBuilder_ == null) {
          ensureFieldsIsMutable();
          fields_.add(builderForValue.build());
          onChanged();
        } else {
          fieldsBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder addFields(
          int index,
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (fieldsBuilder_ == null) {
          ensureFieldsIsMutable();
          fields_.add(index, builderForValue.build());
          onChanged();
        } else {
          fieldsBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder addAllFields(
          java.lang.Iterable<? extends com.google.firestore.v1.StructuredQuery.FieldReference>
              values) {
        if (fieldsBuilder_ == null) {
          ensureFieldsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(values, fields_);
          onChanged();
        } else {
          fieldsBuilder_.addAllMessages(values);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder clearFields() {
        if (fieldsBuilder_ == null) {
          fields_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
        } else {
          fieldsBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public Builder removeFields(int index) {
        if (fieldsBuilder_ == null) {
          ensureFieldsIsMutable();
          fields_.remove(index);
          onChanged();
        } else {
          fieldsBuilder_.remove(index);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder getFieldsBuilder(
          int index) {
        return internalGetFieldsFieldBuilder().getBuilder(index);
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getFieldsOrBuilder(
          int index) {
        if (fieldsBuilder_ == null) {
          return fields_.get(index);
        } else {
          return fieldsBuilder_.getMessageOrBuilder(index);
        }
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public java.util.List<
              ? extends com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          getFieldsOrBuilderList() {
        if (fieldsBuilder_ != null) {
          return fieldsBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(fields_);
        }
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder addFieldsBuilder() {
        return internalGetFieldsFieldBuilder()
            .addBuilder(
                com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance());
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder addFieldsBuilder(
          int index) {
        return internalGetFieldsFieldBuilder()
            .addBuilder(
                index, com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance());
      }

      /**
       *
       *
       * <pre>
       * The fields to return.
       *
       * If empty, all fields are returned. To only return the name
       * of the document, use `['__name__']`.
       * </pre>
       *
       * <code>repeated .google.firestore.v1.StructuredQuery.FieldReference fields = 2;</code>
       */
      public java.util.List<com.google.firestore.v1.StructuredQuery.FieldReference.Builder>
          getFieldsBuilderList() {
        return internalGetFieldsFieldBuilder().getBuilderList();
      }

      private com.google.protobuf.RepeatedFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          internalGetFieldsFieldBuilder() {
        if (fieldsBuilder_ == null) {
          fieldsBuilder_ =
              new com.google.protobuf.RepeatedFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.FieldReference,
                  com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
                  com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>(
                  fields_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
          fields_ = null;
        }
        return fieldsBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.Projection)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.Projection)
    private static final com.google.firestore.v1.StructuredQuery.Projection DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.Projection();
    }

    public static com.google.firestore.v1.StructuredQuery.Projection getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Projection> PARSER =
        new com.google.protobuf.AbstractParser<Projection>() {
          @java.lang.Override
          public Projection parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<Projection> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<Projection> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.Projection getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface FindNearestOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.v1.StructuredQuery.FindNearest)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return Whether the vectorField field is set.
     */
    boolean hasVectorField();

    /**
     *
     *
     * <pre>
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The vectorField.
     */
    com.google.firestore.v1.StructuredQuery.FieldReference getVectorField();

    /**
     *
     *
     * <pre>
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder getVectorFieldOrBuilder();

    /**
     *
     *
     * <pre>
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     * </pre>
     *
     * <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return Whether the queryVector field is set.
     */
    boolean hasQueryVector();

    /**
     *
     *
     * <pre>
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     * </pre>
     *
     * <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The queryVector.
     */
    com.google.firestore.v1.Value getQueryVector();

    /**
     *
     *
     * <pre>
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     * </pre>
     *
     * <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    com.google.firestore.v1.ValueOrBuilder getQueryVectorOrBuilder();

    /**
     *
     *
     * <pre>
     * Required. The distance measure to use, required.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The enum numeric value on the wire for distanceMeasure.
     */
    int getDistanceMeasureValue();

    /**
     *
     *
     * <pre>
     * Required. The distance measure to use, required.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The distanceMeasure.
     */
    com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure getDistanceMeasure();

    /**
     *
     *
     * <pre>
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return Whether the limit field is set.
     */
    boolean hasLimit();

    /**
     *
     *
     * <pre>
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The limit.
     */
    com.google.protobuf.Int32Value getLimit();

    /**
     *
     *
     * <pre>
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder();

    /**
     *
     *
     * <pre>
     * Optional. Optional name of the field to output the result of the vector
     * distance calculation. Must conform to [document field
     * name][google.firestore.v1.Document.fields] limitations.
     * </pre>
     *
     * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The distanceResultField.
     */
    java.lang.String getDistanceResultField();

    /**
     *
     *
     * <pre>
     * Optional. Optional name of the field to output the result of the vector
     * distance calculation. Must conform to [document field
     * name][google.firestore.v1.Document.fields] limitations.
     * </pre>
     *
     * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for distanceResultField.
     */
    com.google.protobuf.ByteString getDistanceResultFieldBytes();

    /**
     *
     *
     * <pre>
     * Optional. Option to specify a threshold for which no less similar
     * documents will be returned. The behavior of the specified
     * `distance_measure` will affect the meaning of the distance threshold.
     * Since DOT_PRODUCT distances increase when the vectors are more similar,
     * the comparison is inverted.
     *
     * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
     * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
     * </pre>
     *
     * <code>
     * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the distanceThreshold field is set.
     */
    boolean hasDistanceThreshold();

    /**
     *
     *
     * <pre>
     * Optional. Option to specify a threshold for which no less similar
     * documents will be returned. The behavior of the specified
     * `distance_measure` will affect the meaning of the distance threshold.
     * Since DOT_PRODUCT distances increase when the vectors are more similar,
     * the comparison is inverted.
     *
     * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
     * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
     * </pre>
     *
     * <code>
     * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The distanceThreshold.
     */
    com.google.protobuf.DoubleValue getDistanceThreshold();

    /**
     *
     *
     * <pre>
     * Optional. Option to specify a threshold for which no less similar
     * documents will be returned. The behavior of the specified
     * `distance_measure` will affect the meaning of the distance threshold.
     * Since DOT_PRODUCT distances increase when the vectors are more similar,
     * the comparison is inverted.
     *
     * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
     * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
     * </pre>
     *
     * <code>
     * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder();
  }

  /**
   *
   *
   * <pre>
   * Nearest Neighbors search config. The ordering provided by FindNearest
   * supersedes the order_by stage. If multiple documents have the same vector
   * distance, the returned document order is not guaranteed to be stable
   * between queries.
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery.FindNearest}
   */
  public static final class FindNearest extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.v1.StructuredQuery.FindNearest)
      FindNearestOrBuilder {
    private static final long serialVersionUID = 0L;

    static {
      com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
          com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
          /* major= */ 4,
          /* minor= */ 33,
          /* patch= */ 2,
          /* suffix= */ "",
          "FindNearest");
    }

    // Use FindNearest.newBuilder() to construct.
    private FindNearest(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
    }

    private FindNearest() {
      distanceMeasure_ = 0;
      distanceResultField_ = "";
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_FindNearest_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_FindNearest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.FindNearest.class,
              com.google.firestore.v1.StructuredQuery.FindNearest.Builder.class);
    }

    /**
     *
     *
     * <pre>
     * The distance measure to use when comparing vectors.
     * </pre>
     *
     * Protobuf enum {@code google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure}
     */
    public enum DistanceMeasure implements com.google.protobuf.ProtocolMessageEnum {
      /**
       *
       *
       * <pre>
       * Should not be set.
       * </pre>
       *
       * <code>DISTANCE_MEASURE_UNSPECIFIED = 0;</code>
       */
      DISTANCE_MEASURE_UNSPECIFIED(0),
      /**
       *
       *
       * <pre>
       * Measures the EUCLIDEAN distance between the vectors. See
       * [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
       * more. The resulting distance decreases the more similar two vectors
       * are.
       * </pre>
       *
       * <code>EUCLIDEAN = 1;</code>
       */
      EUCLIDEAN(1),
      /**
       *
       *
       * <pre>
       * COSINE distance compares vectors based on the angle between them, which
       * allows you to measure similarity that isn't based on the vectors
       * magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
       * instead of COSINE distance, which is mathematically equivalent with
       * better performance. See [Cosine
       * Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
       * more about COSINE similarity and COSINE distance. The resulting
       * COSINE distance decreases the more similar two vectors are.
       * </pre>
       *
       * <code>COSINE = 2;</code>
       */
      COSINE(2),
      /**
       *
       *
       * <pre>
       * Similar to cosine but is affected by the magnitude of the vectors. See
       * [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
       * The resulting distance increases the more similar two vectors are.
       * </pre>
       *
       * <code>DOT_PRODUCT = 3;</code>
       */
      DOT_PRODUCT(3),
      UNRECOGNIZED(-1),
      ;

      static {
        com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
            com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
            /* major= */ 4,
            /* minor= */ 33,
            /* patch= */ 2,
            /* suffix= */ "",
            "DistanceMeasure");
      }

      /**
       *
       *
       * <pre>
       * Should not be set.
       * </pre>
       *
       * <code>DISTANCE_MEASURE_UNSPECIFIED = 0;</code>
       */
      public static final int DISTANCE_MEASURE_UNSPECIFIED_VALUE = 0;

      /**
       *
       *
       * <pre>
       * Measures the EUCLIDEAN distance between the vectors. See
       * [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
       * more. The resulting distance decreases the more similar two vectors
       * are.
       * </pre>
       *
       * <code>EUCLIDEAN = 1;</code>
       */
      public static final int EUCLIDEAN_VALUE = 1;

      /**
       *
       *
       * <pre>
       * COSINE distance compares vectors based on the angle between them, which
       * allows you to measure similarity that isn't based on the vectors
       * magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
       * instead of COSINE distance, which is mathematically equivalent with
       * better performance. See [Cosine
       * Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
       * more about COSINE similarity and COSINE distance. The resulting
       * COSINE distance decreases the more similar two vectors are.
       * </pre>
       *
       * <code>COSINE = 2;</code>
       */
      public static final int COSINE_VALUE = 2;

      /**
       *
       *
       * <pre>
       * Similar to cosine but is affected by the magnitude of the vectors. See
       * [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
       * The resulting distance increases the more similar two vectors are.
       * </pre>
       *
       * <code>DOT_PRODUCT = 3;</code>
       */
      public static final int DOT_PRODUCT_VALUE = 3;

      public final int getNumber() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalArgumentException(
              "Can't get the number of an unknown enum value.");
        }
        return value;
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       * @deprecated Use {@link #forNumber(int)} instead.
       */
      @java.lang.Deprecated
      public static DistanceMeasure valueOf(int value) {
        return forNumber(value);
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value.
       */
      public static DistanceMeasure forNumber(int value) {
        switch (value) {
          case 0:
            return DISTANCE_MEASURE_UNSPECIFIED;
          case 1:
            return EUCLIDEAN;
          case 2:
            return COSINE;
          case 3:
            return DOT_PRODUCT;
          default:
            return null;
        }
      }

      public static com.google.protobuf.Internal.EnumLiteMap<DistanceMeasure>
          internalGetValueMap() {
        return internalValueMap;
      }

      private static final com.google.protobuf.Internal.EnumLiteMap<DistanceMeasure>
          internalValueMap =
              new com.google.protobuf.Internal.EnumLiteMap<DistanceMeasure>() {
                public DistanceMeasure findValueByNumber(int number) {
                  return DistanceMeasure.forNumber(number);
                }
              };

      public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
        if (this == UNRECOGNIZED) {
          throw new java.lang.IllegalStateException(
              "Can't get the descriptor of an unrecognized enum value.");
        }
        return getDescriptor().getValues().get(ordinal());
      }

      public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
        return getDescriptor();
      }

      public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
        return com.google.firestore.v1.StructuredQuery.FindNearest.getDescriptor()
            .getEnumTypes()
            .get(0);
      }

      private static final DistanceMeasure[] VALUES = values();

      public static DistanceMeasure valueOf(
          com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
        if (desc.getType() != getDescriptor()) {
          throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
        }
        if (desc.getIndex() == -1) {
          return UNRECOGNIZED;
        }
        return VALUES[desc.getIndex()];
      }

      private final int value;

      private DistanceMeasure(int value) {
        this.value = value;
      }

      // @@protoc_insertion_point(enum_scope:google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure)
    }

    private int bitField0_;
    public static final int VECTOR_FIELD_FIELD_NUMBER = 1;
    private com.google.firestore.v1.StructuredQuery.FieldReference vectorField_;

    /**
     *
     *
     * <pre>
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return Whether the vectorField field is set.
     */
    @java.lang.Override
    public boolean hasVectorField() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The vectorField.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReference getVectorField() {
      return vectorField_ == null
          ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
          : vectorField_;
    }

    /**
     *
     *
     * <pre>
     * Required. An indexed vector field to search upon. Only documents which
     * contain vectors whose dimensionality match the query_vector can be
     * returned.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder
        getVectorFieldOrBuilder() {
      return vectorField_ == null
          ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
          : vectorField_;
    }

    public static final int QUERY_VECTOR_FIELD_NUMBER = 2;
    private com.google.firestore.v1.Value queryVector_;

    /**
     *
     *
     * <pre>
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     * </pre>
     *
     * <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return Whether the queryVector field is set.
     */
    @java.lang.Override
    public boolean hasQueryVector() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     * </pre>
     *
     * <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The queryVector.
     */
    @java.lang.Override
    public com.google.firestore.v1.Value getQueryVector() {
      return queryVector_ == null
          ? com.google.firestore.v1.Value.getDefaultInstance()
          : queryVector_;
    }

    /**
     *
     *
     * <pre>
     * Required. The query vector that we are searching on. Must be a vector of
     * no more than 2048 dimensions.
     * </pre>
     *
     * <code>.google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    @java.lang.Override
    public com.google.firestore.v1.ValueOrBuilder getQueryVectorOrBuilder() {
      return queryVector_ == null
          ? com.google.firestore.v1.Value.getDefaultInstance()
          : queryVector_;
    }

    public static final int DISTANCE_MEASURE_FIELD_NUMBER = 3;
    private int distanceMeasure_ = 0;

    /**
     *
     *
     * <pre>
     * Required. The distance measure to use, required.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The enum numeric value on the wire for distanceMeasure.
     */
    @java.lang.Override
    public int getDistanceMeasureValue() {
      return distanceMeasure_;
    }

    /**
     *
     *
     * <pre>
     * Required. The distance measure to use, required.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The distanceMeasure.
     */
    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure
        getDistanceMeasure() {
      com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure result =
          com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure.forNumber(
              distanceMeasure_);
      return result == null
          ? com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure.UNRECOGNIZED
          : result;
    }

    public static final int LIMIT_FIELD_NUMBER = 4;
    private com.google.protobuf.Int32Value limit_;

    /**
     *
     *
     * <pre>
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return Whether the limit field is set.
     */
    @java.lang.Override
    public boolean hasLimit() {
      return ((bitField0_ & 0x00000004) != 0);
    }

    /**
     *
     *
     * <pre>
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The limit.
     */
    @java.lang.Override
    public com.google.protobuf.Int32Value getLimit() {
      return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
    }

    /**
     *
     *
     * <pre>
     * Required. The number of nearest neighbors to return. Must be a positive
     * integer of no more than 1000.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    @java.lang.Override
    public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
      return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
    }

    public static final int DISTANCE_RESULT_FIELD_FIELD_NUMBER = 5;

    @SuppressWarnings("serial")
    private volatile java.lang.Object distanceResultField_ = "";

    /**
     *
     *
     * <pre>
     * Optional. Optional name of the field to output the result of the vector
     * distance calculation. Must conform to [document field
     * name][google.firestore.v1.Document.fields] limitations.
     * </pre>
     *
     * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The distanceResultField.
     */
    @java.lang.Override
    public java.lang.String getDistanceResultField() {
      java.lang.Object ref = distanceResultField_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        distanceResultField_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Optional name of the field to output the result of the vector
     * distance calculation. Must conform to [document field
     * name][google.firestore.v1.Document.fields] limitations.
     * </pre>
     *
     * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for distanceResultField.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getDistanceResultFieldBytes() {
      java.lang.Object ref = distanceResultField_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        distanceResultField_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int DISTANCE_THRESHOLD_FIELD_NUMBER = 6;
    private com.google.protobuf.DoubleValue distanceThreshold_;

    /**
     *
     *
     * <pre>
     * Optional. Option to specify a threshold for which no less similar
     * documents will be returned. The behavior of the specified
     * `distance_measure` will affect the meaning of the distance threshold.
     * Since DOT_PRODUCT distances increase when the vectors are more similar,
     * the comparison is inverted.
     *
     * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
     * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
     * </pre>
     *
     * <code>
     * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the distanceThreshold field is set.
     */
    @java.lang.Override
    public boolean hasDistanceThreshold() {
      return ((bitField0_ & 0x00000008) != 0);
    }

    /**
     *
     *
     * <pre>
     * Optional. Option to specify a threshold for which no less similar
     * documents will be returned. The behavior of the specified
     * `distance_measure` will affect the meaning of the distance threshold.
     * Since DOT_PRODUCT distances increase when the vectors are more similar,
     * the comparison is inverted.
     *
     * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
     * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
     * </pre>
     *
     * <code>
     * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The distanceThreshold.
     */
    @java.lang.Override
    public com.google.protobuf.DoubleValue getDistanceThreshold() {
      return distanceThreshold_ == null
          ? com.google.protobuf.DoubleValue.getDefaultInstance()
          : distanceThreshold_;
    }

    /**
     *
     *
     * <pre>
     * Optional. Option to specify a threshold for which no less similar
     * documents will be returned. The behavior of the specified
     * `distance_measure` will affect the meaning of the distance threshold.
     * Since DOT_PRODUCT distances increase when the vectors are more similar,
     * the comparison is inverted.
     *
     * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
     * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
     * </pre>
     *
     * <code>
     * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder() {
      return distanceThreshold_ == null
          ? com.google.protobuf.DoubleValue.getDefaultInstance()
          : distanceThreshold_;
    }

    private byte memoizedIsInitialized = -1;

    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
      if (((bitField0_ & 0x00000001) != 0)) {
        output.writeMessage(1, getVectorField());
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        output.writeMessage(2, getQueryVector());
      }
      if (distanceMeasure_
          != com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure
              .DISTANCE_MEASURE_UNSPECIFIED
              .getNumber()) {
        output.writeEnum(3, distanceMeasure_);
      }
      if (((bitField0_ & 0x00000004) != 0)) {
        output.writeMessage(4, getLimit());
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(distanceResultField_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 5, distanceResultField_);
      }
      if (((bitField0_ & 0x00000008) != 0)) {
        output.writeMessage(6, getDistanceThreshold());
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getVectorField());
      }
      if (((bitField0_ & 0x00000002) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getQueryVector());
      }
      if (distanceMeasure_
          != com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure
              .DISTANCE_MEASURE_UNSPECIFIED
              .getNumber()) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, distanceMeasure_);
      }
      if (((bitField0_ & 0x00000004) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getLimit());
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(distanceResultField_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(5, distanceResultField_);
      }
      if (((bitField0_ & 0x00000008) != 0)) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getDistanceThreshold());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.firestore.v1.StructuredQuery.FindNearest)) {
        return super.equals(obj);
      }
      com.google.firestore.v1.StructuredQuery.FindNearest other =
          (com.google.firestore.v1.StructuredQuery.FindNearest) obj;

      if (hasVectorField() != other.hasVectorField()) return false;
      if (hasVectorField()) {
        if (!getVectorField().equals(other.getVectorField())) return false;
      }
      if (hasQueryVector() != other.hasQueryVector()) return false;
      if (hasQueryVector()) {
        if (!getQueryVector().equals(other.getQueryVector())) return false;
      }
      if (distanceMeasure_ != other.distanceMeasure_) return false;
      if (hasLimit() != other.hasLimit()) return false;
      if (hasLimit()) {
        if (!getLimit().equals(other.getLimit())) return false;
      }
      if (!getDistanceResultField().equals(other.getDistanceResultField())) return false;
      if (hasDistanceThreshold() != other.hasDistanceThreshold()) return false;
      if (hasDistanceThreshold()) {
        if (!getDistanceThreshold().equals(other.getDistanceThreshold())) return false;
      }
      if (!getUnknownFields().equals(other.getUnknownFields())) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      if (hasVectorField()) {
        hash = (37 * hash) + VECTOR_FIELD_FIELD_NUMBER;
        hash = (53 * hash) + getVectorField().hashCode();
      }
      if (hasQueryVector()) {
        hash = (37 * hash) + QUERY_VECTOR_FIELD_NUMBER;
        hash = (53 * hash) + getQueryVector().hashCode();
      }
      hash = (37 * hash) + DISTANCE_MEASURE_FIELD_NUMBER;
      hash = (53 * hash) + distanceMeasure_;
      if (hasLimit()) {
        hash = (37 * hash) + LIMIT_FIELD_NUMBER;
        hash = (53 * hash) + getLimit().hashCode();
      }
      hash = (37 * hash) + DISTANCE_RESULT_FIELD_FIELD_NUMBER;
      hash = (53 * hash) + getDistanceResultField().hashCode();
      if (hasDistanceThreshold()) {
        hash = (37 * hash) + DISTANCE_THRESHOLD_FIELD_NUMBER;
        hash = (53 * hash) + getDistanceThreshold().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() {
      return newBuilder();
    }

    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }

    public static Builder newBuilder(
        com.google.firestore.v1.StructuredQuery.FindNearest prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }

    /**
     *
     *
     * <pre>
     * Nearest Neighbors search config. The ordering provided by FindNearest
     * supersedes the order_by stage. If multiple documents have the same vector
     * distance, the returned document order is not guaranteed to be stable
     * between queries.
     * </pre>
     *
     * Protobuf type {@code google.firestore.v1.StructuredQuery.FindNearest}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery.FindNearest)
        com.google.firestore.v1.StructuredQuery.FindNearestOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FindNearest_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FindNearest_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.v1.StructuredQuery.FindNearest.class,
                com.google.firestore.v1.StructuredQuery.FindNearest.Builder.class);
      }

      // Construct using com.google.firestore.v1.StructuredQuery.FindNearest.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          internalGetVectorFieldFieldBuilder();
          internalGetQueryVectorFieldBuilder();
          internalGetLimitFieldBuilder();
          internalGetDistanceThresholdFieldBuilder();
        }
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        vectorField_ = null;
        if (vectorFieldBuilder_ != null) {
          vectorFieldBuilder_.dispose();
          vectorFieldBuilder_ = null;
        }
        queryVector_ = null;
        if (queryVectorBuilder_ != null) {
          queryVectorBuilder_.dispose();
          queryVectorBuilder_ = null;
        }
        distanceMeasure_ = 0;
        limit_ = null;
        if (limitBuilder_ != null) {
          limitBuilder_.dispose();
          limitBuilder_ = null;
        }
        distanceResultField_ = "";
        distanceThreshold_ = null;
        if (distanceThresholdBuilder_ != null) {
          distanceThresholdBuilder_.dispose();
          distanceThresholdBuilder_ = null;
        }
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.firestore.v1.QueryProto
            .internal_static_google_firestore_v1_StructuredQuery_FindNearest_descriptor;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FindNearest getDefaultInstanceForType() {
        return com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FindNearest build() {
        com.google.firestore.v1.StructuredQuery.FindNearest result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FindNearest buildPartial() {
        com.google.firestore.v1.StructuredQuery.FindNearest result =
            new com.google.firestore.v1.StructuredQuery.FindNearest(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.firestore.v1.StructuredQuery.FindNearest result) {
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.vectorField_ =
              vectorFieldBuilder_ == null ? vectorField_ : vectorFieldBuilder_.build();
          to_bitField0_ |= 0x00000001;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.queryVector_ =
              queryVectorBuilder_ == null ? queryVector_ : queryVectorBuilder_.build();
          to_bitField0_ |= 0x00000002;
        }
        if (((from_bitField0_ & 0x00000004) != 0)) {
          result.distanceMeasure_ = distanceMeasure_;
        }
        if (((from_bitField0_ & 0x00000008) != 0)) {
          result.limit_ = limitBuilder_ == null ? limit_ : limitBuilder_.build();
          to_bitField0_ |= 0x00000004;
        }
        if (((from_bitField0_ & 0x00000010) != 0)) {
          result.distanceResultField_ = distanceResultField_;
        }
        if (((from_bitField0_ & 0x00000020) != 0)) {
          result.distanceThreshold_ =
              distanceThresholdBuilder_ == null
                  ? distanceThreshold_
                  : distanceThresholdBuilder_.build();
          to_bitField0_ |= 0x00000008;
        }
        result.bitField0_ |= to_bitField0_;
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.firestore.v1.StructuredQuery.FindNearest) {
          return mergeFrom((com.google.firestore.v1.StructuredQuery.FindNearest) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.firestore.v1.StructuredQuery.FindNearest other) {
        if (other == com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance())
          return this;
        if (other.hasVectorField()) {
          mergeVectorField(other.getVectorField());
        }
        if (other.hasQueryVector()) {
          mergeQueryVector(other.getQueryVector());
        }
        if (other.distanceMeasure_ != 0) {
          setDistanceMeasureValue(other.getDistanceMeasureValue());
        }
        if (other.hasLimit()) {
          mergeLimit(other.getLimit());
        }
        if (!other.getDistanceResultField().isEmpty()) {
          distanceResultField_ = other.distanceResultField_;
          bitField0_ |= 0x00000010;
          onChanged();
        }
        if (other.hasDistanceThreshold()) {
          mergeDistanceThreshold(other.getDistanceThreshold());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  input.readMessage(
                      internalGetVectorFieldFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 18:
                {
                  input.readMessage(
                      internalGetQueryVectorFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000002;
                  break;
                } // case 18
              case 24:
                {
                  distanceMeasure_ = input.readEnum();
                  bitField0_ |= 0x00000004;
                  break;
                } // case 24
              case 34:
                {
                  input.readMessage(internalGetLimitFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000008;
                  break;
                } // case 34
              case 42:
                {
                  distanceResultField_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000010;
                  break;
                } // case 42
              case 50:
                {
                  input.readMessage(
                      internalGetDistanceThresholdFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000020;
                  break;
                } // case 50
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private com.google.firestore.v1.StructuredQuery.FieldReference vectorField_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          vectorFieldBuilder_;

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return Whether the vectorField field is set.
       */
      public boolean hasVectorField() {
        return ((bitField0_ & 0x00000001) != 0);
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return The vectorField.
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference getVectorField() {
        if (vectorFieldBuilder_ == null) {
          return vectorField_ == null
              ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
              : vectorField_;
        } else {
          return vectorFieldBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder setVectorField(com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (vectorFieldBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          vectorField_ = value;
        } else {
          vectorFieldBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder setVectorField(
          com.google.firestore.v1.StructuredQuery.FieldReference.Builder builderForValue) {
        if (vectorFieldBuilder_ == null) {
          vectorField_ = builderForValue.build();
        } else {
          vectorFieldBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder mergeVectorField(
          com.google.firestore.v1.StructuredQuery.FieldReference value) {
        if (vectorFieldBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)
              && vectorField_ != null
              && vectorField_
                  != com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()) {
            getVectorFieldBuilder().mergeFrom(value);
          } else {
            vectorField_ = value;
          }
        } else {
          vectorFieldBuilder_.mergeFrom(value);
        }
        if (vectorField_ != null) {
          bitField0_ |= 0x00000001;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder clearVectorField() {
        bitField0_ = (bitField0_ & ~0x00000001);
        vectorField_ = null;
        if (vectorFieldBuilder_ != null) {
          vectorFieldBuilder_.dispose();
          vectorFieldBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReference.Builder
          getVectorFieldBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return internalGetVectorFieldFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder
          getVectorFieldOrBuilder() {
        if (vectorFieldBuilder_ != null) {
          return vectorFieldBuilder_.getMessageOrBuilder();
        } else {
          return vectorField_ == null
              ? com.google.firestore.v1.StructuredQuery.FieldReference.getDefaultInstance()
              : vectorField_;
        }
      }

      /**
       *
       *
       * <pre>
       * Required. An indexed vector field to search upon. Only documents which
       * contain vectors whose dimensionality match the query_vector can be
       * returned.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FieldReference vector_field = 1 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.StructuredQuery.FieldReference,
              com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
              com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>
          internalGetVectorFieldFieldBuilder() {
        if (vectorFieldBuilder_ == null) {
          vectorFieldBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.StructuredQuery.FieldReference,
                  com.google.firestore.v1.StructuredQuery.FieldReference.Builder,
                  com.google.firestore.v1.StructuredQuery.FieldReferenceOrBuilder>(
                  getVectorField(), getParentForChildren(), isClean());
          vectorField_ = null;
        }
        return vectorFieldBuilder_;
      }

      private com.google.firestore.v1.Value queryVector_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.Value,
              com.google.firestore.v1.Value.Builder,
              com.google.firestore.v1.ValueOrBuilder>
          queryVectorBuilder_;

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return Whether the queryVector field is set.
       */
      public boolean hasQueryVector() {
        return ((bitField0_ & 0x00000002) != 0);
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return The queryVector.
       */
      public com.google.firestore.v1.Value getQueryVector() {
        if (queryVectorBuilder_ == null) {
          return queryVector_ == null
              ? com.google.firestore.v1.Value.getDefaultInstance()
              : queryVector_;
        } else {
          return queryVectorBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder setQueryVector(com.google.firestore.v1.Value value) {
        if (queryVectorBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          queryVector_ = value;
        } else {
          queryVectorBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder setQueryVector(com.google.firestore.v1.Value.Builder builderForValue) {
        if (queryVectorBuilder_ == null) {
          queryVector_ = builderForValue.build();
        } else {
          queryVectorBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder mergeQueryVector(com.google.firestore.v1.Value value) {
        if (queryVectorBuilder_ == null) {
          if (((bitField0_ & 0x00000002) != 0)
              && queryVector_ != null
              && queryVector_ != com.google.firestore.v1.Value.getDefaultInstance()) {
            getQueryVectorBuilder().mergeFrom(value);
          } else {
            queryVector_ = value;
          }
        } else {
          queryVectorBuilder_.mergeFrom(value);
        }
        if (queryVector_ != null) {
          bitField0_ |= 0x00000002;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder clearQueryVector() {
        bitField0_ = (bitField0_ & ~0x00000002);
        queryVector_ = null;
        if (queryVectorBuilder_ != null) {
          queryVectorBuilder_.dispose();
          queryVectorBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public com.google.firestore.v1.Value.Builder getQueryVectorBuilder() {
        bitField0_ |= 0x00000002;
        onChanged();
        return internalGetQueryVectorFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public com.google.firestore.v1.ValueOrBuilder getQueryVectorOrBuilder() {
        if (queryVectorBuilder_ != null) {
          return queryVectorBuilder_.getMessageOrBuilder();
        } else {
          return queryVector_ == null
              ? com.google.firestore.v1.Value.getDefaultInstance()
              : queryVector_;
        }
      }

      /**
       *
       *
       * <pre>
       * Required. The query vector that we are searching on. Must be a vector of
       * no more than 2048 dimensions.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.Value query_vector = 2 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.firestore.v1.Value,
              com.google.firestore.v1.Value.Builder,
              com.google.firestore.v1.ValueOrBuilder>
          internalGetQueryVectorFieldBuilder() {
        if (queryVectorBuilder_ == null) {
          queryVectorBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.firestore.v1.Value,
                  com.google.firestore.v1.Value.Builder,
                  com.google.firestore.v1.ValueOrBuilder>(
                  getQueryVector(), getParentForChildren(), isClean());
          queryVector_ = null;
        }
        return queryVectorBuilder_;
      }

      private int distanceMeasure_ = 0;

      /**
       *
       *
       * <pre>
       * Required. The distance measure to use, required.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return The enum numeric value on the wire for distanceMeasure.
       */
      @java.lang.Override
      public int getDistanceMeasureValue() {
        return distanceMeasure_;
      }

      /**
       *
       *
       * <pre>
       * Required. The distance measure to use, required.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @param value The enum numeric value on the wire for distanceMeasure to set.
       * @return This builder for chaining.
       */
      public Builder setDistanceMeasureValue(int value) {
        distanceMeasure_ = value;
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The distance measure to use, required.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return The distanceMeasure.
       */
      @java.lang.Override
      public com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure
          getDistanceMeasure() {
        com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure result =
            com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure.forNumber(
                distanceMeasure_);
        return result == null
            ? com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure.UNRECOGNIZED
            : result;
      }

      /**
       *
       *
       * <pre>
       * Required. The distance measure to use, required.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @param value The distanceMeasure to set.
       * @return This builder for chaining.
       */
      public Builder setDistanceMeasure(
          com.google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure value) {
        if (value == null) {
          throw new NullPointerException();
        }
        bitField0_ |= 0x00000004;
        distanceMeasure_ = value.getNumber();
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The distance measure to use, required.
       * </pre>
       *
       * <code>
       * .google.firestore.v1.StructuredQuery.FindNearest.DistanceMeasure distance_measure = 3 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return This builder for chaining.
       */
      public Builder clearDistanceMeasure() {
        bitField0_ = (bitField0_ & ~0x00000004);
        distanceMeasure_ = 0;
        onChanged();
        return this;
      }

      private com.google.protobuf.Int32Value limit_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.protobuf.Int32Value,
              com.google.protobuf.Int32Value.Builder,
              com.google.protobuf.Int32ValueOrBuilder>
          limitBuilder_;

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return Whether the limit field is set.
       */
      public boolean hasLimit() {
        return ((bitField0_ & 0x00000008) != 0);
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       *
       * @return The limit.
       */
      public com.google.protobuf.Int32Value getLimit() {
        if (limitBuilder_ == null) {
          return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
        } else {
          return limitBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder setLimit(com.google.protobuf.Int32Value value) {
        if (limitBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          limit_ = value;
        } else {
          limitBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000008;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder setLimit(com.google.protobuf.Int32Value.Builder builderForValue) {
        if (limitBuilder_ == null) {
          limit_ = builderForValue.build();
        } else {
          limitBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000008;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder mergeLimit(com.google.protobuf.Int32Value value) {
        if (limitBuilder_ == null) {
          if (((bitField0_ & 0x00000008) != 0)
              && limit_ != null
              && limit_ != com.google.protobuf.Int32Value.getDefaultInstance()) {
            getLimitBuilder().mergeFrom(value);
          } else {
            limit_ = value;
          }
        } else {
          limitBuilder_.mergeFrom(value);
        }
        if (limit_ != null) {
          bitField0_ |= 0x00000008;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public Builder clearLimit() {
        bitField0_ = (bitField0_ & ~0x00000008);
        limit_ = null;
        if (limitBuilder_ != null) {
          limitBuilder_.dispose();
          limitBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public com.google.protobuf.Int32Value.Builder getLimitBuilder() {
        bitField0_ |= 0x00000008;
        onChanged();
        return internalGetLimitFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
        if (limitBuilder_ != null) {
          return limitBuilder_.getMessageOrBuilder();
        } else {
          return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
        }
      }

      /**
       *
       *
       * <pre>
       * Required. The number of nearest neighbors to return. Must be a positive
       * integer of no more than 1000.
       * </pre>
       *
       * <code>.google.protobuf.Int32Value limit = 4 [(.google.api.field_behavior) = REQUIRED];
       * </code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.protobuf.Int32Value,
              com.google.protobuf.Int32Value.Builder,
              com.google.protobuf.Int32ValueOrBuilder>
          internalGetLimitFieldBuilder() {
        if (limitBuilder_ == null) {
          limitBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.protobuf.Int32Value,
                  com.google.protobuf.Int32Value.Builder,
                  com.google.protobuf.Int32ValueOrBuilder>(
                  getLimit(), getParentForChildren(), isClean());
          limit_ = null;
        }
        return limitBuilder_;
      }

      private java.lang.Object distanceResultField_ = "";

      /**
       *
       *
       * <pre>
       * Optional. Optional name of the field to output the result of the vector
       * distance calculation. Must conform to [document field
       * name][google.firestore.v1.Document.fields] limitations.
       * </pre>
       *
       * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
       *
       * @return The distanceResultField.
       */
      public java.lang.String getDistanceResultField() {
        java.lang.Object ref = distanceResultField_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          distanceResultField_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * Optional. Optional name of the field to output the result of the vector
       * distance calculation. Must conform to [document field
       * name][google.firestore.v1.Document.fields] limitations.
       * </pre>
       *
       * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
       *
       * @return The bytes for distanceResultField.
       */
      public com.google.protobuf.ByteString getDistanceResultFieldBytes() {
        java.lang.Object ref = distanceResultField_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          distanceResultField_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * Optional. Optional name of the field to output the result of the vector
       * distance calculation. Must conform to [document field
       * name][google.firestore.v1.Document.fields] limitations.
       * </pre>
       *
       * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
       *
       * @param value The distanceResultField to set.
       * @return This builder for chaining.
       */
      public Builder setDistanceResultField(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        distanceResultField_ = value;
        bitField0_ |= 0x00000010;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. Optional name of the field to output the result of the vector
       * distance calculation. Must conform to [document field
       * name][google.firestore.v1.Document.fields] limitations.
       * </pre>
       *
       * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearDistanceResultField() {
        distanceResultField_ = getDefaultInstance().getDistanceResultField();
        bitField0_ = (bitField0_ & ~0x00000010);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. Optional name of the field to output the result of the vector
       * distance calculation. Must conform to [document field
       * name][google.firestore.v1.Document.fields] limitations.
       * </pre>
       *
       * <code>string distance_result_field = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
       *
       * @param value The bytes for distanceResultField to set.
       * @return This builder for chaining.
       */
      public Builder setDistanceResultFieldBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        distanceResultField_ = value;
        bitField0_ |= 0x00000010;
        onChanged();
        return this;
      }

      private com.google.protobuf.DoubleValue distanceThreshold_;
      private com.google.protobuf.SingleFieldBuilder<
              com.google.protobuf.DoubleValue,
              com.google.protobuf.DoubleValue.Builder,
              com.google.protobuf.DoubleValueOrBuilder>
          distanceThresholdBuilder_;

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       *
       * @return Whether the distanceThreshold field is set.
       */
      public boolean hasDistanceThreshold() {
        return ((bitField0_ & 0x00000020) != 0);
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       *
       * @return The distanceThreshold.
       */
      public com.google.protobuf.DoubleValue getDistanceThreshold() {
        if (distanceThresholdBuilder_ == null) {
          return distanceThreshold_ == null
              ? com.google.protobuf.DoubleValue.getDefaultInstance()
              : distanceThreshold_;
        } else {
          return distanceThresholdBuilder_.getMessage();
        }
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      public Builder setDistanceThreshold(com.google.protobuf.DoubleValue value) {
        if (distanceThresholdBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          distanceThreshold_ = value;
        } else {
          distanceThresholdBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000020;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      public Builder setDistanceThreshold(com.google.protobuf.DoubleValue.Builder builderForValue) {
        if (distanceThresholdBuilder_ == null) {
          distanceThreshold_ = builderForValue.build();
        } else {
          distanceThresholdBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000020;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      public Builder mergeDistanceThreshold(com.google.protobuf.DoubleValue value) {
        if (distanceThresholdBuilder_ == null) {
          if (((bitField0_ & 0x00000020) != 0)
              && distanceThreshold_ != null
              && distanceThreshold_ != com.google.protobuf.DoubleValue.getDefaultInstance()) {
            getDistanceThresholdBuilder().mergeFrom(value);
          } else {
            distanceThreshold_ = value;
          }
        } else {
          distanceThresholdBuilder_.mergeFrom(value);
        }
        if (distanceThreshold_ != null) {
          bitField0_ |= 0x00000020;
          onChanged();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      public Builder clearDistanceThreshold() {
        bitField0_ = (bitField0_ & ~0x00000020);
        distanceThreshold_ = null;
        if (distanceThresholdBuilder_ != null) {
          distanceThresholdBuilder_.dispose();
          distanceThresholdBuilder_ = null;
        }
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      public com.google.protobuf.DoubleValue.Builder getDistanceThresholdBuilder() {
        bitField0_ |= 0x00000020;
        onChanged();
        return internalGetDistanceThresholdFieldBuilder().getBuilder();
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      public com.google.protobuf.DoubleValueOrBuilder getDistanceThresholdOrBuilder() {
        if (distanceThresholdBuilder_ != null) {
          return distanceThresholdBuilder_.getMessageOrBuilder();
        } else {
          return distanceThreshold_ == null
              ? com.google.protobuf.DoubleValue.getDefaultInstance()
              : distanceThreshold_;
        }
      }

      /**
       *
       *
       * <pre>
       * Optional. Option to specify a threshold for which no less similar
       * documents will be returned. The behavior of the specified
       * `distance_measure` will affect the meaning of the distance threshold.
       * Since DOT_PRODUCT distances increase when the vectors are more similar,
       * the comparison is inverted.
       *
       * * For EUCLIDEAN, COSINE: `WHERE distance &lt;= distance_threshold`
       * * For DOT_PRODUCT:       `WHERE distance &gt;= distance_threshold`
       * </pre>
       *
       * <code>
       * .google.protobuf.DoubleValue distance_threshold = 6 [(.google.api.field_behavior) = OPTIONAL];
       * </code>
       */
      private com.google.protobuf.SingleFieldBuilder<
              com.google.protobuf.DoubleValue,
              com.google.protobuf.DoubleValue.Builder,
              com.google.protobuf.DoubleValueOrBuilder>
          internalGetDistanceThresholdFieldBuilder() {
        if (distanceThresholdBuilder_ == null) {
          distanceThresholdBuilder_ =
              new com.google.protobuf.SingleFieldBuilder<
                  com.google.protobuf.DoubleValue,
                  com.google.protobuf.DoubleValue.Builder,
                  com.google.protobuf.DoubleValueOrBuilder>(
                  getDistanceThreshold(), getParentForChildren(), isClean());
          distanceThreshold_ = null;
        }
        return distanceThresholdBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery.FindNearest)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery.FindNearest)
    private static final com.google.firestore.v1.StructuredQuery.FindNearest DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery.FindNearest();
    }

    public static com.google.firestore.v1.StructuredQuery.FindNearest getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<FindNearest> PARSER =
        new com.google.protobuf.AbstractParser<FindNearest>() {
          @java.lang.Override
          public FindNearest parsePartialFrom(
              com.google.protobuf.CodedInputStream input,
              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
            Builder builder = newBuilder();
            try {
              builder.mergeFrom(input, extensionRegistry);
            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
              throw e.setUnfinishedMessage(builder.buildPartial());
            } catch (com.google.protobuf.UninitializedMessageException e) {
              throw e.asInvalidProtocolBufferException()
                  .setUnfinishedMessage(builder.buildPartial());
            } catch (java.io.IOException e) {
              throw new com.google.protobuf.InvalidProtocolBufferException(e)
                  .setUnfinishedMessage(builder.buildPartial());
            }
            return builder.buildPartial();
          }
        };

    public static com.google.protobuf.Parser<FindNearest> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<FindNearest> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery.FindNearest getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  private int bitField0_;
  public static final int SELECT_FIELD_NUMBER = 1;
  private com.google.firestore.v1.StructuredQuery.Projection select_;

  /**
   *
   *
   * <pre>
   * Optional sub-set of the fields to return.
   *
   * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
   * documents returned from a query. When not set, assumes that the caller
   * wants all fields returned.
   * </pre>
   *
   * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
   *
   * @return Whether the select field is set.
   */
  @java.lang.Override
  public boolean hasSelect() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * Optional sub-set of the fields to return.
   *
   * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
   * documents returned from a query. When not set, assumes that the caller
   * wants all fields returned.
   * </pre>
   *
   * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
   *
   * @return The select.
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.Projection getSelect() {
    return select_ == null
        ? com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance()
        : select_;
  }

  /**
   *
   *
   * <pre>
   * Optional sub-set of the fields to return.
   *
   * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
   * documents returned from a query. When not set, assumes that the caller
   * wants all fields returned.
   * </pre>
   *
   * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.ProjectionOrBuilder getSelectOrBuilder() {
    return select_ == null
        ? com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance()
        : select_;
  }

  public static final int FROM_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private java.util.List<com.google.firestore.v1.StructuredQuery.CollectionSelector> from_;

  /**
   *
   *
   * <pre>
   * The collections to query.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.firestore.v1.StructuredQuery.CollectionSelector> getFromList() {
    return from_;
  }

  /**
   *
   *
   * <pre>
   * The collections to query.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
   */
  @java.lang.Override
  public java.util.List<
          ? extends com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder>
      getFromOrBuilderList() {
    return from_;
  }

  /**
   *
   *
   * <pre>
   * The collections to query.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
   */
  @java.lang.Override
  public int getFromCount() {
    return from_.size();
  }

  /**
   *
   *
   * <pre>
   * The collections to query.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.CollectionSelector getFrom(int index) {
    return from_.get(index);
  }

  /**
   *
   *
   * <pre>
   * The collections to query.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder getFromOrBuilder(
      int index) {
    return from_.get(index);
  }

  public static final int WHERE_FIELD_NUMBER = 3;
  private com.google.firestore.v1.StructuredQuery.Filter where_;

  /**
   *
   *
   * <pre>
   * The filter to apply.
   * </pre>
   *
   * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
   *
   * @return Whether the where field is set.
   */
  @java.lang.Override
  public boolean hasWhere() {
    return ((bitField0_ & 0x00000002) != 0);
  }

  /**
   *
   *
   * <pre>
   * The filter to apply.
   * </pre>
   *
   * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
   *
   * @return The where.
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.Filter getWhere() {
    return where_ == null
        ? com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance()
        : where_;
  }

  /**
   *
   *
   * <pre>
   * The filter to apply.
   * </pre>
   *
   * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.FilterOrBuilder getWhereOrBuilder() {
    return where_ == null
        ? com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance()
        : where_;
  }

  public static final int ORDER_BY_FIELD_NUMBER = 4;

  @SuppressWarnings("serial")
  private java.util.List<com.google.firestore.v1.StructuredQuery.Order> orderBy_;

  /**
   *
   *
   * <pre>
   * The order to apply to the query results.
   *
   * Firestore allows callers to provide a full ordering, a partial ordering, or
   * no ordering at all. In all cases, Firestore guarantees a stable ordering
   * through the following rules:
   *
   * * The `order_by` is required to reference all fields used with an
   * inequality filter.
   * * All fields that are required to be in the `order_by` but are not already
   * present are appended in lexicographical ordering of the field name.
   * * If an order on `__name__` is not specified, it is appended by default.
   *
   * Fields are appended with the same sort direction as the last order
   * specified, or 'ASCENDING' if no order was specified. For example:
   *
   * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
   * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
   * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
   * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.firestore.v1.StructuredQuery.Order> getOrderByList() {
    return orderBy_;
  }

  /**
   *
   *
   * <pre>
   * The order to apply to the query results.
   *
   * Firestore allows callers to provide a full ordering, a partial ordering, or
   * no ordering at all. In all cases, Firestore guarantees a stable ordering
   * through the following rules:
   *
   * * The `order_by` is required to reference all fields used with an
   * inequality filter.
   * * All fields that are required to be in the `order_by` but are not already
   * present are appended in lexicographical ordering of the field name.
   * * If an order on `__name__` is not specified, it is appended by default.
   *
   * Fields are appended with the same sort direction as the last order
   * specified, or 'ASCENDING' if no order was specified. For example:
   *
   * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
   * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
   * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
   * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.firestore.v1.StructuredQuery.OrderOrBuilder>
      getOrderByOrBuilderList() {
    return orderBy_;
  }

  /**
   *
   *
   * <pre>
   * The order to apply to the query results.
   *
   * Firestore allows callers to provide a full ordering, a partial ordering, or
   * no ordering at all. In all cases, Firestore guarantees a stable ordering
   * through the following rules:
   *
   * * The `order_by` is required to reference all fields used with an
   * inequality filter.
   * * All fields that are required to be in the `order_by` but are not already
   * present are appended in lexicographical ordering of the field name.
   * * If an order on `__name__` is not specified, it is appended by default.
   *
   * Fields are appended with the same sort direction as the last order
   * specified, or 'ASCENDING' if no order was specified. For example:
   *
   * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
   * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
   * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
   * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
   */
  @java.lang.Override
  public int getOrderByCount() {
    return orderBy_.size();
  }

  /**
   *
   *
   * <pre>
   * The order to apply to the query results.
   *
   * Firestore allows callers to provide a full ordering, a partial ordering, or
   * no ordering at all. In all cases, Firestore guarantees a stable ordering
   * through the following rules:
   *
   * * The `order_by` is required to reference all fields used with an
   * inequality filter.
   * * All fields that are required to be in the `order_by` but are not already
   * present are appended in lexicographical ordering of the field name.
   * * If an order on `__name__` is not specified, it is appended by default.
   *
   * Fields are appended with the same sort direction as the last order
   * specified, or 'ASCENDING' if no order was specified. For example:
   *
   * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
   * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
   * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
   * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.Order getOrderBy(int index) {
    return orderBy_.get(index);
  }

  /**
   *
   *
   * <pre>
   * The order to apply to the query results.
   *
   * Firestore allows callers to provide a full ordering, a partial ordering, or
   * no ordering at all. In all cases, Firestore guarantees a stable ordering
   * through the following rules:
   *
   * * The `order_by` is required to reference all fields used with an
   * inequality filter.
   * * All fields that are required to be in the `order_by` but are not already
   * present are appended in lexicographical ordering of the field name.
   * * If an order on `__name__` is not specified, it is appended by default.
   *
   * Fields are appended with the same sort direction as the last order
   * specified, or 'ASCENDING' if no order was specified. For example:
   *
   * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
   * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
   * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
   * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
   * </pre>
   *
   * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.OrderOrBuilder getOrderByOrBuilder(int index) {
    return orderBy_.get(index);
  }

  public static final int START_AT_FIELD_NUMBER = 7;
  private com.google.firestore.v1.Cursor startAt_;

  /**
   *
   *
   * <pre>
   * A potential prefix of a position in the result set to start the query at.
   *
   * The ordering of the result set is based on the `ORDER BY` clause of the
   * original query.
   *
   * ```
   * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
   * ```
   *
   * This query's results are ordered by `(b ASC, __name__ ASC)`.
   *
   * Cursors can reference either the full ordering or a prefix of the location,
   * though it cannot reference more fields than what are in the provided
   * `ORDER BY`.
   *
   * Continuing off the example above, attaching the following start cursors
   * will have varying impact:
   *
   * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
   * b &gt; 2 AND __name__ &gt; /k/123`.
   * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
   *
   * Unlike `OFFSET` which requires scanning over the first N results to skip,
   * a start cursor allows the query to begin at a logical position. This
   * position is not required to match an actual result, it will scan forward
   * from this position to find the next document.
   *
   * Requires:
   *
   * * The number of values cannot be greater than the number of fields
   * specified in the `ORDER BY` clause.
   * </pre>
   *
   * <code>.google.firestore.v1.Cursor start_at = 7;</code>
   *
   * @return Whether the startAt field is set.
   */
  @java.lang.Override
  public boolean hasStartAt() {
    return ((bitField0_ & 0x00000004) != 0);
  }

  /**
   *
   *
   * <pre>
   * A potential prefix of a position in the result set to start the query at.
   *
   * The ordering of the result set is based on the `ORDER BY` clause of the
   * original query.
   *
   * ```
   * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
   * ```
   *
   * This query's results are ordered by `(b ASC, __name__ ASC)`.
   *
   * Cursors can reference either the full ordering or a prefix of the location,
   * though it cannot reference more fields than what are in the provided
   * `ORDER BY`.
   *
   * Continuing off the example above, attaching the following start cursors
   * will have varying impact:
   *
   * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
   * b &gt; 2 AND __name__ &gt; /k/123`.
   * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
   *
   * Unlike `OFFSET` which requires scanning over the first N results to skip,
   * a start cursor allows the query to begin at a logical position. This
   * position is not required to match an actual result, it will scan forward
   * from this position to find the next document.
   *
   * Requires:
   *
   * * The number of values cannot be greater than the number of fields
   * specified in the `ORDER BY` clause.
   * </pre>
   *
   * <code>.google.firestore.v1.Cursor start_at = 7;</code>
   *
   * @return The startAt.
   */
  @java.lang.Override
  public com.google.firestore.v1.Cursor getStartAt() {
    return startAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : startAt_;
  }

  /**
   *
   *
   * <pre>
   * A potential prefix of a position in the result set to start the query at.
   *
   * The ordering of the result set is based on the `ORDER BY` clause of the
   * original query.
   *
   * ```
   * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
   * ```
   *
   * This query's results are ordered by `(b ASC, __name__ ASC)`.
   *
   * Cursors can reference either the full ordering or a prefix of the location,
   * though it cannot reference more fields than what are in the provided
   * `ORDER BY`.
   *
   * Continuing off the example above, attaching the following start cursors
   * will have varying impact:
   *
   * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
   * b &gt; 2 AND __name__ &gt; /k/123`.
   * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
   *
   * Unlike `OFFSET` which requires scanning over the first N results to skip,
   * a start cursor allows the query to begin at a logical position. This
   * position is not required to match an actual result, it will scan forward
   * from this position to find the next document.
   *
   * Requires:
   *
   * * The number of values cannot be greater than the number of fields
   * specified in the `ORDER BY` clause.
   * </pre>
   *
   * <code>.google.firestore.v1.Cursor start_at = 7;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.CursorOrBuilder getStartAtOrBuilder() {
    return startAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : startAt_;
  }

  public static final int END_AT_FIELD_NUMBER = 8;
  private com.google.firestore.v1.Cursor endAt_;

  /**
   *
   *
   * <pre>
   * A potential prefix of a position in the result set to end the query at.
   *
   * This is similar to `START_AT` but with it controlling the end position
   * rather than the start position.
   *
   * Requires:
   *
   * * The number of values cannot be greater than the number of fields
   * specified in the `ORDER BY` clause.
   * </pre>
   *
   * <code>.google.firestore.v1.Cursor end_at = 8;</code>
   *
   * @return Whether the endAt field is set.
   */
  @java.lang.Override
  public boolean hasEndAt() {
    return ((bitField0_ & 0x00000008) != 0);
  }

  /**
   *
   *
   * <pre>
   * A potential prefix of a position in the result set to end the query at.
   *
   * This is similar to `START_AT` but with it controlling the end position
   * rather than the start position.
   *
   * Requires:
   *
   * * The number of values cannot be greater than the number of fields
   * specified in the `ORDER BY` clause.
   * </pre>
   *
   * <code>.google.firestore.v1.Cursor end_at = 8;</code>
   *
   * @return The endAt.
   */
  @java.lang.Override
  public com.google.firestore.v1.Cursor getEndAt() {
    return endAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : endAt_;
  }

  /**
   *
   *
   * <pre>
   * A potential prefix of a position in the result set to end the query at.
   *
   * This is similar to `START_AT` but with it controlling the end position
   * rather than the start position.
   *
   * Requires:
   *
   * * The number of values cannot be greater than the number of fields
   * specified in the `ORDER BY` clause.
   * </pre>
   *
   * <code>.google.firestore.v1.Cursor end_at = 8;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.CursorOrBuilder getEndAtOrBuilder() {
    return endAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : endAt_;
  }

  public static final int OFFSET_FIELD_NUMBER = 6;
  private int offset_ = 0;

  /**
   *
   *
   * <pre>
   * The number of documents to skip before returning the first result.
   *
   * This applies after the constraints specified by the `WHERE`, `START AT`, &amp;
   * `END AT` but before the `LIMIT` clause.
   *
   * Requires:
   *
   * * The value must be greater than or equal to zero if specified.
   * </pre>
   *
   * <code>int32 offset = 6;</code>
   *
   * @return The offset.
   */
  @java.lang.Override
  public int getOffset() {
    return offset_;
  }

  public static final int LIMIT_FIELD_NUMBER = 5;
  private com.google.protobuf.Int32Value limit_;

  /**
   *
   *
   * <pre>
   * The maximum number of results to return.
   *
   * Applies after all other constraints.
   *
   * Requires:
   *
   * * The value must be greater than or equal to zero if specified.
   * </pre>
   *
   * <code>.google.protobuf.Int32Value limit = 5;</code>
   *
   * @return Whether the limit field is set.
   */
  @java.lang.Override
  public boolean hasLimit() {
    return ((bitField0_ & 0x00000010) != 0);
  }

  /**
   *
   *
   * <pre>
   * The maximum number of results to return.
   *
   * Applies after all other constraints.
   *
   * Requires:
   *
   * * The value must be greater than or equal to zero if specified.
   * </pre>
   *
   * <code>.google.protobuf.Int32Value limit = 5;</code>
   *
   * @return The limit.
   */
  @java.lang.Override
  public com.google.protobuf.Int32Value getLimit() {
    return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
  }

  /**
   *
   *
   * <pre>
   * The maximum number of results to return.
   *
   * Applies after all other constraints.
   *
   * Requires:
   *
   * * The value must be greater than or equal to zero if specified.
   * </pre>
   *
   * <code>.google.protobuf.Int32Value limit = 5;</code>
   */
  @java.lang.Override
  public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
    return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
  }

  public static final int FIND_NEAREST_FIELD_NUMBER = 9;
  private com.google.firestore.v1.StructuredQuery.FindNearest findNearest_;

  /**
   *
   *
   * <pre>
   * Optional. A potential nearest neighbors search.
   *
   * Applies after all other filters and ordering.
   *
   * Finds the closest vector embeddings to the given query vector.
   * </pre>
   *
   * <code>
   * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return Whether the findNearest field is set.
   */
  @java.lang.Override
  public boolean hasFindNearest() {
    return ((bitField0_ & 0x00000020) != 0);
  }

  /**
   *
   *
   * <pre>
   * Optional. A potential nearest neighbors search.
   *
   * Applies after all other filters and ordering.
   *
   * Finds the closest vector embeddings to the given query vector.
   * </pre>
   *
   * <code>
   * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The findNearest.
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.FindNearest getFindNearest() {
    return findNearest_ == null
        ? com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance()
        : findNearest_;
  }

  /**
   *
   *
   * <pre>
   * Optional. A potential nearest neighbors search.
   *
   * Applies after all other filters and ordering.
   *
   * Finds the closest vector embeddings to the given query vector.
   * </pre>
   *
   * <code>
   * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery.FindNearestOrBuilder getFindNearestOrBuilder() {
    return findNearest_ == null
        ? com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance()
        : findNearest_;
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(1, getSelect());
    }
    for (int i = 0; i < from_.size(); i++) {
      output.writeMessage(2, from_.get(i));
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeMessage(3, getWhere());
    }
    for (int i = 0; i < orderBy_.size(); i++) {
      output.writeMessage(4, orderBy_.get(i));
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      output.writeMessage(5, getLimit());
    }
    if (offset_ != 0) {
      output.writeInt32(6, offset_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      output.writeMessage(7, getStartAt());
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      output.writeMessage(8, getEndAt());
    }
    if (((bitField0_ & 0x00000020) != 0)) {
      output.writeMessage(9, getFindNearest());
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSelect());
    }
    for (int i = 0; i < from_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, from_.get(i));
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getWhere());
    }
    for (int i = 0; i < orderBy_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, orderBy_.get(i));
    }
    if (((bitField0_ & 0x00000010) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getLimit());
    }
    if (offset_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(6, offset_);
    }
    if (((bitField0_ & 0x00000004) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getStartAt());
    }
    if (((bitField0_ & 0x00000008) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getEndAt());
    }
    if (((bitField0_ & 0x00000020) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getFindNearest());
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.firestore.v1.StructuredQuery)) {
      return super.equals(obj);
    }
    com.google.firestore.v1.StructuredQuery other = (com.google.firestore.v1.StructuredQuery) obj;

    if (hasSelect() != other.hasSelect()) return false;
    if (hasSelect()) {
      if (!getSelect().equals(other.getSelect())) return false;
    }
    if (!getFromList().equals(other.getFromList())) return false;
    if (hasWhere() != other.hasWhere()) return false;
    if (hasWhere()) {
      if (!getWhere().equals(other.getWhere())) return false;
    }
    if (!getOrderByList().equals(other.getOrderByList())) return false;
    if (hasStartAt() != other.hasStartAt()) return false;
    if (hasStartAt()) {
      if (!getStartAt().equals(other.getStartAt())) return false;
    }
    if (hasEndAt() != other.hasEndAt()) return false;
    if (hasEndAt()) {
      if (!getEndAt().equals(other.getEndAt())) return false;
    }
    if (getOffset() != other.getOffset()) return false;
    if (hasLimit() != other.hasLimit()) return false;
    if (hasLimit()) {
      if (!getLimit().equals(other.getLimit())) return false;
    }
    if (hasFindNearest() != other.hasFindNearest()) return false;
    if (hasFindNearest()) {
      if (!getFindNearest().equals(other.getFindNearest())) return false;
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasSelect()) {
      hash = (37 * hash) + SELECT_FIELD_NUMBER;
      hash = (53 * hash) + getSelect().hashCode();
    }
    if (getFromCount() > 0) {
      hash = (37 * hash) + FROM_FIELD_NUMBER;
      hash = (53 * hash) + getFromList().hashCode();
    }
    if (hasWhere()) {
      hash = (37 * hash) + WHERE_FIELD_NUMBER;
      hash = (53 * hash) + getWhere().hashCode();
    }
    if (getOrderByCount() > 0) {
      hash = (37 * hash) + ORDER_BY_FIELD_NUMBER;
      hash = (53 * hash) + getOrderByList().hashCode();
    }
    if (hasStartAt()) {
      hash = (37 * hash) + START_AT_FIELD_NUMBER;
      hash = (53 * hash) + getStartAt().hashCode();
    }
    if (hasEndAt()) {
      hash = (37 * hash) + END_AT_FIELD_NUMBER;
      hash = (53 * hash) + getEndAt().hashCode();
    }
    hash = (37 * hash) + OFFSET_FIELD_NUMBER;
    hash = (53 * hash) + getOffset();
    if (hasLimit()) {
      hash = (37 * hash) + LIMIT_FIELD_NUMBER;
      hash = (53 * hash) + getLimit().hashCode();
    }
    if (hasFindNearest()) {
      hash = (37 * hash) + FIND_NEAREST_FIELD_NUMBER;
      hash = (53 * hash) + getFindNearest().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.firestore.v1.StructuredQuery parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.firestore.v1.StructuredQuery parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.firestore.v1.StructuredQuery parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.firestore.v1.StructuredQuery prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * A Firestore query.
   *
   * The query stages are executed in the following order:
   * 1. from
   * 2. where
   * 3. select
   * 4. order_by + start_at + end_at
   * 5. offset
   * 6. limit
   * 7. find_nearest
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.StructuredQuery}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.firestore.v1.StructuredQuery)
      com.google.firestore.v1.StructuredQueryOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.StructuredQuery.class,
              com.google.firestore.v1.StructuredQuery.Builder.class);
    }

    // Construct using com.google.firestore.v1.StructuredQuery.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        internalGetSelectFieldBuilder();
        internalGetFromFieldBuilder();
        internalGetWhereFieldBuilder();
        internalGetOrderByFieldBuilder();
        internalGetStartAtFieldBuilder();
        internalGetEndAtFieldBuilder();
        internalGetLimitFieldBuilder();
        internalGetFindNearestFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      select_ = null;
      if (selectBuilder_ != null) {
        selectBuilder_.dispose();
        selectBuilder_ = null;
      }
      if (fromBuilder_ == null) {
        from_ = java.util.Collections.emptyList();
      } else {
        from_ = null;
        fromBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      where_ = null;
      if (whereBuilder_ != null) {
        whereBuilder_.dispose();
        whereBuilder_ = null;
      }
      if (orderByBuilder_ == null) {
        orderBy_ = java.util.Collections.emptyList();
      } else {
        orderBy_ = null;
        orderByBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000008);
      startAt_ = null;
      if (startAtBuilder_ != null) {
        startAtBuilder_.dispose();
        startAtBuilder_ = null;
      }
      endAt_ = null;
      if (endAtBuilder_ != null) {
        endAtBuilder_.dispose();
        endAtBuilder_ = null;
      }
      offset_ = 0;
      limit_ = null;
      if (limitBuilder_ != null) {
        limitBuilder_.dispose();
        limitBuilder_ = null;
      }
      findNearest_ = null;
      if (findNearestBuilder_ != null) {
        findNearestBuilder_.dispose();
        findNearestBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.firestore.v1.QueryProto
          .internal_static_google_firestore_v1_StructuredQuery_descriptor;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery getDefaultInstanceForType() {
      return com.google.firestore.v1.StructuredQuery.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery build() {
      com.google.firestore.v1.StructuredQuery result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.firestore.v1.StructuredQuery buildPartial() {
      com.google.firestore.v1.StructuredQuery result =
          new com.google.firestore.v1.StructuredQuery(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(com.google.firestore.v1.StructuredQuery result) {
      if (fromBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          from_ = java.util.Collections.unmodifiableList(from_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.from_ = from_;
      } else {
        result.from_ = fromBuilder_.build();
      }
      if (orderByBuilder_ == null) {
        if (((bitField0_ & 0x00000008) != 0)) {
          orderBy_ = java.util.Collections.unmodifiableList(orderBy_);
          bitField0_ = (bitField0_ & ~0x00000008);
        }
        result.orderBy_ = orderBy_;
      } else {
        result.orderBy_ = orderByBuilder_.build();
      }
    }

    private void buildPartial0(com.google.firestore.v1.StructuredQuery result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.select_ = selectBuilder_ == null ? select_ : selectBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.where_ = whereBuilder_ == null ? where_ : whereBuilder_.build();
        to_bitField0_ |= 0x00000002;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.startAt_ = startAtBuilder_ == null ? startAt_ : startAtBuilder_.build();
        to_bitField0_ |= 0x00000004;
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.endAt_ = endAtBuilder_ == null ? endAt_ : endAtBuilder_.build();
        to_bitField0_ |= 0x00000008;
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.offset_ = offset_;
      }
      if (((from_bitField0_ & 0x00000080) != 0)) {
        result.limit_ = limitBuilder_ == null ? limit_ : limitBuilder_.build();
        to_bitField0_ |= 0x00000010;
      }
      if (((from_bitField0_ & 0x00000100) != 0)) {
        result.findNearest_ =
            findNearestBuilder_ == null ? findNearest_ : findNearestBuilder_.build();
        to_bitField0_ |= 0x00000020;
      }
      result.bitField0_ |= to_bitField0_;
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.firestore.v1.StructuredQuery) {
        return mergeFrom((com.google.firestore.v1.StructuredQuery) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.firestore.v1.StructuredQuery other) {
      if (other == com.google.firestore.v1.StructuredQuery.getDefaultInstance()) return this;
      if (other.hasSelect()) {
        mergeSelect(other.getSelect());
      }
      if (fromBuilder_ == null) {
        if (!other.from_.isEmpty()) {
          if (from_.isEmpty()) {
            from_ = other.from_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureFromIsMutable();
            from_.addAll(other.from_);
          }
          onChanged();
        }
      } else {
        if (!other.from_.isEmpty()) {
          if (fromBuilder_.isEmpty()) {
            fromBuilder_.dispose();
            fromBuilder_ = null;
            from_ = other.from_;
            bitField0_ = (bitField0_ & ~0x00000002);
            fromBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetFromFieldBuilder()
                    : null;
          } else {
            fromBuilder_.addAllMessages(other.from_);
          }
        }
      }
      if (other.hasWhere()) {
        mergeWhere(other.getWhere());
      }
      if (orderByBuilder_ == null) {
        if (!other.orderBy_.isEmpty()) {
          if (orderBy_.isEmpty()) {
            orderBy_ = other.orderBy_;
            bitField0_ = (bitField0_ & ~0x00000008);
          } else {
            ensureOrderByIsMutable();
            orderBy_.addAll(other.orderBy_);
          }
          onChanged();
        }
      } else {
        if (!other.orderBy_.isEmpty()) {
          if (orderByBuilder_.isEmpty()) {
            orderByBuilder_.dispose();
            orderByBuilder_ = null;
            orderBy_ = other.orderBy_;
            bitField0_ = (bitField0_ & ~0x00000008);
            orderByBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetOrderByFieldBuilder()
                    : null;
          } else {
            orderByBuilder_.addAllMessages(other.orderBy_);
          }
        }
      }
      if (other.hasStartAt()) {
        mergeStartAt(other.getStartAt());
      }
      if (other.hasEndAt()) {
        mergeEndAt(other.getEndAt());
      }
      if (other.getOffset() != 0) {
        setOffset(other.getOffset());
      }
      if (other.hasLimit()) {
        mergeLimit(other.getLimit());
      }
      if (other.hasFindNearest()) {
        mergeFindNearest(other.getFindNearest());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                input.readMessage(internalGetSelectFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                com.google.firestore.v1.StructuredQuery.CollectionSelector m =
                    input.readMessage(
                        com.google.firestore.v1.StructuredQuery.CollectionSelector.parser(),
                        extensionRegistry);
                if (fromBuilder_ == null) {
                  ensureFromIsMutable();
                  from_.add(m);
                } else {
                  fromBuilder_.addMessage(m);
                }
                break;
              } // case 18
            case 26:
              {
                input.readMessage(internalGetWhereFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000004;
                break;
              } // case 26
            case 34:
              {
                com.google.firestore.v1.StructuredQuery.Order m =
                    input.readMessage(
                        com.google.firestore.v1.StructuredQuery.Order.parser(), extensionRegistry);
                if (orderByBuilder_ == null) {
                  ensureOrderByIsMutable();
                  orderBy_.add(m);
                } else {
                  orderByBuilder_.addMessage(m);
                }
                break;
              } // case 34
            case 42:
              {
                input.readMessage(internalGetLimitFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000080;
                break;
              } // case 42
            case 48:
              {
                offset_ = input.readInt32();
                bitField0_ |= 0x00000040;
                break;
              } // case 48
            case 58:
              {
                input.readMessage(internalGetStartAtFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000010;
                break;
              } // case 58
            case 66:
              {
                input.readMessage(internalGetEndAtFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000020;
                break;
              } // case 66
            case 74:
              {
                input.readMessage(
                    internalGetFindNearestFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000100;
                break;
              } // case 74
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private com.google.firestore.v1.StructuredQuery.Projection select_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.StructuredQuery.Projection,
            com.google.firestore.v1.StructuredQuery.Projection.Builder,
            com.google.firestore.v1.StructuredQuery.ProjectionOrBuilder>
        selectBuilder_;

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     *
     * @return Whether the select field is set.
     */
    public boolean hasSelect() {
      return ((bitField0_ & 0x00000001) != 0);
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     *
     * @return The select.
     */
    public com.google.firestore.v1.StructuredQuery.Projection getSelect() {
      if (selectBuilder_ == null) {
        return select_ == null
            ? com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance()
            : select_;
      } else {
        return selectBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    public Builder setSelect(com.google.firestore.v1.StructuredQuery.Projection value) {
      if (selectBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        select_ = value;
      } else {
        selectBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    public Builder setSelect(
        com.google.firestore.v1.StructuredQuery.Projection.Builder builderForValue) {
      if (selectBuilder_ == null) {
        select_ = builderForValue.build();
      } else {
        selectBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    public Builder mergeSelect(com.google.firestore.v1.StructuredQuery.Projection value) {
      if (selectBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)
            && select_ != null
            && select_ != com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance()) {
          getSelectBuilder().mergeFrom(value);
        } else {
          select_ = value;
        }
      } else {
        selectBuilder_.mergeFrom(value);
      }
      if (select_ != null) {
        bitField0_ |= 0x00000001;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    public Builder clearSelect() {
      bitField0_ = (bitField0_ & ~0x00000001);
      select_ = null;
      if (selectBuilder_ != null) {
        selectBuilder_.dispose();
        selectBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    public com.google.firestore.v1.StructuredQuery.Projection.Builder getSelectBuilder() {
      bitField0_ |= 0x00000001;
      onChanged();
      return internalGetSelectFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    public com.google.firestore.v1.StructuredQuery.ProjectionOrBuilder getSelectOrBuilder() {
      if (selectBuilder_ != null) {
        return selectBuilder_.getMessageOrBuilder();
      } else {
        return select_ == null
            ? com.google.firestore.v1.StructuredQuery.Projection.getDefaultInstance()
            : select_;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional sub-set of the fields to return.
     *
     * This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
     * documents returned from a query. When not set, assumes that the caller
     * wants all fields returned.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Projection select = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.StructuredQuery.Projection,
            com.google.firestore.v1.StructuredQuery.Projection.Builder,
            com.google.firestore.v1.StructuredQuery.ProjectionOrBuilder>
        internalGetSelectFieldBuilder() {
      if (selectBuilder_ == null) {
        selectBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.v1.StructuredQuery.Projection,
                com.google.firestore.v1.StructuredQuery.Projection.Builder,
                com.google.firestore.v1.StructuredQuery.ProjectionOrBuilder>(
                getSelect(), getParentForChildren(), isClean());
        select_ = null;
      }
      return selectBuilder_;
    }

    private java.util.List<com.google.firestore.v1.StructuredQuery.CollectionSelector> from_ =
        java.util.Collections.emptyList();

    private void ensureFromIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        from_ =
            new java.util.ArrayList<com.google.firestore.v1.StructuredQuery.CollectionSelector>(
                from_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.firestore.v1.StructuredQuery.CollectionSelector,
            com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder,
            com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder>
        fromBuilder_;

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public java.util.List<com.google.firestore.v1.StructuredQuery.CollectionSelector>
        getFromList() {
      if (fromBuilder_ == null) {
        return java.util.Collections.unmodifiableList(from_);
      } else {
        return fromBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public int getFromCount() {
      if (fromBuilder_ == null) {
        return from_.size();
      } else {
        return fromBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public com.google.firestore.v1.StructuredQuery.CollectionSelector getFrom(int index) {
      if (fromBuilder_ == null) {
        return from_.get(index);
      } else {
        return fromBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder setFrom(
        int index, com.google.firestore.v1.StructuredQuery.CollectionSelector value) {
      if (fromBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureFromIsMutable();
        from_.set(index, value);
        onChanged();
      } else {
        fromBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder setFrom(
        int index,
        com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder builderForValue) {
      if (fromBuilder_ == null) {
        ensureFromIsMutable();
        from_.set(index, builderForValue.build());
        onChanged();
      } else {
        fromBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder addFrom(com.google.firestore.v1.StructuredQuery.CollectionSelector value) {
      if (fromBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureFromIsMutable();
        from_.add(value);
        onChanged();
      } else {
        fromBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder addFrom(
        int index, com.google.firestore.v1.StructuredQuery.CollectionSelector value) {
      if (fromBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureFromIsMutable();
        from_.add(index, value);
        onChanged();
      } else {
        fromBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder addFrom(
        com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder builderForValue) {
      if (fromBuilder_ == null) {
        ensureFromIsMutable();
        from_.add(builderForValue.build());
        onChanged();
      } else {
        fromBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder addFrom(
        int index,
        com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder builderForValue) {
      if (fromBuilder_ == null) {
        ensureFromIsMutable();
        from_.add(index, builderForValue.build());
        onChanged();
      } else {
        fromBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder addAllFrom(
        java.lang.Iterable<? extends com.google.firestore.v1.StructuredQuery.CollectionSelector>
            values) {
      if (fromBuilder_ == null) {
        ensureFromIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, from_);
        onChanged();
      } else {
        fromBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder clearFrom() {
      if (fromBuilder_ == null) {
        from_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        fromBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public Builder removeFrom(int index) {
      if (fromBuilder_ == null) {
        ensureFromIsMutable();
        from_.remove(index);
        onChanged();
      } else {
        fromBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder getFromBuilder(
        int index) {
      return internalGetFromFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder getFromOrBuilder(
        int index) {
      if (fromBuilder_ == null) {
        return from_.get(index);
      } else {
        return fromBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public java.util.List<
            ? extends com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder>
        getFromOrBuilderList() {
      if (fromBuilder_ != null) {
        return fromBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(from_);
      }
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder addFromBuilder() {
      return internalGetFromFieldBuilder()
          .addBuilder(
              com.google.firestore.v1.StructuredQuery.CollectionSelector.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder addFromBuilder(
        int index) {
      return internalGetFromFieldBuilder()
          .addBuilder(
              index,
              com.google.firestore.v1.StructuredQuery.CollectionSelector.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The collections to query.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.CollectionSelector from = 2;</code>
     */
    public java.util.List<com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder>
        getFromBuilderList() {
      return internalGetFromFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.firestore.v1.StructuredQuery.CollectionSelector,
            com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder,
            com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder>
        internalGetFromFieldBuilder() {
      if (fromBuilder_ == null) {
        fromBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.firestore.v1.StructuredQuery.CollectionSelector,
                com.google.firestore.v1.StructuredQuery.CollectionSelector.Builder,
                com.google.firestore.v1.StructuredQuery.CollectionSelectorOrBuilder>(
                from_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
        from_ = null;
      }
      return fromBuilder_;
    }

    private com.google.firestore.v1.StructuredQuery.Filter where_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.StructuredQuery.Filter,
            com.google.firestore.v1.StructuredQuery.Filter.Builder,
            com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
        whereBuilder_;

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     *
     * @return Whether the where field is set.
     */
    public boolean hasWhere() {
      return ((bitField0_ & 0x00000004) != 0);
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     *
     * @return The where.
     */
    public com.google.firestore.v1.StructuredQuery.Filter getWhere() {
      if (whereBuilder_ == null) {
        return where_ == null
            ? com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance()
            : where_;
      } else {
        return whereBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    public Builder setWhere(com.google.firestore.v1.StructuredQuery.Filter value) {
      if (whereBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        where_ = value;
      } else {
        whereBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    public Builder setWhere(
        com.google.firestore.v1.StructuredQuery.Filter.Builder builderForValue) {
      if (whereBuilder_ == null) {
        where_ = builderForValue.build();
      } else {
        whereBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    public Builder mergeWhere(com.google.firestore.v1.StructuredQuery.Filter value) {
      if (whereBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)
            && where_ != null
            && where_ != com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance()) {
          getWhereBuilder().mergeFrom(value);
        } else {
          where_ = value;
        }
      } else {
        whereBuilder_.mergeFrom(value);
      }
      if (where_ != null) {
        bitField0_ |= 0x00000004;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    public Builder clearWhere() {
      bitField0_ = (bitField0_ & ~0x00000004);
      where_ = null;
      if (whereBuilder_ != null) {
        whereBuilder_.dispose();
        whereBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    public com.google.firestore.v1.StructuredQuery.Filter.Builder getWhereBuilder() {
      bitField0_ |= 0x00000004;
      onChanged();
      return internalGetWhereFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    public com.google.firestore.v1.StructuredQuery.FilterOrBuilder getWhereOrBuilder() {
      if (whereBuilder_ != null) {
        return whereBuilder_.getMessageOrBuilder();
      } else {
        return where_ == null
            ? com.google.firestore.v1.StructuredQuery.Filter.getDefaultInstance()
            : where_;
      }
    }

    /**
     *
     *
     * <pre>
     * The filter to apply.
     * </pre>
     *
     * <code>.google.firestore.v1.StructuredQuery.Filter where = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.StructuredQuery.Filter,
            com.google.firestore.v1.StructuredQuery.Filter.Builder,
            com.google.firestore.v1.StructuredQuery.FilterOrBuilder>
        internalGetWhereFieldBuilder() {
      if (whereBuilder_ == null) {
        whereBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.v1.StructuredQuery.Filter,
                com.google.firestore.v1.StructuredQuery.Filter.Builder,
                com.google.firestore.v1.StructuredQuery.FilterOrBuilder>(
                getWhere(), getParentForChildren(), isClean());
        where_ = null;
      }
      return whereBuilder_;
    }

    private java.util.List<com.google.firestore.v1.StructuredQuery.Order> orderBy_ =
        java.util.Collections.emptyList();

    private void ensureOrderByIsMutable() {
      if (!((bitField0_ & 0x00000008) != 0)) {
        orderBy_ = new java.util.ArrayList<com.google.firestore.v1.StructuredQuery.Order>(orderBy_);
        bitField0_ |= 0x00000008;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.firestore.v1.StructuredQuery.Order,
            com.google.firestore.v1.StructuredQuery.Order.Builder,
            com.google.firestore.v1.StructuredQuery.OrderOrBuilder>
        orderByBuilder_;

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public java.util.List<com.google.firestore.v1.StructuredQuery.Order> getOrderByList() {
      if (orderByBuilder_ == null) {
        return java.util.Collections.unmodifiableList(orderBy_);
      } else {
        return orderByBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public int getOrderByCount() {
      if (orderByBuilder_ == null) {
        return orderBy_.size();
      } else {
        return orderByBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public com.google.firestore.v1.StructuredQuery.Order getOrderBy(int index) {
      if (orderByBuilder_ == null) {
        return orderBy_.get(index);
      } else {
        return orderByBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder setOrderBy(int index, com.google.firestore.v1.StructuredQuery.Order value) {
      if (orderByBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureOrderByIsMutable();
        orderBy_.set(index, value);
        onChanged();
      } else {
        orderByBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder setOrderBy(
        int index, com.google.firestore.v1.StructuredQuery.Order.Builder builderForValue) {
      if (orderByBuilder_ == null) {
        ensureOrderByIsMutable();
        orderBy_.set(index, builderForValue.build());
        onChanged();
      } else {
        orderByBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder addOrderBy(com.google.firestore.v1.StructuredQuery.Order value) {
      if (orderByBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureOrderByIsMutable();
        orderBy_.add(value);
        onChanged();
      } else {
        orderByBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder addOrderBy(int index, com.google.firestore.v1.StructuredQuery.Order value) {
      if (orderByBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureOrderByIsMutable();
        orderBy_.add(index, value);
        onChanged();
      } else {
        orderByBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder addOrderBy(
        com.google.firestore.v1.StructuredQuery.Order.Builder builderForValue) {
      if (orderByBuilder_ == null) {
        ensureOrderByIsMutable();
        orderBy_.add(builderForValue.build());
        onChanged();
      } else {
        orderByBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder addOrderBy(
        int index, com.google.firestore.v1.StructuredQuery.Order.Builder builderForValue) {
      if (orderByBuilder_ == null) {
        ensureOrderByIsMutable();
        orderBy_.add(index, builderForValue.build());
        onChanged();
      } else {
        orderByBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder addAllOrderBy(
        java.lang.Iterable<? extends com.google.firestore.v1.StructuredQuery.Order> values) {
      if (orderByBuilder_ == null) {
        ensureOrderByIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, orderBy_);
        onChanged();
      } else {
        orderByBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder clearOrderBy() {
      if (orderByBuilder_ == null) {
        orderBy_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000008);
        onChanged();
      } else {
        orderByBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public Builder removeOrderBy(int index) {
      if (orderByBuilder_ == null) {
        ensureOrderByIsMutable();
        orderBy_.remove(index);
        onChanged();
      } else {
        orderByBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public com.google.firestore.v1.StructuredQuery.Order.Builder getOrderByBuilder(int index) {
      return internalGetOrderByFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public com.google.firestore.v1.StructuredQuery.OrderOrBuilder getOrderByOrBuilder(int index) {
      if (orderByBuilder_ == null) {
        return orderBy_.get(index);
      } else {
        return orderByBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public java.util.List<? extends com.google.firestore.v1.StructuredQuery.OrderOrBuilder>
        getOrderByOrBuilderList() {
      if (orderByBuilder_ != null) {
        return orderByBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(orderBy_);
      }
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public com.google.firestore.v1.StructuredQuery.Order.Builder addOrderByBuilder() {
      return internalGetOrderByFieldBuilder()
          .addBuilder(com.google.firestore.v1.StructuredQuery.Order.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public com.google.firestore.v1.StructuredQuery.Order.Builder addOrderByBuilder(int index) {
      return internalGetOrderByFieldBuilder()
          .addBuilder(index, com.google.firestore.v1.StructuredQuery.Order.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The order to apply to the query results.
     *
     * Firestore allows callers to provide a full ordering, a partial ordering, or
     * no ordering at all. In all cases, Firestore guarantees a stable ordering
     * through the following rules:
     *
     * * The `order_by` is required to reference all fields used with an
     * inequality filter.
     * * All fields that are required to be in the `order_by` but are not already
     * present are appended in lexicographical ordering of the field name.
     * * If an order on `__name__` is not specified, it is appended by default.
     *
     * Fields are appended with the same sort direction as the last order
     * specified, or 'ASCENDING' if no order was specified. For example:
     *
     * * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
     * * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
     * * `WHERE a &gt; 1` becomes `WHERE a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * * `WHERE __name__ &gt; ... AND a &gt; 1` becomes
     * `WHERE __name__ &gt; ... AND a &gt; 1 ORDER BY a ASC, __name__ ASC`
     * </pre>
     *
     * <code>repeated .google.firestore.v1.StructuredQuery.Order order_by = 4;</code>
     */
    public java.util.List<com.google.firestore.v1.StructuredQuery.Order.Builder>
        getOrderByBuilderList() {
      return internalGetOrderByFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.firestore.v1.StructuredQuery.Order,
            com.google.firestore.v1.StructuredQuery.Order.Builder,
            com.google.firestore.v1.StructuredQuery.OrderOrBuilder>
        internalGetOrderByFieldBuilder() {
      if (orderByBuilder_ == null) {
        orderByBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.firestore.v1.StructuredQuery.Order,
                com.google.firestore.v1.StructuredQuery.Order.Builder,
                com.google.firestore.v1.StructuredQuery.OrderOrBuilder>(
                orderBy_, ((bitField0_ & 0x00000008) != 0), getParentForChildren(), isClean());
        orderBy_ = null;
      }
      return orderByBuilder_;
    }

    private com.google.firestore.v1.Cursor startAt_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.Cursor,
            com.google.firestore.v1.Cursor.Builder,
            com.google.firestore.v1.CursorOrBuilder>
        startAtBuilder_;

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     *
     * @return Whether the startAt field is set.
     */
    public boolean hasStartAt() {
      return ((bitField0_ & 0x00000010) != 0);
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     *
     * @return The startAt.
     */
    public com.google.firestore.v1.Cursor getStartAt() {
      if (startAtBuilder_ == null) {
        return startAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : startAt_;
      } else {
        return startAtBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    public Builder setStartAt(com.google.firestore.v1.Cursor value) {
      if (startAtBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        startAt_ = value;
      } else {
        startAtBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    public Builder setStartAt(com.google.firestore.v1.Cursor.Builder builderForValue) {
      if (startAtBuilder_ == null) {
        startAt_ = builderForValue.build();
      } else {
        startAtBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    public Builder mergeStartAt(com.google.firestore.v1.Cursor value) {
      if (startAtBuilder_ == null) {
        if (((bitField0_ & 0x00000010) != 0)
            && startAt_ != null
            && startAt_ != com.google.firestore.v1.Cursor.getDefaultInstance()) {
          getStartAtBuilder().mergeFrom(value);
        } else {
          startAt_ = value;
        }
      } else {
        startAtBuilder_.mergeFrom(value);
      }
      if (startAt_ != null) {
        bitField0_ |= 0x00000010;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    public Builder clearStartAt() {
      bitField0_ = (bitField0_ & ~0x00000010);
      startAt_ = null;
      if (startAtBuilder_ != null) {
        startAtBuilder_.dispose();
        startAtBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    public com.google.firestore.v1.Cursor.Builder getStartAtBuilder() {
      bitField0_ |= 0x00000010;
      onChanged();
      return internalGetStartAtFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    public com.google.firestore.v1.CursorOrBuilder getStartAtOrBuilder() {
      if (startAtBuilder_ != null) {
        return startAtBuilder_.getMessageOrBuilder();
      } else {
        return startAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : startAt_;
      }
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to start the query at.
     *
     * The ordering of the result set is based on the `ORDER BY` clause of the
     * original query.
     *
     * ```
     * SELECT * FROM k WHERE a = 1 AND b &gt; 2 ORDER BY b ASC, __name__ ASC;
     * ```
     *
     * This query's results are ordered by `(b ASC, __name__ ASC)`.
     *
     * Cursors can reference either the full ordering or a prefix of the location,
     * though it cannot reference more fields than what are in the provided
     * `ORDER BY`.
     *
     * Continuing off the example above, attaching the following start cursors
     * will have varying impact:
     *
     * - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
     * b &gt; 2 AND __name__ &gt; /k/123`.
     * - `START AFTER (10)`: start the query right after `a = 1 AND b &gt; 10`.
     *
     * Unlike `OFFSET` which requires scanning over the first N results to skip,
     * a start cursor allows the query to begin at a logical position. This
     * position is not required to match an actual result, it will scan forward
     * from this position to find the next document.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor start_at = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.Cursor,
            com.google.firestore.v1.Cursor.Builder,
            com.google.firestore.v1.CursorOrBuilder>
        internalGetStartAtFieldBuilder() {
      if (startAtBuilder_ == null) {
        startAtBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.v1.Cursor,
                com.google.firestore.v1.Cursor.Builder,
                com.google.firestore.v1.CursorOrBuilder>(
                getStartAt(), getParentForChildren(), isClean());
        startAt_ = null;
      }
      return startAtBuilder_;
    }

    private com.google.firestore.v1.Cursor endAt_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.Cursor,
            com.google.firestore.v1.Cursor.Builder,
            com.google.firestore.v1.CursorOrBuilder>
        endAtBuilder_;

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     *
     * @return Whether the endAt field is set.
     */
    public boolean hasEndAt() {
      return ((bitField0_ & 0x00000020) != 0);
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     *
     * @return The endAt.
     */
    public com.google.firestore.v1.Cursor getEndAt() {
      if (endAtBuilder_ == null) {
        return endAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : endAt_;
      } else {
        return endAtBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    public Builder setEndAt(com.google.firestore.v1.Cursor value) {
      if (endAtBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        endAt_ = value;
      } else {
        endAtBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    public Builder setEndAt(com.google.firestore.v1.Cursor.Builder builderForValue) {
      if (endAtBuilder_ == null) {
        endAt_ = builderForValue.build();
      } else {
        endAtBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    public Builder mergeEndAt(com.google.firestore.v1.Cursor value) {
      if (endAtBuilder_ == null) {
        if (((bitField0_ & 0x00000020) != 0)
            && endAt_ != null
            && endAt_ != com.google.firestore.v1.Cursor.getDefaultInstance()) {
          getEndAtBuilder().mergeFrom(value);
        } else {
          endAt_ = value;
        }
      } else {
        endAtBuilder_.mergeFrom(value);
      }
      if (endAt_ != null) {
        bitField0_ |= 0x00000020;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    public Builder clearEndAt() {
      bitField0_ = (bitField0_ & ~0x00000020);
      endAt_ = null;
      if (endAtBuilder_ != null) {
        endAtBuilder_.dispose();
        endAtBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    public com.google.firestore.v1.Cursor.Builder getEndAtBuilder() {
      bitField0_ |= 0x00000020;
      onChanged();
      return internalGetEndAtFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    public com.google.firestore.v1.CursorOrBuilder getEndAtOrBuilder() {
      if (endAtBuilder_ != null) {
        return endAtBuilder_.getMessageOrBuilder();
      } else {
        return endAt_ == null ? com.google.firestore.v1.Cursor.getDefaultInstance() : endAt_;
      }
    }

    /**
     *
     *
     * <pre>
     * A potential prefix of a position in the result set to end the query at.
     *
     * This is similar to `START_AT` but with it controlling the end position
     * rather than the start position.
     *
     * Requires:
     *
     * * The number of values cannot be greater than the number of fields
     * specified in the `ORDER BY` clause.
     * </pre>
     *
     * <code>.google.firestore.v1.Cursor end_at = 8;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.Cursor,
            com.google.firestore.v1.Cursor.Builder,
            com.google.firestore.v1.CursorOrBuilder>
        internalGetEndAtFieldBuilder() {
      if (endAtBuilder_ == null) {
        endAtBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.v1.Cursor,
                com.google.firestore.v1.Cursor.Builder,
                com.google.firestore.v1.CursorOrBuilder>(
                getEndAt(), getParentForChildren(), isClean());
        endAt_ = null;
      }
      return endAtBuilder_;
    }

    private int offset_;

    /**
     *
     *
     * <pre>
     * The number of documents to skip before returning the first result.
     *
     * This applies after the constraints specified by the `WHERE`, `START AT`, &amp;
     * `END AT` but before the `LIMIT` clause.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>int32 offset = 6;</code>
     *
     * @return The offset.
     */
    @java.lang.Override
    public int getOffset() {
      return offset_;
    }

    /**
     *
     *
     * <pre>
     * The number of documents to skip before returning the first result.
     *
     * This applies after the constraints specified by the `WHERE`, `START AT`, &amp;
     * `END AT` but before the `LIMIT` clause.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>int32 offset = 6;</code>
     *
     * @param value The offset to set.
     * @return This builder for chaining.
     */
    public Builder setOffset(int value) {

      offset_ = value;
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The number of documents to skip before returning the first result.
     *
     * This applies after the constraints specified by the `WHERE`, `START AT`, &amp;
     * `END AT` but before the `LIMIT` clause.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>int32 offset = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearOffset() {
      bitField0_ = (bitField0_ & ~0x00000040);
      offset_ = 0;
      onChanged();
      return this;
    }

    private com.google.protobuf.Int32Value limit_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.protobuf.Int32Value,
            com.google.protobuf.Int32Value.Builder,
            com.google.protobuf.Int32ValueOrBuilder>
        limitBuilder_;

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     *
     * @return Whether the limit field is set.
     */
    public boolean hasLimit() {
      return ((bitField0_ & 0x00000080) != 0);
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     *
     * @return The limit.
     */
    public com.google.protobuf.Int32Value getLimit() {
      if (limitBuilder_ == null) {
        return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
      } else {
        return limitBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    public Builder setLimit(com.google.protobuf.Int32Value value) {
      if (limitBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        limit_ = value;
      } else {
        limitBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000080;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    public Builder setLimit(com.google.protobuf.Int32Value.Builder builderForValue) {
      if (limitBuilder_ == null) {
        limit_ = builderForValue.build();
      } else {
        limitBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000080;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    public Builder mergeLimit(com.google.protobuf.Int32Value value) {
      if (limitBuilder_ == null) {
        if (((bitField0_ & 0x00000080) != 0)
            && limit_ != null
            && limit_ != com.google.protobuf.Int32Value.getDefaultInstance()) {
          getLimitBuilder().mergeFrom(value);
        } else {
          limit_ = value;
        }
      } else {
        limitBuilder_.mergeFrom(value);
      }
      if (limit_ != null) {
        bitField0_ |= 0x00000080;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    public Builder clearLimit() {
      bitField0_ = (bitField0_ & ~0x00000080);
      limit_ = null;
      if (limitBuilder_ != null) {
        limitBuilder_.dispose();
        limitBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    public com.google.protobuf.Int32Value.Builder getLimitBuilder() {
      bitField0_ |= 0x00000080;
      onChanged();
      return internalGetLimitFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    public com.google.protobuf.Int32ValueOrBuilder getLimitOrBuilder() {
      if (limitBuilder_ != null) {
        return limitBuilder_.getMessageOrBuilder();
      } else {
        return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;
      }
    }

    /**
     *
     *
     * <pre>
     * The maximum number of results to return.
     *
     * Applies after all other constraints.
     *
     * Requires:
     *
     * * The value must be greater than or equal to zero if specified.
     * </pre>
     *
     * <code>.google.protobuf.Int32Value limit = 5;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.protobuf.Int32Value,
            com.google.protobuf.Int32Value.Builder,
            com.google.protobuf.Int32ValueOrBuilder>
        internalGetLimitFieldBuilder() {
      if (limitBuilder_ == null) {
        limitBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.protobuf.Int32Value,
                com.google.protobuf.Int32Value.Builder,
                com.google.protobuf.Int32ValueOrBuilder>(
                getLimit(), getParentForChildren(), isClean());
        limit_ = null;
      }
      return limitBuilder_;
    }

    private com.google.firestore.v1.StructuredQuery.FindNearest findNearest_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.StructuredQuery.FindNearest,
            com.google.firestore.v1.StructuredQuery.FindNearest.Builder,
            com.google.firestore.v1.StructuredQuery.FindNearestOrBuilder>
        findNearestBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the findNearest field is set.
     */
    public boolean hasFindNearest() {
      return ((bitField0_ & 0x00000100) != 0);
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The findNearest.
     */
    public com.google.firestore.v1.StructuredQuery.FindNearest getFindNearest() {
      if (findNearestBuilder_ == null) {
        return findNearest_ == null
            ? com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance()
            : findNearest_;
      } else {
        return findNearestBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setFindNearest(com.google.firestore.v1.StructuredQuery.FindNearest value) {
      if (findNearestBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        findNearest_ = value;
      } else {
        findNearestBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000100;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setFindNearest(
        com.google.firestore.v1.StructuredQuery.FindNearest.Builder builderForValue) {
      if (findNearestBuilder_ == null) {
        findNearest_ = builderForValue.build();
      } else {
        findNearestBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000100;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder mergeFindNearest(com.google.firestore.v1.StructuredQuery.FindNearest value) {
      if (findNearestBuilder_ == null) {
        if (((bitField0_ & 0x00000100) != 0)
            && findNearest_ != null
            && findNearest_
                != com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance()) {
          getFindNearestBuilder().mergeFrom(value);
        } else {
          findNearest_ = value;
        }
      } else {
        findNearestBuilder_.mergeFrom(value);
      }
      if (findNearest_ != null) {
        bitField0_ |= 0x00000100;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder clearFindNearest() {
      bitField0_ = (bitField0_ & ~0x00000100);
      findNearest_ = null;
      if (findNearestBuilder_ != null) {
        findNearestBuilder_.dispose();
        findNearestBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.firestore.v1.StructuredQuery.FindNearest.Builder getFindNearestBuilder() {
      bitField0_ |= 0x00000100;
      onChanged();
      return internalGetFindNearestFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.firestore.v1.StructuredQuery.FindNearestOrBuilder getFindNearestOrBuilder() {
      if (findNearestBuilder_ != null) {
        return findNearestBuilder_.getMessageOrBuilder();
      } else {
        return findNearest_ == null
            ? com.google.firestore.v1.StructuredQuery.FindNearest.getDefaultInstance()
            : findNearest_;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. A potential nearest neighbors search.
     *
     * Applies after all other filters and ordering.
     *
     * Finds the closest vector embeddings to the given query vector.
     * </pre>
     *
     * <code>
     * .google.firestore.v1.StructuredQuery.FindNearest find_nearest = 9 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.v1.StructuredQuery.FindNearest,
            com.google.firestore.v1.StructuredQuery.FindNearest.Builder,
            com.google.firestore.v1.StructuredQuery.FindNearestOrBuilder>
        internalGetFindNearestFieldBuilder() {
      if (findNearestBuilder_ == null) {
        findNearestBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.v1.StructuredQuery.FindNearest,
                com.google.firestore.v1.StructuredQuery.FindNearest.Builder,
                com.google.firestore.v1.StructuredQuery.FindNearestOrBuilder>(
                getFindNearest(), getParentForChildren(), isClean());
        findNearest_ = null;
      }
      return findNearestBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.firestore.v1.StructuredQuery)
  }

  // @@protoc_insertion_point(class_scope:google.firestore.v1.StructuredQuery)
  private static final com.google.firestore.v1.StructuredQuery DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.firestore.v1.StructuredQuery();
  }

  public static com.google.firestore.v1.StructuredQuery getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<StructuredQuery> PARSER =
      new com.google.protobuf.AbstractParser<StructuredQuery>() {
        @java.lang.Override
        public StructuredQuery parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

  public static com.google.protobuf.Parser<StructuredQuery> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<StructuredQuery> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.firestore.v1.StructuredQuery getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
