/*
 * 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/admin/v1/field.proto
// Protobuf Java Version: 4.33.2

package com.google.firestore.admin.v1;

/**
 *
 *
 * <pre>
 * Represents a single field in the database.
 *
 * Fields are grouped by their "Collection Group", which represent all
 * collections in the database with the same ID.
 * </pre>
 *
 * Protobuf type {@code google.firestore.admin.v1.Field}
 */
@com.google.protobuf.Generated
public final class Field extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.firestore.admin.v1.Field)
    FieldOrBuilder {
  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= */ "",
        "Field");
  }

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

  private Field() {
    name_ = "";
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.firestore.admin.v1.FieldProto
        .internal_static_google_firestore_admin_v1_Field_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.firestore.admin.v1.FieldProto
        .internal_static_google_firestore_admin_v1_Field_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.firestore.admin.v1.Field.class,
            com.google.firestore.admin.v1.Field.Builder.class);
  }

  public interface IndexConfigOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.admin.v1.Field.IndexConfig)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    java.util.List<com.google.firestore.admin.v1.Index> getIndexesList();

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    com.google.firestore.admin.v1.Index getIndexes(int index);

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    int getIndexesCount();

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    java.util.List<? extends com.google.firestore.admin.v1.IndexOrBuilder>
        getIndexesOrBuilderList();

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    com.google.firestore.admin.v1.IndexOrBuilder getIndexesOrBuilder(int index);

    /**
     *
     *
     * <pre>
     * Output only. When true, the `Field`'s index configuration is set from the
     * configuration specified by the `ancestor_field`.
     * When false, the `Field`'s index configuration is defined explicitly.
     * </pre>
     *
     * <code>bool uses_ancestor_config = 2;</code>
     *
     * @return The usesAncestorConfig.
     */
    boolean getUsesAncestorConfig();

    /**
     *
     *
     * <pre>
     * Output only. Specifies the resource name of the `Field` from which this
     * field's index configuration is set (when `uses_ancestor_config` is true),
     * or from which it *would* be set if this field had no index configuration
     * (when `uses_ancestor_config` is false).
     * </pre>
     *
     * <code>string ancestor_field = 3;</code>
     *
     * @return The ancestorField.
     */
    java.lang.String getAncestorField();

    /**
     *
     *
     * <pre>
     * Output only. Specifies the resource name of the `Field` from which this
     * field's index configuration is set (when `uses_ancestor_config` is true),
     * or from which it *would* be set if this field had no index configuration
     * (when `uses_ancestor_config` is false).
     * </pre>
     *
     * <code>string ancestor_field = 3;</code>
     *
     * @return The bytes for ancestorField.
     */
    com.google.protobuf.ByteString getAncestorFieldBytes();

    /**
     *
     *
     * <pre>
     * Output only
     * When true, the `Field`'s index configuration is in the process of being
     * reverted. Once complete, the index config will transition to the same
     * state as the field specified by `ancestor_field`, at which point
     * `uses_ancestor_config` will be `true` and `reverting` will be `false`.
     * </pre>
     *
     * <code>bool reverting = 4;</code>
     *
     * @return The reverting.
     */
    boolean getReverting();
  }

  /**
   *
   *
   * <pre>
   * The index configuration for this field.
   * </pre>
   *
   * Protobuf type {@code google.firestore.admin.v1.Field.IndexConfig}
   */
  public static final class IndexConfig extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.admin.v1.Field.IndexConfig)
      IndexConfigOrBuilder {
    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= */ "",
          "IndexConfig");
    }

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

    private IndexConfig() {
      indexes_ = java.util.Collections.emptyList();
      ancestorField_ = "";
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.admin.v1.FieldProto
          .internal_static_google_firestore_admin_v1_Field_IndexConfig_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.admin.v1.FieldProto
          .internal_static_google_firestore_admin_v1_Field_IndexConfig_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.admin.v1.Field.IndexConfig.class,
              com.google.firestore.admin.v1.Field.IndexConfig.Builder.class);
    }

    public static final int INDEXES_FIELD_NUMBER = 1;

    @SuppressWarnings("serial")
    private java.util.List<com.google.firestore.admin.v1.Index> indexes_;

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    @java.lang.Override
    public java.util.List<com.google.firestore.admin.v1.Index> getIndexesList() {
      return indexes_;
    }

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    @java.lang.Override
    public java.util.List<? extends com.google.firestore.admin.v1.IndexOrBuilder>
        getIndexesOrBuilderList() {
      return indexes_;
    }

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    @java.lang.Override
    public int getIndexesCount() {
      return indexes_.size();
    }

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    @java.lang.Override
    public com.google.firestore.admin.v1.Index getIndexes(int index) {
      return indexes_.get(index);
    }

    /**
     *
     *
     * <pre>
     * The indexes supported for this field.
     * </pre>
     *
     * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
     */
    @java.lang.Override
    public com.google.firestore.admin.v1.IndexOrBuilder getIndexesOrBuilder(int index) {
      return indexes_.get(index);
    }

    public static final int USES_ANCESTOR_CONFIG_FIELD_NUMBER = 2;
    private boolean usesAncestorConfig_ = false;

    /**
     *
     *
     * <pre>
     * Output only. When true, the `Field`'s index configuration is set from the
     * configuration specified by the `ancestor_field`.
     * When false, the `Field`'s index configuration is defined explicitly.
     * </pre>
     *
     * <code>bool uses_ancestor_config = 2;</code>
     *
     * @return The usesAncestorConfig.
     */
    @java.lang.Override
    public boolean getUsesAncestorConfig() {
      return usesAncestorConfig_;
    }

    public static final int ANCESTOR_FIELD_FIELD_NUMBER = 3;

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

    /**
     *
     *
     * <pre>
     * Output only. Specifies the resource name of the `Field` from which this
     * field's index configuration is set (when `uses_ancestor_config` is true),
     * or from which it *would* be set if this field had no index configuration
     * (when `uses_ancestor_config` is false).
     * </pre>
     *
     * <code>string ancestor_field = 3;</code>
     *
     * @return The ancestorField.
     */
    @java.lang.Override
    public java.lang.String getAncestorField() {
      java.lang.Object ref = ancestorField_;
      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();
        ancestorField_ = s;
        return s;
      }
    }

    /**
     *
     *
     * <pre>
     * Output only. Specifies the resource name of the `Field` from which this
     * field's index configuration is set (when `uses_ancestor_config` is true),
     * or from which it *would* be set if this field had no index configuration
     * (when `uses_ancestor_config` is false).
     * </pre>
     *
     * <code>string ancestor_field = 3;</code>
     *
     * @return The bytes for ancestorField.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getAncestorFieldBytes() {
      java.lang.Object ref = ancestorField_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        ancestorField_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int REVERTING_FIELD_NUMBER = 4;
    private boolean reverting_ = false;

    /**
     *
     *
     * <pre>
     * Output only
     * When true, the `Field`'s index configuration is in the process of being
     * reverted. Once complete, the index config will transition to the same
     * state as the field specified by `ancestor_field`, at which point
     * `uses_ancestor_config` will be `true` and `reverting` will be `false`.
     * </pre>
     *
     * <code>bool reverting = 4;</code>
     *
     * @return The reverting.
     */
    @java.lang.Override
    public boolean getReverting() {
      return reverting_;
    }

    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 < indexes_.size(); i++) {
        output.writeMessage(1, indexes_.get(i));
      }
      if (usesAncestorConfig_ != false) {
        output.writeBool(2, usesAncestorConfig_);
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(ancestorField_)) {
        com.google.protobuf.GeneratedMessage.writeString(output, 3, ancestorField_);
      }
      if (reverting_ != false) {
        output.writeBool(4, reverting_);
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      for (int i = 0; i < indexes_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, indexes_.get(i));
      }
      if (usesAncestorConfig_ != false) {
        size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, usesAncestorConfig_);
      }
      if (!com.google.protobuf.GeneratedMessage.isStringEmpty(ancestorField_)) {
        size += com.google.protobuf.GeneratedMessage.computeStringSize(3, ancestorField_);
      }
      if (reverting_ != false) {
        size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, reverting_);
      }
      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.admin.v1.Field.IndexConfig)) {
        return super.equals(obj);
      }
      com.google.firestore.admin.v1.Field.IndexConfig other =
          (com.google.firestore.admin.v1.Field.IndexConfig) obj;

      if (!getIndexesList().equals(other.getIndexesList())) return false;
      if (getUsesAncestorConfig() != other.getUsesAncestorConfig()) return false;
      if (!getAncestorField().equals(other.getAncestorField())) return false;
      if (getReverting() != other.getReverting()) 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 (getIndexesCount() > 0) {
        hash = (37 * hash) + INDEXES_FIELD_NUMBER;
        hash = (53 * hash) + getIndexesList().hashCode();
      }
      hash = (37 * hash) + USES_ANCESTOR_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getUsesAncestorConfig());
      hash = (37 * hash) + ANCESTOR_FIELD_FIELD_NUMBER;
      hash = (53 * hash) + getAncestorField().hashCode();
      hash = (37 * hash) + REVERTING_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReverting());
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

    public static com.google.firestore.admin.v1.Field.IndexConfig 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.admin.v1.Field.IndexConfig parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.admin.v1.Field.IndexConfig 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.admin.v1.Field.IndexConfig parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

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

    public static com.google.firestore.admin.v1.Field.IndexConfig 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.admin.v1.Field.IndexConfig parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.admin.v1.Field.IndexConfig 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.admin.v1.Field.IndexConfig parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.admin.v1.Field.IndexConfig 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.admin.v1.Field.IndexConfig 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 index configuration for this field.
     * </pre>
     *
     * Protobuf type {@code google.firestore.admin.v1.Field.IndexConfig}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.admin.v1.Field.IndexConfig)
        com.google.firestore.admin.v1.Field.IndexConfigOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.admin.v1.FieldProto
            .internal_static_google_firestore_admin_v1_Field_IndexConfig_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.admin.v1.FieldProto
            .internal_static_google_firestore_admin_v1_Field_IndexConfig_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.admin.v1.Field.IndexConfig.class,
                com.google.firestore.admin.v1.Field.IndexConfig.Builder.class);
      }

      // Construct using com.google.firestore.admin.v1.Field.IndexConfig.newBuilder()
      private Builder() {}

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

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        if (indexesBuilder_ == null) {
          indexes_ = java.util.Collections.emptyList();
        } else {
          indexes_ = null;
          indexesBuilder_.clear();
        }
        bitField0_ = (bitField0_ & ~0x00000001);
        usesAncestorConfig_ = false;
        ancestorField_ = "";
        reverting_ = false;
        return this;
      }

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

      @java.lang.Override
      public com.google.firestore.admin.v1.Field.IndexConfig getDefaultInstanceForType() {
        return com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance();
      }

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

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

      private void buildPartialRepeatedFields(
          com.google.firestore.admin.v1.Field.IndexConfig result) {
        if (indexesBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)) {
            indexes_ = java.util.Collections.unmodifiableList(indexes_);
            bitField0_ = (bitField0_ & ~0x00000001);
          }
          result.indexes_ = indexes_;
        } else {
          result.indexes_ = indexesBuilder_.build();
        }
      }

      private void buildPartial0(com.google.firestore.admin.v1.Field.IndexConfig result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.usesAncestorConfig_ = usesAncestorConfig_;
        }
        if (((from_bitField0_ & 0x00000004) != 0)) {
          result.ancestorField_ = ancestorField_;
        }
        if (((from_bitField0_ & 0x00000008) != 0)) {
          result.reverting_ = reverting_;
        }
      }

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

      public Builder mergeFrom(com.google.firestore.admin.v1.Field.IndexConfig other) {
        if (other == com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance())
          return this;
        if (indexesBuilder_ == null) {
          if (!other.indexes_.isEmpty()) {
            if (indexes_.isEmpty()) {
              indexes_ = other.indexes_;
              bitField0_ = (bitField0_ & ~0x00000001);
            } else {
              ensureIndexesIsMutable();
              indexes_.addAll(other.indexes_);
            }
            onChanged();
          }
        } else {
          if (!other.indexes_.isEmpty()) {
            if (indexesBuilder_.isEmpty()) {
              indexesBuilder_.dispose();
              indexesBuilder_ = null;
              indexes_ = other.indexes_;
              bitField0_ = (bitField0_ & ~0x00000001);
              indexesBuilder_ =
                  com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                      ? internalGetIndexesFieldBuilder()
                      : null;
            } else {
              indexesBuilder_.addAllMessages(other.indexes_);
            }
          }
        }
        if (other.getUsesAncestorConfig() != false) {
          setUsesAncestorConfig(other.getUsesAncestorConfig());
        }
        if (!other.getAncestorField().isEmpty()) {
          ancestorField_ = other.ancestorField_;
          bitField0_ |= 0x00000004;
          onChanged();
        }
        if (other.getReverting() != false) {
          setReverting(other.getReverting());
        }
        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:
                {
                  com.google.firestore.admin.v1.Index m =
                      input.readMessage(
                          com.google.firestore.admin.v1.Index.parser(), extensionRegistry);
                  if (indexesBuilder_ == null) {
                    ensureIndexesIsMutable();
                    indexes_.add(m);
                  } else {
                    indexesBuilder_.addMessage(m);
                  }
                  break;
                } // case 10
              case 16:
                {
                  usesAncestorConfig_ = input.readBool();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 16
              case 26:
                {
                  ancestorField_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000004;
                  break;
                } // case 26
              case 32:
                {
                  reverting_ = input.readBool();
                  bitField0_ |= 0x00000008;
                  break;
                } // case 32
              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.admin.v1.Index> indexes_ =
          java.util.Collections.emptyList();

      private void ensureIndexesIsMutable() {
        if (!((bitField0_ & 0x00000001) != 0)) {
          indexes_ = new java.util.ArrayList<com.google.firestore.admin.v1.Index>(indexes_);
          bitField0_ |= 0x00000001;
        }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
              com.google.firestore.admin.v1.Index,
              com.google.firestore.admin.v1.Index.Builder,
              com.google.firestore.admin.v1.IndexOrBuilder>
          indexesBuilder_;

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public java.util.List<com.google.firestore.admin.v1.Index> getIndexesList() {
        if (indexesBuilder_ == null) {
          return java.util.Collections.unmodifiableList(indexes_);
        } else {
          return indexesBuilder_.getMessageList();
        }
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public int getIndexesCount() {
        if (indexesBuilder_ == null) {
          return indexes_.size();
        } else {
          return indexesBuilder_.getCount();
        }
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public com.google.firestore.admin.v1.Index getIndexes(int index) {
        if (indexesBuilder_ == null) {
          return indexes_.get(index);
        } else {
          return indexesBuilder_.getMessage(index);
        }
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder setIndexes(int index, com.google.firestore.admin.v1.Index value) {
        if (indexesBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureIndexesIsMutable();
          indexes_.set(index, value);
          onChanged();
        } else {
          indexesBuilder_.setMessage(index, value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder setIndexes(
          int index, com.google.firestore.admin.v1.Index.Builder builderForValue) {
        if (indexesBuilder_ == null) {
          ensureIndexesIsMutable();
          indexes_.set(index, builderForValue.build());
          onChanged();
        } else {
          indexesBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder addIndexes(com.google.firestore.admin.v1.Index value) {
        if (indexesBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureIndexesIsMutable();
          indexes_.add(value);
          onChanged();
        } else {
          indexesBuilder_.addMessage(value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder addIndexes(int index, com.google.firestore.admin.v1.Index value) {
        if (indexesBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureIndexesIsMutable();
          indexes_.add(index, value);
          onChanged();
        } else {
          indexesBuilder_.addMessage(index, value);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder addIndexes(com.google.firestore.admin.v1.Index.Builder builderForValue) {
        if (indexesBuilder_ == null) {
          ensureIndexesIsMutable();
          indexes_.add(builderForValue.build());
          onChanged();
        } else {
          indexesBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder addIndexes(
          int index, com.google.firestore.admin.v1.Index.Builder builderForValue) {
        if (indexesBuilder_ == null) {
          ensureIndexesIsMutable();
          indexes_.add(index, builderForValue.build());
          onChanged();
        } else {
          indexesBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder addAllIndexes(
          java.lang.Iterable<? extends com.google.firestore.admin.v1.Index> values) {
        if (indexesBuilder_ == null) {
          ensureIndexesIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(values, indexes_);
          onChanged();
        } else {
          indexesBuilder_.addAllMessages(values);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder clearIndexes() {
        if (indexesBuilder_ == null) {
          indexes_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
        } else {
          indexesBuilder_.clear();
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public Builder removeIndexes(int index) {
        if (indexesBuilder_ == null) {
          ensureIndexesIsMutable();
          indexes_.remove(index);
          onChanged();
        } else {
          indexesBuilder_.remove(index);
        }
        return this;
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public com.google.firestore.admin.v1.Index.Builder getIndexesBuilder(int index) {
        return internalGetIndexesFieldBuilder().getBuilder(index);
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public com.google.firestore.admin.v1.IndexOrBuilder getIndexesOrBuilder(int index) {
        if (indexesBuilder_ == null) {
          return indexes_.get(index);
        } else {
          return indexesBuilder_.getMessageOrBuilder(index);
        }
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public java.util.List<? extends com.google.firestore.admin.v1.IndexOrBuilder>
          getIndexesOrBuilderList() {
        if (indexesBuilder_ != null) {
          return indexesBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(indexes_);
        }
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public com.google.firestore.admin.v1.Index.Builder addIndexesBuilder() {
        return internalGetIndexesFieldBuilder()
            .addBuilder(com.google.firestore.admin.v1.Index.getDefaultInstance());
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public com.google.firestore.admin.v1.Index.Builder addIndexesBuilder(int index) {
        return internalGetIndexesFieldBuilder()
            .addBuilder(index, com.google.firestore.admin.v1.Index.getDefaultInstance());
      }

      /**
       *
       *
       * <pre>
       * The indexes supported for this field.
       * </pre>
       *
       * <code>repeated .google.firestore.admin.v1.Index indexes = 1;</code>
       */
      public java.util.List<com.google.firestore.admin.v1.Index.Builder> getIndexesBuilderList() {
        return internalGetIndexesFieldBuilder().getBuilderList();
      }

      private com.google.protobuf.RepeatedFieldBuilder<
              com.google.firestore.admin.v1.Index,
              com.google.firestore.admin.v1.Index.Builder,
              com.google.firestore.admin.v1.IndexOrBuilder>
          internalGetIndexesFieldBuilder() {
        if (indexesBuilder_ == null) {
          indexesBuilder_ =
              new com.google.protobuf.RepeatedFieldBuilder<
                  com.google.firestore.admin.v1.Index,
                  com.google.firestore.admin.v1.Index.Builder,
                  com.google.firestore.admin.v1.IndexOrBuilder>(
                  indexes_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
          indexes_ = null;
        }
        return indexesBuilder_;
      }

      private boolean usesAncestorConfig_;

      /**
       *
       *
       * <pre>
       * Output only. When true, the `Field`'s index configuration is set from the
       * configuration specified by the `ancestor_field`.
       * When false, the `Field`'s index configuration is defined explicitly.
       * </pre>
       *
       * <code>bool uses_ancestor_config = 2;</code>
       *
       * @return The usesAncestorConfig.
       */
      @java.lang.Override
      public boolean getUsesAncestorConfig() {
        return usesAncestorConfig_;
      }

      /**
       *
       *
       * <pre>
       * Output only. When true, the `Field`'s index configuration is set from the
       * configuration specified by the `ancestor_field`.
       * When false, the `Field`'s index configuration is defined explicitly.
       * </pre>
       *
       * <code>bool uses_ancestor_config = 2;</code>
       *
       * @param value The usesAncestorConfig to set.
       * @return This builder for chaining.
       */
      public Builder setUsesAncestorConfig(boolean value) {

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

      /**
       *
       *
       * <pre>
       * Output only. When true, the `Field`'s index configuration is set from the
       * configuration specified by the `ancestor_field`.
       * When false, the `Field`'s index configuration is defined explicitly.
       * </pre>
       *
       * <code>bool uses_ancestor_config = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearUsesAncestorConfig() {
        bitField0_ = (bitField0_ & ~0x00000002);
        usesAncestorConfig_ = false;
        onChanged();
        return this;
      }

      private java.lang.Object ancestorField_ = "";

      /**
       *
       *
       * <pre>
       * Output only. Specifies the resource name of the `Field` from which this
       * field's index configuration is set (when `uses_ancestor_config` is true),
       * or from which it *would* be set if this field had no index configuration
       * (when `uses_ancestor_config` is false).
       * </pre>
       *
       * <code>string ancestor_field = 3;</code>
       *
       * @return The ancestorField.
       */
      public java.lang.String getAncestorField() {
        java.lang.Object ref = ancestorField_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          ancestorField_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * Output only. Specifies the resource name of the `Field` from which this
       * field's index configuration is set (when `uses_ancestor_config` is true),
       * or from which it *would* be set if this field had no index configuration
       * (when `uses_ancestor_config` is false).
       * </pre>
       *
       * <code>string ancestor_field = 3;</code>
       *
       * @return The bytes for ancestorField.
       */
      public com.google.protobuf.ByteString getAncestorFieldBytes() {
        java.lang.Object ref = ancestorField_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          ancestorField_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      /**
       *
       *
       * <pre>
       * Output only. Specifies the resource name of the `Field` from which this
       * field's index configuration is set (when `uses_ancestor_config` is true),
       * or from which it *would* be set if this field had no index configuration
       * (when `uses_ancestor_config` is false).
       * </pre>
       *
       * <code>string ancestor_field = 3;</code>
       *
       * @param value The ancestorField to set.
       * @return This builder for chaining.
       */
      public Builder setAncestorField(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        ancestorField_ = value;
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Output only. Specifies the resource name of the `Field` from which this
       * field's index configuration is set (when `uses_ancestor_config` is true),
       * or from which it *would* be set if this field had no index configuration
       * (when `uses_ancestor_config` is false).
       * </pre>
       *
       * <code>string ancestor_field = 3;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearAncestorField() {
        ancestorField_ = getDefaultInstance().getAncestorField();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Output only. Specifies the resource name of the `Field` from which this
       * field's index configuration is set (when `uses_ancestor_config` is true),
       * or from which it *would* be set if this field had no index configuration
       * (when `uses_ancestor_config` is false).
       * </pre>
       *
       * <code>string ancestor_field = 3;</code>
       *
       * @param value The bytes for ancestorField to set.
       * @return This builder for chaining.
       */
      public Builder setAncestorFieldBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        ancestorField_ = value;
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }

      private boolean reverting_;

      /**
       *
       *
       * <pre>
       * Output only
       * When true, the `Field`'s index configuration is in the process of being
       * reverted. Once complete, the index config will transition to the same
       * state as the field specified by `ancestor_field`, at which point
       * `uses_ancestor_config` will be `true` and `reverting` will be `false`.
       * </pre>
       *
       * <code>bool reverting = 4;</code>
       *
       * @return The reverting.
       */
      @java.lang.Override
      public boolean getReverting() {
        return reverting_;
      }

      /**
       *
       *
       * <pre>
       * Output only
       * When true, the `Field`'s index configuration is in the process of being
       * reverted. Once complete, the index config will transition to the same
       * state as the field specified by `ancestor_field`, at which point
       * `uses_ancestor_config` will be `true` and `reverting` will be `false`.
       * </pre>
       *
       * <code>bool reverting = 4;</code>
       *
       * @param value The reverting to set.
       * @return This builder for chaining.
       */
      public Builder setReverting(boolean value) {

        reverting_ = value;
        bitField0_ |= 0x00000008;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Output only
       * When true, the `Field`'s index configuration is in the process of being
       * reverted. Once complete, the index config will transition to the same
       * state as the field specified by `ancestor_field`, at which point
       * `uses_ancestor_config` will be `true` and `reverting` will be `false`.
       * </pre>
       *
       * <code>bool reverting = 4;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearReverting() {
        bitField0_ = (bitField0_ & ~0x00000008);
        reverting_ = false;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.admin.v1.Field.IndexConfig)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Field.IndexConfig)
    private static final com.google.firestore.admin.v1.Field.IndexConfig DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.admin.v1.Field.IndexConfig();
    }

    public static com.google.firestore.admin.v1.Field.IndexConfig getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<IndexConfig> PARSER =
        new com.google.protobuf.AbstractParser<IndexConfig>() {
          @java.lang.Override
          public IndexConfig 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<IndexConfig> parser() {
      return PARSER;
    }

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

    @java.lang.Override
    public com.google.firestore.admin.v1.Field.IndexConfig getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface TtlConfigOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.firestore.admin.v1.Field.TtlConfig)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Output only. The state of the TTL configuration.
     * </pre>
     *
     * <code>
     * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * </code>
     *
     * @return The enum numeric value on the wire for state.
     */
    int getStateValue();

    /**
     *
     *
     * <pre>
     * Output only. The state of the TTL configuration.
     * </pre>
     *
     * <code>
     * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * </code>
     *
     * @return The state.
     */
    com.google.firestore.admin.v1.Field.TtlConfig.State getState();
  }

  /**
   *
   *
   * <pre>
   * The TTL (time-to-live) configuration for documents that have this `Field`
   * set.
   *
   * Storing a timestamp value into a TTL-enabled field will be treated as
   * the document's absolute expiration time. Timestamp values in the past
   * indicate that the document is eligible for immediate expiration. Using any
   * other data type or leaving the field absent will disable expiration for the
   * individual document.
   * </pre>
   *
   * Protobuf type {@code google.firestore.admin.v1.Field.TtlConfig}
   */
  public static final class TtlConfig extends com.google.protobuf.GeneratedMessage
      implements
      // @@protoc_insertion_point(message_implements:google.firestore.admin.v1.Field.TtlConfig)
      TtlConfigOrBuilder {
    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= */ "",
          "TtlConfig");
    }

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

    private TtlConfig() {
      state_ = 0;
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.admin.v1.FieldProto
          .internal_static_google_firestore_admin_v1_Field_TtlConfig_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.admin.v1.FieldProto
          .internal_static_google_firestore_admin_v1_Field_TtlConfig_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.admin.v1.Field.TtlConfig.class,
              com.google.firestore.admin.v1.Field.TtlConfig.Builder.class);
    }

    /**
     *
     *
     * <pre>
     * The state of applying the TTL configuration to all documents.
     * </pre>
     *
     * Protobuf enum {@code google.firestore.admin.v1.Field.TtlConfig.State}
     */
    public enum State implements com.google.protobuf.ProtocolMessageEnum {
      /**
       *
       *
       * <pre>
       * The state is unspecified or unknown.
       * </pre>
       *
       * <code>STATE_UNSPECIFIED = 0;</code>
       */
      STATE_UNSPECIFIED(0),
      /**
       *
       *
       * <pre>
       * The TTL is being applied. There is an active long-running operation to
       * track the change. Newly written documents will have TTLs applied as
       * requested. Requested TTLs on existing documents are still being
       * processed. When TTLs on all existing documents have been processed, the
       * state will move to 'ACTIVE'.
       * </pre>
       *
       * <code>CREATING = 1;</code>
       */
      CREATING(1),
      /**
       *
       *
       * <pre>
       * The TTL is active for all documents.
       * </pre>
       *
       * <code>ACTIVE = 2;</code>
       */
      ACTIVE(2),
      /**
       *
       *
       * <pre>
       * The TTL configuration could not be enabled for all existing documents.
       * Newly written documents will continue to have their TTL applied.
       * The LRO returned when last attempting to enable TTL for this `Field`
       * has failed, and may have more details.
       * </pre>
       *
       * <code>NEEDS_REPAIR = 3;</code>
       */
      NEEDS_REPAIR(3),
      UNRECOGNIZED(-1),
      ;

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

      /**
       *
       *
       * <pre>
       * The state is unspecified or unknown.
       * </pre>
       *
       * <code>STATE_UNSPECIFIED = 0;</code>
       */
      public static final int STATE_UNSPECIFIED_VALUE = 0;

      /**
       *
       *
       * <pre>
       * The TTL is being applied. There is an active long-running operation to
       * track the change. Newly written documents will have TTLs applied as
       * requested. Requested TTLs on existing documents are still being
       * processed. When TTLs on all existing documents have been processed, the
       * state will move to 'ACTIVE'.
       * </pre>
       *
       * <code>CREATING = 1;</code>
       */
      public static final int CREATING_VALUE = 1;

      /**
       *
       *
       * <pre>
       * The TTL is active for all documents.
       * </pre>
       *
       * <code>ACTIVE = 2;</code>
       */
      public static final int ACTIVE_VALUE = 2;

      /**
       *
       *
       * <pre>
       * The TTL configuration could not be enabled for all existing documents.
       * Newly written documents will continue to have their TTL applied.
       * The LRO returned when last attempting to enable TTL for this `Field`
       * has failed, and may have more details.
       * </pre>
       *
       * <code>NEEDS_REPAIR = 3;</code>
       */
      public static final int NEEDS_REPAIR_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 State 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 State forNumber(int value) {
        switch (value) {
          case 0:
            return STATE_UNSPECIFIED;
          case 1:
            return CREATING;
          case 2:
            return ACTIVE;
          case 3:
            return NEEDS_REPAIR;
          default:
            return null;
        }
      }

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

      private static final com.google.protobuf.Internal.EnumLiteMap<State> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<State>() {
            public State findValueByNumber(int number) {
              return State.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.admin.v1.Field.TtlConfig.getDescriptor().getEnumTypes().get(0);
      }

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

      public static State 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 State(int value) {
        this.value = value;
      }

      // @@protoc_insertion_point(enum_scope:google.firestore.admin.v1.Field.TtlConfig.State)
    }

    public static final int STATE_FIELD_NUMBER = 1;
    private int state_ = 0;

    /**
     *
     *
     * <pre>
     * Output only. The state of the TTL configuration.
     * </pre>
     *
     * <code>
     * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * </code>
     *
     * @return The enum numeric value on the wire for state.
     */
    @java.lang.Override
    public int getStateValue() {
      return state_;
    }

    /**
     *
     *
     * <pre>
     * Output only. The state of the TTL configuration.
     * </pre>
     *
     * <code>
     * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
     * </code>
     *
     * @return The state.
     */
    @java.lang.Override
    public com.google.firestore.admin.v1.Field.TtlConfig.State getState() {
      com.google.firestore.admin.v1.Field.TtlConfig.State result =
          com.google.firestore.admin.v1.Field.TtlConfig.State.forNumber(state_);
      return result == null
          ? com.google.firestore.admin.v1.Field.TtlConfig.State.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 (state_
          != com.google.firestore.admin.v1.Field.TtlConfig.State.STATE_UNSPECIFIED.getNumber()) {
        output.writeEnum(1, state_);
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      if (state_
          != com.google.firestore.admin.v1.Field.TtlConfig.State.STATE_UNSPECIFIED.getNumber()) {
        size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_);
      }
      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.admin.v1.Field.TtlConfig)) {
        return super.equals(obj);
      }
      com.google.firestore.admin.v1.Field.TtlConfig other =
          (com.google.firestore.admin.v1.Field.TtlConfig) obj;

      if (state_ != other.state_) 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) + STATE_FIELD_NUMBER;
      hash = (53 * hash) + state_;
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

    public static com.google.firestore.admin.v1.Field.TtlConfig 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.admin.v1.Field.TtlConfig parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.firestore.admin.v1.Field.TtlConfig 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.admin.v1.Field.TtlConfig parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

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

    public static com.google.firestore.admin.v1.Field.TtlConfig 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.admin.v1.Field.TtlConfig parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.firestore.admin.v1.Field.TtlConfig 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.admin.v1.Field.TtlConfig parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
    }

    public static com.google.firestore.admin.v1.Field.TtlConfig 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.admin.v1.Field.TtlConfig 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 TTL (time-to-live) configuration for documents that have this `Field`
     * set.
     *
     * Storing a timestamp value into a TTL-enabled field will be treated as
     * the document's absolute expiration time. Timestamp values in the past
     * indicate that the document is eligible for immediate expiration. Using any
     * other data type or leaving the field absent will disable expiration for the
     * individual document.
     * </pre>
     *
     * Protobuf type {@code google.firestore.admin.v1.Field.TtlConfig}
     */
    public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.firestore.admin.v1.Field.TtlConfig)
        com.google.firestore.admin.v1.Field.TtlConfigOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.firestore.admin.v1.FieldProto
            .internal_static_google_firestore_admin_v1_Field_TtlConfig_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.firestore.admin.v1.FieldProto
            .internal_static_google_firestore_admin_v1_Field_TtlConfig_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.firestore.admin.v1.Field.TtlConfig.class,
                com.google.firestore.admin.v1.Field.TtlConfig.Builder.class);
      }

      // Construct using com.google.firestore.admin.v1.Field.TtlConfig.newBuilder()
      private Builder() {}

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

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

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

      @java.lang.Override
      public com.google.firestore.admin.v1.Field.TtlConfig getDefaultInstanceForType() {
        return com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance();
      }

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

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

      private void buildPartial0(com.google.firestore.admin.v1.Field.TtlConfig result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.state_ = state_;
        }
      }

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

      public Builder mergeFrom(com.google.firestore.admin.v1.Field.TtlConfig other) {
        if (other == com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance())
          return this;
        if (other.state_ != 0) {
          setStateValue(other.getStateValue());
        }
        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:
                {
                  state_ = input.readEnum();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 8
              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 state_ = 0;

      /**
       *
       *
       * <pre>
       * Output only. The state of the TTL configuration.
       * </pre>
       *
       * <code>
       * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
       * </code>
       *
       * @return The enum numeric value on the wire for state.
       */
      @java.lang.Override
      public int getStateValue() {
        return state_;
      }

      /**
       *
       *
       * <pre>
       * Output only. The state of the TTL configuration.
       * </pre>
       *
       * <code>
       * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
       * </code>
       *
       * @param value The enum numeric value on the wire for state to set.
       * @return This builder for chaining.
       */
      public Builder setStateValue(int value) {
        state_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Output only. The state of the TTL configuration.
       * </pre>
       *
       * <code>
       * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
       * </code>
       *
       * @return The state.
       */
      @java.lang.Override
      public com.google.firestore.admin.v1.Field.TtlConfig.State getState() {
        com.google.firestore.admin.v1.Field.TtlConfig.State result =
            com.google.firestore.admin.v1.Field.TtlConfig.State.forNumber(state_);
        return result == null
            ? com.google.firestore.admin.v1.Field.TtlConfig.State.UNRECOGNIZED
            : result;
      }

      /**
       *
       *
       * <pre>
       * Output only. The state of the TTL configuration.
       * </pre>
       *
       * <code>
       * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
       * </code>
       *
       * @param value The state to set.
       * @return This builder for chaining.
       */
      public Builder setState(com.google.firestore.admin.v1.Field.TtlConfig.State value) {
        if (value == null) {
          throw new NullPointerException();
        }
        bitField0_ |= 0x00000001;
        state_ = value.getNumber();
        onChanged();
        return this;
      }

      /**
       *
       *
       * <pre>
       * Output only. The state of the TTL configuration.
       * </pre>
       *
       * <code>
       * .google.firestore.admin.v1.Field.TtlConfig.State state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
       * </code>
       *
       * @return This builder for chaining.
       */
      public Builder clearState() {
        bitField0_ = (bitField0_ & ~0x00000001);
        state_ = 0;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:google.firestore.admin.v1.Field.TtlConfig)
    }

    // @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Field.TtlConfig)
    private static final com.google.firestore.admin.v1.Field.TtlConfig DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.firestore.admin.v1.Field.TtlConfig();
    }

    public static com.google.firestore.admin.v1.Field.TtlConfig getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<TtlConfig> PARSER =
        new com.google.protobuf.AbstractParser<TtlConfig>() {
          @java.lang.Override
          public TtlConfig 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<TtlConfig> parser() {
      return PARSER;
    }

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

    @java.lang.Override
    public com.google.firestore.admin.v1.Field.TtlConfig getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  private int bitField0_;
  public static final int NAME_FIELD_NUMBER = 1;

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

  /**
   *
   *
   * <pre>
   * Required. A field name of the form:
   * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
   *
   * A field path can be a simple field name, e.g. `address` or a path to fields
   * within `map_value` , e.g. `address.city`,
   * or a special field path. The only valid special field is `*`, which
   * represents any field.
   *
   * Field paths can be quoted using `` ` `` (backtick). The only character that
   * must be escaped within a quoted field path is the backtick character
   * itself, escaped using a backslash. Special characters in field paths that
   * must be quoted include: `*`, `.`,
   * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
   *
   * Examples:
   * `` `address.city` `` represents a field named `address.city`, not the map
   * key `city` in the field `address`. `` `*` `` represents a field named `*`,
   * not any field.
   *
   * A special `Field` contains the default indexing settings for all fields.
   * This field's resource name is:
   * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
   * Indexes defined on this `Field` will be applied to all fields which do not
   * have their own `Field` index configuration.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The name.
   */
  @java.lang.Override
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    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();
      name_ = s;
      return s;
    }
  }

  /**
   *
   *
   * <pre>
   * Required. A field name of the form:
   * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
   *
   * A field path can be a simple field name, e.g. `address` or a path to fields
   * within `map_value` , e.g. `address.city`,
   * or a special field path. The only valid special field is `*`, which
   * represents any field.
   *
   * Field paths can be quoted using `` ` `` (backtick). The only character that
   * must be escaped within a quoted field path is the backtick character
   * itself, escaped using a backslash. Special characters in field paths that
   * must be quoted include: `*`, `.`,
   * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
   *
   * Examples:
   * `` `address.city` `` represents a field named `address.city`, not the map
   * key `city` in the field `address`. `` `*` `` represents a field named `*`,
   * not any field.
   *
   * A special `Field` contains the default indexing settings for all fields.
   * This field's resource name is:
   * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
   * Indexes defined on this `Field` will be applied to all fields which do not
   * have their own `Field` index configuration.
   * </pre>
   *
   * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The bytes for name.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int INDEX_CONFIG_FIELD_NUMBER = 2;
  private com.google.firestore.admin.v1.Field.IndexConfig indexConfig_;

  /**
   *
   *
   * <pre>
   * The index configuration for this field. If unset, field indexing will
   * revert to the configuration defined by the `ancestor_field`. To
   * explicitly remove all indexes for this field, specify an index config
   * with an empty list of indexes.
   * </pre>
   *
   * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
   *
   * @return Whether the indexConfig field is set.
   */
  @java.lang.Override
  public boolean hasIndexConfig() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * The index configuration for this field. If unset, field indexing will
   * revert to the configuration defined by the `ancestor_field`. To
   * explicitly remove all indexes for this field, specify an index config
   * with an empty list of indexes.
   * </pre>
   *
   * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
   *
   * @return The indexConfig.
   */
  @java.lang.Override
  public com.google.firestore.admin.v1.Field.IndexConfig getIndexConfig() {
    return indexConfig_ == null
        ? com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance()
        : indexConfig_;
  }

  /**
   *
   *
   * <pre>
   * The index configuration for this field. If unset, field indexing will
   * revert to the configuration defined by the `ancestor_field`. To
   * explicitly remove all indexes for this field, specify an index config
   * with an empty list of indexes.
   * </pre>
   *
   * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
   */
  @java.lang.Override
  public com.google.firestore.admin.v1.Field.IndexConfigOrBuilder getIndexConfigOrBuilder() {
    return indexConfig_ == null
        ? com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance()
        : indexConfig_;
  }

  public static final int TTL_CONFIG_FIELD_NUMBER = 3;
  private com.google.firestore.admin.v1.Field.TtlConfig ttlConfig_;

  /**
   *
   *
   * <pre>
   * The TTL configuration for this `Field`.
   * Setting or unsetting this will enable or disable the TTL for
   * documents that have this `Field`.
   * </pre>
   *
   * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
   *
   * @return Whether the ttlConfig field is set.
   */
  @java.lang.Override
  public boolean hasTtlConfig() {
    return ((bitField0_ & 0x00000002) != 0);
  }

  /**
   *
   *
   * <pre>
   * The TTL configuration for this `Field`.
   * Setting or unsetting this will enable or disable the TTL for
   * documents that have this `Field`.
   * </pre>
   *
   * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
   *
   * @return The ttlConfig.
   */
  @java.lang.Override
  public com.google.firestore.admin.v1.Field.TtlConfig getTtlConfig() {
    return ttlConfig_ == null
        ? com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance()
        : ttlConfig_;
  }

  /**
   *
   *
   * <pre>
   * The TTL configuration for this `Field`.
   * Setting or unsetting this will enable or disable the TTL for
   * documents that have this `Field`.
   * </pre>
   *
   * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
   */
  @java.lang.Override
  public com.google.firestore.admin.v1.Field.TtlConfigOrBuilder getTtlConfigOrBuilder() {
    return ttlConfig_ == null
        ? com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance()
        : ttlConfig_;
  }

  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(name_)) {
      com.google.protobuf.GeneratedMessage.writeString(output, 1, name_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(2, getIndexConfig());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeMessage(3, getTtlConfig());
    }
    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(name_)) {
      size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getIndexConfig());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getTtlConfig());
    }
    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.admin.v1.Field)) {
      return super.equals(obj);
    }
    com.google.firestore.admin.v1.Field other = (com.google.firestore.admin.v1.Field) obj;

    if (!getName().equals(other.getName())) return false;
    if (hasIndexConfig() != other.hasIndexConfig()) return false;
    if (hasIndexConfig()) {
      if (!getIndexConfig().equals(other.getIndexConfig())) return false;
    }
    if (hasTtlConfig() != other.hasTtlConfig()) return false;
    if (hasTtlConfig()) {
      if (!getTtlConfig().equals(other.getTtlConfig())) 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) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    if (hasIndexConfig()) {
      hash = (37 * hash) + INDEX_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getIndexConfig().hashCode();
    }
    if (hasTtlConfig()) {
      hash = (37 * hash) + TTL_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getTtlConfig().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.firestore.admin.v1.Field 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.admin.v1.Field parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.admin.v1.Field 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.admin.v1.Field parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.firestore.admin.v1.Field 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.admin.v1.Field parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.firestore.admin.v1.Field 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.admin.v1.Field parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.firestore.admin.v1.Field 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.admin.v1.Field 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>
   * Represents a single field in the database.
   *
   * Fields are grouped by their "Collection Group", which represent all
   * collections in the database with the same ID.
   * </pre>
   *
   * Protobuf type {@code google.firestore.admin.v1.Field}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.firestore.admin.v1.Field)
      com.google.firestore.admin.v1.FieldOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.admin.v1.FieldProto
          .internal_static_google_firestore_admin_v1_Field_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.admin.v1.FieldProto
          .internal_static_google_firestore_admin_v1_Field_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.admin.v1.Field.class,
              com.google.firestore.admin.v1.Field.Builder.class);
    }

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

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      name_ = "";
      indexConfig_ = null;
      if (indexConfigBuilder_ != null) {
        indexConfigBuilder_.dispose();
        indexConfigBuilder_ = null;
      }
      ttlConfig_ = null;
      if (ttlConfigBuilder_ != null) {
        ttlConfigBuilder_.dispose();
        ttlConfigBuilder_ = null;
      }
      return this;
    }

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

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

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

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

    private void buildPartial0(com.google.firestore.admin.v1.Field result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.name_ = name_;
      }
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.indexConfig_ =
            indexConfigBuilder_ == null ? indexConfig_ : indexConfigBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.ttlConfig_ = ttlConfigBuilder_ == null ? ttlConfig_ : ttlConfigBuilder_.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.admin.v1.Field) {
        return mergeFrom((com.google.firestore.admin.v1.Field) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.firestore.admin.v1.Field other) {
      if (other == com.google.firestore.admin.v1.Field.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (other.hasIndexConfig()) {
        mergeIndexConfig(other.getIndexConfig());
      }
      if (other.hasTtlConfig()) {
        mergeTtlConfig(other.getTtlConfig());
      }
      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:
              {
                name_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                input.readMessage(
                    internalGetIndexConfigFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                input.readMessage(
                    internalGetTtlConfigFieldBuilder().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 java.lang.Object name_ = "";

    /**
     *
     *
     * <pre>
     * Required. A field name of the form:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
     *
     * A field path can be a simple field name, e.g. `address` or a path to fields
     * within `map_value` , e.g. `address.city`,
     * or a special field path. The only valid special field is `*`, which
     * represents any field.
     *
     * Field paths can be quoted using `` ` `` (backtick). The only character that
     * must be escaped within a quoted field path is the backtick character
     * itself, escaped using a backslash. Special characters in field paths that
     * must be quoted include: `*`, `.`,
     * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
     *
     * Examples:
     * `` `address.city` `` represents a field named `address.city`, not the map
     * key `city` in the field `address`. `` `*` `` represents a field named `*`,
     * not any field.
     *
     * A special `Field` contains the default indexing settings for all fields.
     * This field's resource name is:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
     * Indexes defined on this `Field` will be applied to all fields which do not
     * have their own `Field` index configuration.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The name.
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. A field name of the form:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
     *
     * A field path can be a simple field name, e.g. `address` or a path to fields
     * within `map_value` , e.g. `address.city`,
     * or a special field path. The only valid special field is `*`, which
     * represents any field.
     *
     * Field paths can be quoted using `` ` `` (backtick). The only character that
     * must be escaped within a quoted field path is the backtick character
     * itself, escaped using a backslash. Special characters in field paths that
     * must be quoted include: `*`, `.`,
     * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
     *
     * Examples:
     * `` `address.city` `` represents a field named `address.city`, not the map
     * key `city` in the field `address`. `` `*` `` represents a field named `*`,
     * not any field.
     *
     * A special `Field` contains the default indexing settings for all fields.
     * This field's resource name is:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
     * Indexes defined on this `Field` will be applied to all fields which do not
     * have their own `Field` index configuration.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The bytes for name.
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    /**
     *
     *
     * <pre>
     * Required. A field name of the form:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
     *
     * A field path can be a simple field name, e.g. `address` or a path to fields
     * within `map_value` , e.g. `address.city`,
     * or a special field path. The only valid special field is `*`, which
     * represents any field.
     *
     * Field paths can be quoted using `` ` `` (backtick). The only character that
     * must be escaped within a quoted field path is the backtick character
     * itself, escaped using a backslash. Special characters in field paths that
     * must be quoted include: `*`, `.`,
     * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
     *
     * Examples:
     * `` `address.city` `` represents a field named `address.city`, not the map
     * key `city` in the field `address`. `` `*` `` represents a field named `*`,
     * not any field.
     *
     * A special `Field` contains the default indexing settings for all fields.
     * This field's resource name is:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
     * Indexes defined on this `Field` will be applied to all fields which do not
     * have their own `Field` index configuration.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The name to set.
     * @return This builder for chaining.
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      name_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. A field name of the form:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
     *
     * A field path can be a simple field name, e.g. `address` or a path to fields
     * within `map_value` , e.g. `address.city`,
     * or a special field path. The only valid special field is `*`, which
     * represents any field.
     *
     * Field paths can be quoted using `` ` `` (backtick). The only character that
     * must be escaped within a quoted field path is the backtick character
     * itself, escaped using a backslash. Special characters in field paths that
     * must be quoted include: `*`, `.`,
     * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
     *
     * Examples:
     * `` `address.city` `` represents a field named `address.city`, not the map
     * key `city` in the field `address`. `` `*` `` represents a field named `*`,
     * not any field.
     *
     * A special `Field` contains the default indexing settings for all fields.
     * This field's resource name is:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
     * Indexes defined on this `Field` will be applied to all fields which do not
     * have their own `Field` index configuration.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearName() {
      name_ = getDefaultInstance().getName();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Required. A field name of the form:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
     *
     * A field path can be a simple field name, e.g. `address` or a path to fields
     * within `map_value` , e.g. `address.city`,
     * or a special field path. The only valid special field is `*`, which
     * represents any field.
     *
     * Field paths can be quoted using `` ` `` (backtick). The only character that
     * must be escaped within a quoted field path is the backtick character
     * itself, escaped using a backslash. Special characters in field paths that
     * must be quoted include: `*`, `.`,
     * `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
     *
     * Examples:
     * `` `address.city` `` represents a field named `address.city`, not the map
     * key `city` in the field `address`. `` `*` `` represents a field named `*`,
     * not any field.
     *
     * A special `Field` contains the default indexing settings for all fields.
     * This field's resource name is:
     * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/&#42;`
     * Indexes defined on this `Field` will be applied to all fields which do not
     * have their own `Field` index configuration.
     * </pre>
     *
     * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The bytes for name to set.
     * @return This builder for chaining.
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      name_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private com.google.firestore.admin.v1.Field.IndexConfig indexConfig_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.admin.v1.Field.IndexConfig,
            com.google.firestore.admin.v1.Field.IndexConfig.Builder,
            com.google.firestore.admin.v1.Field.IndexConfigOrBuilder>
        indexConfigBuilder_;

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     *
     * @return Whether the indexConfig field is set.
     */
    public boolean hasIndexConfig() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     *
     * @return The indexConfig.
     */
    public com.google.firestore.admin.v1.Field.IndexConfig getIndexConfig() {
      if (indexConfigBuilder_ == null) {
        return indexConfig_ == null
            ? com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance()
            : indexConfig_;
      } else {
        return indexConfigBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    public Builder setIndexConfig(com.google.firestore.admin.v1.Field.IndexConfig value) {
      if (indexConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        indexConfig_ = value;
      } else {
        indexConfigBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    public Builder setIndexConfig(
        com.google.firestore.admin.v1.Field.IndexConfig.Builder builderForValue) {
      if (indexConfigBuilder_ == null) {
        indexConfig_ = builderForValue.build();
      } else {
        indexConfigBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    public Builder mergeIndexConfig(com.google.firestore.admin.v1.Field.IndexConfig value) {
      if (indexConfigBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)
            && indexConfig_ != null
            && indexConfig_
                != com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance()) {
          getIndexConfigBuilder().mergeFrom(value);
        } else {
          indexConfig_ = value;
        }
      } else {
        indexConfigBuilder_.mergeFrom(value);
      }
      if (indexConfig_ != null) {
        bitField0_ |= 0x00000002;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    public Builder clearIndexConfig() {
      bitField0_ = (bitField0_ & ~0x00000002);
      indexConfig_ = null;
      if (indexConfigBuilder_ != null) {
        indexConfigBuilder_.dispose();
        indexConfigBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    public com.google.firestore.admin.v1.Field.IndexConfig.Builder getIndexConfigBuilder() {
      bitField0_ |= 0x00000002;
      onChanged();
      return internalGetIndexConfigFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    public com.google.firestore.admin.v1.Field.IndexConfigOrBuilder getIndexConfigOrBuilder() {
      if (indexConfigBuilder_ != null) {
        return indexConfigBuilder_.getMessageOrBuilder();
      } else {
        return indexConfig_ == null
            ? com.google.firestore.admin.v1.Field.IndexConfig.getDefaultInstance()
            : indexConfig_;
      }
    }

    /**
     *
     *
     * <pre>
     * The index configuration for this field. If unset, field indexing will
     * revert to the configuration defined by the `ancestor_field`. To
     * explicitly remove all indexes for this field, specify an index config
     * with an empty list of indexes.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.IndexConfig index_config = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.admin.v1.Field.IndexConfig,
            com.google.firestore.admin.v1.Field.IndexConfig.Builder,
            com.google.firestore.admin.v1.Field.IndexConfigOrBuilder>
        internalGetIndexConfigFieldBuilder() {
      if (indexConfigBuilder_ == null) {
        indexConfigBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.admin.v1.Field.IndexConfig,
                com.google.firestore.admin.v1.Field.IndexConfig.Builder,
                com.google.firestore.admin.v1.Field.IndexConfigOrBuilder>(
                getIndexConfig(), getParentForChildren(), isClean());
        indexConfig_ = null;
      }
      return indexConfigBuilder_;
    }

    private com.google.firestore.admin.v1.Field.TtlConfig ttlConfig_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.admin.v1.Field.TtlConfig,
            com.google.firestore.admin.v1.Field.TtlConfig.Builder,
            com.google.firestore.admin.v1.Field.TtlConfigOrBuilder>
        ttlConfigBuilder_;

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     *
     * @return Whether the ttlConfig field is set.
     */
    public boolean hasTtlConfig() {
      return ((bitField0_ & 0x00000004) != 0);
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     *
     * @return The ttlConfig.
     */
    public com.google.firestore.admin.v1.Field.TtlConfig getTtlConfig() {
      if (ttlConfigBuilder_ == null) {
        return ttlConfig_ == null
            ? com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance()
            : ttlConfig_;
      } else {
        return ttlConfigBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    public Builder setTtlConfig(com.google.firestore.admin.v1.Field.TtlConfig value) {
      if (ttlConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ttlConfig_ = value;
      } else {
        ttlConfigBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    public Builder setTtlConfig(
        com.google.firestore.admin.v1.Field.TtlConfig.Builder builderForValue) {
      if (ttlConfigBuilder_ == null) {
        ttlConfig_ = builderForValue.build();
      } else {
        ttlConfigBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    public Builder mergeTtlConfig(com.google.firestore.admin.v1.Field.TtlConfig value) {
      if (ttlConfigBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)
            && ttlConfig_ != null
            && ttlConfig_ != com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance()) {
          getTtlConfigBuilder().mergeFrom(value);
        } else {
          ttlConfig_ = value;
        }
      } else {
        ttlConfigBuilder_.mergeFrom(value);
      }
      if (ttlConfig_ != null) {
        bitField0_ |= 0x00000004;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    public Builder clearTtlConfig() {
      bitField0_ = (bitField0_ & ~0x00000004);
      ttlConfig_ = null;
      if (ttlConfigBuilder_ != null) {
        ttlConfigBuilder_.dispose();
        ttlConfigBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    public com.google.firestore.admin.v1.Field.TtlConfig.Builder getTtlConfigBuilder() {
      bitField0_ |= 0x00000004;
      onChanged();
      return internalGetTtlConfigFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    public com.google.firestore.admin.v1.Field.TtlConfigOrBuilder getTtlConfigOrBuilder() {
      if (ttlConfigBuilder_ != null) {
        return ttlConfigBuilder_.getMessageOrBuilder();
      } else {
        return ttlConfig_ == null
            ? com.google.firestore.admin.v1.Field.TtlConfig.getDefaultInstance()
            : ttlConfig_;
      }
    }

    /**
     *
     *
     * <pre>
     * The TTL configuration for this `Field`.
     * Setting or unsetting this will enable or disable the TTL for
     * documents that have this `Field`.
     * </pre>
     *
     * <code>.google.firestore.admin.v1.Field.TtlConfig ttl_config = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.firestore.admin.v1.Field.TtlConfig,
            com.google.firestore.admin.v1.Field.TtlConfig.Builder,
            com.google.firestore.admin.v1.Field.TtlConfigOrBuilder>
        internalGetTtlConfigFieldBuilder() {
      if (ttlConfigBuilder_ == null) {
        ttlConfigBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.firestore.admin.v1.Field.TtlConfig,
                com.google.firestore.admin.v1.Field.TtlConfig.Builder,
                com.google.firestore.admin.v1.Field.TtlConfigOrBuilder>(
                getTtlConfig(), getParentForChildren(), isClean());
        ttlConfig_ = null;
      }
      return ttlConfigBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.firestore.admin.v1.Field)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.firestore.admin.v1.Field();
  }

  public static com.google.firestore.admin.v1.Field getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Field> PARSER =
      new com.google.protobuf.AbstractParser<Field>() {
        @java.lang.Override
        public Field 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<Field> parser() {
    return PARSER;
  }

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

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