/*
 * Copyright 2023 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!
// source: google/cloud/contentwarehouse/v1/document_service.proto

package com.google.cloud.contentwarehouse.v1;

/**
 *
 *
 * <pre>
 * Additional result info for the question-answering feature.
 * </pre>
 *
 * Protobuf type {@code google.cloud.contentwarehouse.v1.QAResult}
 */
public final class QAResult extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.contentwarehouse.v1.QAResult)
    QAResultOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use QAResult.newBuilder() to construct.
  private QAResult(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private QAResult() {
    highlights_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new QAResult();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
        .internal_static_google_cloud_contentwarehouse_v1_QAResult_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
        .internal_static_google_cloud_contentwarehouse_v1_QAResult_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.contentwarehouse.v1.QAResult.class,
            com.google.cloud.contentwarehouse.v1.QAResult.Builder.class);
  }

  public interface HighlightOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.contentwarehouse.v1.QAResult.Highlight)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Start index of the highlight.
     * </pre>
     *
     * <code>int32 start_index = 1;</code>
     *
     * @return The startIndex.
     */
    int getStartIndex();

    /**
     *
     *
     * <pre>
     * End index of the highlight, exclusive.
     * </pre>
     *
     * <code>int32 end_index = 2;</code>
     *
     * @return The endIndex.
     */
    int getEndIndex();
  }
  /**
   *
   *
   * <pre>
   * A text span in the search text snippet that represents a highlighted
   * section (answer context, highly relevant sentence, etc.).
   * </pre>
   *
   * Protobuf type {@code google.cloud.contentwarehouse.v1.QAResult.Highlight}
   */
  public static final class Highlight extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.contentwarehouse.v1.QAResult.Highlight)
      HighlightOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use Highlight.newBuilder() to construct.
    private Highlight(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private Highlight() {}

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
      return new Highlight();
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_QAResult_Highlight_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_QAResult_Highlight_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.contentwarehouse.v1.QAResult.Highlight.class,
              com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder.class);
    }

    public static final int START_INDEX_FIELD_NUMBER = 1;
    private int startIndex_ = 0;
    /**
     *
     *
     * <pre>
     * Start index of the highlight.
     * </pre>
     *
     * <code>int32 start_index = 1;</code>
     *
     * @return The startIndex.
     */
    @java.lang.Override
    public int getStartIndex() {
      return startIndex_;
    }

    public static final int END_INDEX_FIELD_NUMBER = 2;
    private int endIndex_ = 0;
    /**
     *
     *
     * <pre>
     * End index of the highlight, exclusive.
     * </pre>
     *
     * <code>int32 end_index = 2;</code>
     *
     * @return The endIndex.
     */
    @java.lang.Override
    public int getEndIndex() {
      return endIndex_;
    }

    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 (startIndex_ != 0) {
        output.writeInt32(1, startIndex_);
      }
      if (endIndex_ != 0) {
        output.writeInt32(2, endIndex_);
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      if (startIndex_ != 0) {
        size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, startIndex_);
      }
      if (endIndex_ != 0) {
        size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, endIndex_);
      }
      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.cloud.contentwarehouse.v1.QAResult.Highlight)) {
        return super.equals(obj);
      }
      com.google.cloud.contentwarehouse.v1.QAResult.Highlight other =
          (com.google.cloud.contentwarehouse.v1.QAResult.Highlight) obj;

      if (getStartIndex() != other.getStartIndex()) return false;
      if (getEndIndex() != other.getEndIndex()) 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) + START_INDEX_FIELD_NUMBER;
      hash = (53 * hash) + getStartIndex();
      hash = (37 * hash) + END_INDEX_FIELD_NUMBER;
      hash = (53 * hash) + getEndIndex();
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseDelimitedFrom(
        java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
          PARSER, input, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.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.cloud.contentwarehouse.v1.QAResult.Highlight 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.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     *
     *
     * <pre>
     * A text span in the search text snippet that represents a highlighted
     * section (answer context, highly relevant sentence, etc.).
     * </pre>
     *
     * Protobuf type {@code google.cloud.contentwarehouse.v1.QAResult.Highlight}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.contentwarehouse.v1.QAResult.Highlight)
        com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
            .internal_static_google_cloud_contentwarehouse_v1_QAResult_Highlight_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
            .internal_static_google_cloud_contentwarehouse_v1_QAResult_Highlight_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.contentwarehouse.v1.QAResult.Highlight.class,
                com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder.class);
      }

      // Construct using com.google.cloud.contentwarehouse.v1.QAResult.Highlight.newBuilder()
      private Builder() {}

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

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

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
            .internal_static_google_cloud_contentwarehouse_v1_QAResult_Highlight_descriptor;
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.QAResult.Highlight getDefaultInstanceForType() {
        return com.google.cloud.contentwarehouse.v1.QAResult.Highlight.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.QAResult.Highlight build() {
        com.google.cloud.contentwarehouse.v1.QAResult.Highlight result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.QAResult.Highlight buildPartial() {
        com.google.cloud.contentwarehouse.v1.QAResult.Highlight result =
            new com.google.cloud.contentwarehouse.v1.QAResult.Highlight(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(com.google.cloud.contentwarehouse.v1.QAResult.Highlight result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.startIndex_ = startIndex_;
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.endIndex_ = endIndex_;
        }
      }

      @java.lang.Override
      public Builder clone() {
        return super.clone();
      }

      @java.lang.Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.setField(field, value);
      }

      @java.lang.Override
      public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }

      @java.lang.Override
      public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }

      @java.lang.Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index,
          java.lang.Object value) {
        return super.setRepeatedField(field, index, value);
      }

      @java.lang.Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
        return super.addRepeatedField(field, value);
      }

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.cloud.contentwarehouse.v1.QAResult.Highlight) {
          return mergeFrom((com.google.cloud.contentwarehouse.v1.QAResult.Highlight) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.cloud.contentwarehouse.v1.QAResult.Highlight other) {
        if (other == com.google.cloud.contentwarehouse.v1.QAResult.Highlight.getDefaultInstance())
          return this;
        if (other.getStartIndex() != 0) {
          setStartIndex(other.getStartIndex());
        }
        if (other.getEndIndex() != 0) {
          setEndIndex(other.getEndIndex());
        }
        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:
                {
                  startIndex_ = input.readInt32();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 8
              case 16:
                {
                  endIndex_ = input.readInt32();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 16
              default:
                {
                  if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                    done = true; // was an endgroup tag
                  }
                  break;
                } // default:
            } // switch (tag)
          } // while (!done)
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.unwrapIOException();
        } finally {
          onChanged();
        } // finally
        return this;
      }

      private int bitField0_;

      private int startIndex_;
      /**
       *
       *
       * <pre>
       * Start index of the highlight.
       * </pre>
       *
       * <code>int32 start_index = 1;</code>
       *
       * @return The startIndex.
       */
      @java.lang.Override
      public int getStartIndex() {
        return startIndex_;
      }
      /**
       *
       *
       * <pre>
       * Start index of the highlight.
       * </pre>
       *
       * <code>int32 start_index = 1;</code>
       *
       * @param value The startIndex to set.
       * @return This builder for chaining.
       */
      public Builder setStartIndex(int value) {

        startIndex_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Start index of the highlight.
       * </pre>
       *
       * <code>int32 start_index = 1;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearStartIndex() {
        bitField0_ = (bitField0_ & ~0x00000001);
        startIndex_ = 0;
        onChanged();
        return this;
      }

      private int endIndex_;
      /**
       *
       *
       * <pre>
       * End index of the highlight, exclusive.
       * </pre>
       *
       * <code>int32 end_index = 2;</code>
       *
       * @return The endIndex.
       */
      @java.lang.Override
      public int getEndIndex() {
        return endIndex_;
      }
      /**
       *
       *
       * <pre>
       * End index of the highlight, exclusive.
       * </pre>
       *
       * <code>int32 end_index = 2;</code>
       *
       * @param value The endIndex to set.
       * @return This builder for chaining.
       */
      public Builder setEndIndex(int value) {

        endIndex_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * End index of the highlight, exclusive.
       * </pre>
       *
       * <code>int32 end_index = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearEndIndex() {
        bitField0_ = (bitField0_ & ~0x00000002);
        endIndex_ = 0;
        onChanged();
        return this;
      }

      @java.lang.Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.setUnknownFields(unknownFields);
      }

      @java.lang.Override
      public final Builder mergeUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.mergeUnknownFields(unknownFields);
      }

      // @@protoc_insertion_point(builder_scope:google.cloud.contentwarehouse.v1.QAResult.Highlight)
    }

    // @@protoc_insertion_point(class_scope:google.cloud.contentwarehouse.v1.QAResult.Highlight)
    private static final com.google.cloud.contentwarehouse.v1.QAResult.Highlight DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.cloud.contentwarehouse.v1.QAResult.Highlight();
    }

    public static com.google.cloud.contentwarehouse.v1.QAResult.Highlight getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

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

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

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.QAResult.Highlight getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public static final int HIGHLIGHTS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private java.util.List<com.google.cloud.contentwarehouse.v1.QAResult.Highlight> highlights_;
  /**
   *
   *
   * <pre>
   * Highlighted sections in the snippet.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.contentwarehouse.v1.QAResult.Highlight>
      getHighlightsList() {
    return highlights_;
  }
  /**
   *
   *
   * <pre>
   * Highlighted sections in the snippet.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder>
      getHighlightsOrBuilderList() {
    return highlights_;
  }
  /**
   *
   *
   * <pre>
   * Highlighted sections in the snippet.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
   */
  @java.lang.Override
  public int getHighlightsCount() {
    return highlights_.size();
  }
  /**
   *
   *
   * <pre>
   * Highlighted sections in the snippet.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.QAResult.Highlight getHighlights(int index) {
    return highlights_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Highlighted sections in the snippet.
   * </pre>
   *
   * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder getHighlightsOrBuilder(
      int index) {
    return highlights_.get(index);
  }

  public static final int CONFIDENCE_SCORE_FIELD_NUMBER = 2;
  private float confidenceScore_ = 0F;
  /**
   *
   *
   * <pre>
   * The calibrated confidence score for this document, in the range
   * [0., 1.]. This represents the confidence level for whether the returned
   * document and snippet answers the user's query.
   * </pre>
   *
   * <code>float confidence_score = 2;</code>
   *
   * @return The confidenceScore.
   */
  @java.lang.Override
  public float getConfidenceScore() {
    return confidenceScore_;
  }

  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 < highlights_.size(); i++) {
      output.writeMessage(1, highlights_.get(i));
    }
    if (java.lang.Float.floatToRawIntBits(confidenceScore_) != 0) {
      output.writeFloat(2, confidenceScore_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    for (int i = 0; i < highlights_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, highlights_.get(i));
    }
    if (java.lang.Float.floatToRawIntBits(confidenceScore_) != 0) {
      size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidenceScore_);
    }
    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.cloud.contentwarehouse.v1.QAResult)) {
      return super.equals(obj);
    }
    com.google.cloud.contentwarehouse.v1.QAResult other =
        (com.google.cloud.contentwarehouse.v1.QAResult) obj;

    if (!getHighlightsList().equals(other.getHighlightsList())) return false;
    if (java.lang.Float.floatToIntBits(getConfidenceScore())
        != java.lang.Float.floatToIntBits(other.getConfidenceScore())) 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 (getHighlightsCount() > 0) {
      hash = (37 * hash) + HIGHLIGHTS_FIELD_NUMBER;
      hash = (53 * hash) + getHighlightsList().hashCode();
    }
    hash = (37 * hash) + CONFIDENCE_SCORE_FIELD_NUMBER;
    hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidenceScore());
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.cloud.contentwarehouse.v1.QAResult parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.cloud.contentwarehouse.v1.QAResult parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.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.cloud.contentwarehouse.v1.QAResult 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.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * Additional result info for the question-answering feature.
   * </pre>
   *
   * Protobuf type {@code google.cloud.contentwarehouse.v1.QAResult}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.contentwarehouse.v1.QAResult)
      com.google.cloud.contentwarehouse.v1.QAResultOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_QAResult_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_QAResult_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.contentwarehouse.v1.QAResult.class,
              com.google.cloud.contentwarehouse.v1.QAResult.Builder.class);
    }

    // Construct using com.google.cloud.contentwarehouse.v1.QAResult.newBuilder()
    private Builder() {}

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

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

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_QAResult_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.QAResult getDefaultInstanceForType() {
      return com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance();
    }

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

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

    private void buildPartialRepeatedFields(com.google.cloud.contentwarehouse.v1.QAResult result) {
      if (highlightsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          highlights_ = java.util.Collections.unmodifiableList(highlights_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.highlights_ = highlights_;
      } else {
        result.highlights_ = highlightsBuilder_.build();
      }
    }

    private void buildPartial0(com.google.cloud.contentwarehouse.v1.QAResult result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.confidenceScore_ = confidenceScore_;
      }
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

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

    public Builder mergeFrom(com.google.cloud.contentwarehouse.v1.QAResult other) {
      if (other == com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance()) return this;
      if (highlightsBuilder_ == null) {
        if (!other.highlights_.isEmpty()) {
          if (highlights_.isEmpty()) {
            highlights_ = other.highlights_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureHighlightsIsMutable();
            highlights_.addAll(other.highlights_);
          }
          onChanged();
        }
      } else {
        if (!other.highlights_.isEmpty()) {
          if (highlightsBuilder_.isEmpty()) {
            highlightsBuilder_.dispose();
            highlightsBuilder_ = null;
            highlights_ = other.highlights_;
            bitField0_ = (bitField0_ & ~0x00000001);
            highlightsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getHighlightsFieldBuilder()
                    : null;
          } else {
            highlightsBuilder_.addAllMessages(other.highlights_);
          }
        }
      }
      if (other.getConfidenceScore() != 0F) {
        setConfidenceScore(other.getConfidenceScore());
      }
      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.cloud.contentwarehouse.v1.QAResult.Highlight m =
                    input.readMessage(
                        com.google.cloud.contentwarehouse.v1.QAResult.Highlight.parser(),
                        extensionRegistry);
                if (highlightsBuilder_ == null) {
                  ensureHighlightsIsMutable();
                  highlights_.add(m);
                } else {
                  highlightsBuilder_.addMessage(m);
                }
                break;
              } // case 10
            case 21:
              {
                confidenceScore_ = input.readFloat();
                bitField0_ |= 0x00000002;
                break;
              } // case 21
            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.cloud.contentwarehouse.v1.QAResult.Highlight> highlights_ =
        java.util.Collections.emptyList();

    private void ensureHighlightsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        highlights_ =
            new java.util.ArrayList<com.google.cloud.contentwarehouse.v1.QAResult.Highlight>(
                highlights_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.QAResult.Highlight,
            com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder,
            com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder>
        highlightsBuilder_;

    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public java.util.List<com.google.cloud.contentwarehouse.v1.QAResult.Highlight>
        getHighlightsList() {
      if (highlightsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(highlights_);
      } else {
        return highlightsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public int getHighlightsCount() {
      if (highlightsBuilder_ == null) {
        return highlights_.size();
      } else {
        return highlightsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public com.google.cloud.contentwarehouse.v1.QAResult.Highlight getHighlights(int index) {
      if (highlightsBuilder_ == null) {
        return highlights_.get(index);
      } else {
        return highlightsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder setHighlights(
        int index, com.google.cloud.contentwarehouse.v1.QAResult.Highlight value) {
      if (highlightsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureHighlightsIsMutable();
        highlights_.set(index, value);
        onChanged();
      } else {
        highlightsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder setHighlights(
        int index,
        com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder builderForValue) {
      if (highlightsBuilder_ == null) {
        ensureHighlightsIsMutable();
        highlights_.set(index, builderForValue.build());
        onChanged();
      } else {
        highlightsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder addHighlights(com.google.cloud.contentwarehouse.v1.QAResult.Highlight value) {
      if (highlightsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureHighlightsIsMutable();
        highlights_.add(value);
        onChanged();
      } else {
        highlightsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder addHighlights(
        int index, com.google.cloud.contentwarehouse.v1.QAResult.Highlight value) {
      if (highlightsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureHighlightsIsMutable();
        highlights_.add(index, value);
        onChanged();
      } else {
        highlightsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder addHighlights(
        com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder builderForValue) {
      if (highlightsBuilder_ == null) {
        ensureHighlightsIsMutable();
        highlights_.add(builderForValue.build());
        onChanged();
      } else {
        highlightsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder addHighlights(
        int index,
        com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder builderForValue) {
      if (highlightsBuilder_ == null) {
        ensureHighlightsIsMutable();
        highlights_.add(index, builderForValue.build());
        onChanged();
      } else {
        highlightsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder addAllHighlights(
        java.lang.Iterable<? extends com.google.cloud.contentwarehouse.v1.QAResult.Highlight>
            values) {
      if (highlightsBuilder_ == null) {
        ensureHighlightsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, highlights_);
        onChanged();
      } else {
        highlightsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder clearHighlights() {
      if (highlightsBuilder_ == null) {
        highlights_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        highlightsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public Builder removeHighlights(int index) {
      if (highlightsBuilder_ == null) {
        ensureHighlightsIsMutable();
        highlights_.remove(index);
        onChanged();
      } else {
        highlightsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder getHighlightsBuilder(
        int index) {
      return getHighlightsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder getHighlightsOrBuilder(
        int index) {
      if (highlightsBuilder_ == null) {
        return highlights_.get(index);
      } else {
        return highlightsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public java.util.List<
            ? extends com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder>
        getHighlightsOrBuilderList() {
      if (highlightsBuilder_ != null) {
        return highlightsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(highlights_);
      }
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder addHighlightsBuilder() {
      return getHighlightsFieldBuilder()
          .addBuilder(com.google.cloud.contentwarehouse.v1.QAResult.Highlight.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder addHighlightsBuilder(
        int index) {
      return getHighlightsFieldBuilder()
          .addBuilder(
              index, com.google.cloud.contentwarehouse.v1.QAResult.Highlight.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Highlighted sections in the snippet.
     * </pre>
     *
     * <code>repeated .google.cloud.contentwarehouse.v1.QAResult.Highlight highlights = 1;</code>
     */
    public java.util.List<com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder>
        getHighlightsBuilderList() {
      return getHighlightsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.QAResult.Highlight,
            com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder,
            com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder>
        getHighlightsFieldBuilder() {
      if (highlightsBuilder_ == null) {
        highlightsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.contentwarehouse.v1.QAResult.Highlight,
                com.google.cloud.contentwarehouse.v1.QAResult.Highlight.Builder,
                com.google.cloud.contentwarehouse.v1.QAResult.HighlightOrBuilder>(
                highlights_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
        highlights_ = null;
      }
      return highlightsBuilder_;
    }

    private float confidenceScore_;
    /**
     *
     *
     * <pre>
     * The calibrated confidence score for this document, in the range
     * [0., 1.]. This represents the confidence level for whether the returned
     * document and snippet answers the user's query.
     * </pre>
     *
     * <code>float confidence_score = 2;</code>
     *
     * @return The confidenceScore.
     */
    @java.lang.Override
    public float getConfidenceScore() {
      return confidenceScore_;
    }
    /**
     *
     *
     * <pre>
     * The calibrated confidence score for this document, in the range
     * [0., 1.]. This represents the confidence level for whether the returned
     * document and snippet answers the user's query.
     * </pre>
     *
     * <code>float confidence_score = 2;</code>
     *
     * @param value The confidenceScore to set.
     * @return This builder for chaining.
     */
    public Builder setConfidenceScore(float value) {

      confidenceScore_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The calibrated confidence score for this document, in the range
     * [0., 1.]. This represents the confidence level for whether the returned
     * document and snippet answers the user's query.
     * </pre>
     *
     * <code>float confidence_score = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearConfidenceScore() {
      bitField0_ = (bitField0_ & ~0x00000002);
      confidenceScore_ = 0F;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.contentwarehouse.v1.QAResult)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.contentwarehouse.v1.QAResult)
  private static final com.google.cloud.contentwarehouse.v1.QAResult DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.contentwarehouse.v1.QAResult();
  }

  public static com.google.cloud.contentwarehouse.v1.QAResult getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.QAResult getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
