// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/dialogflow/v2beta1/document.proto

package com.google.cloud.dialogflow.v2beta1;

/**
 * <pre>
 * A document resource.
 * </pre>
 *
 * Protobuf type {@code google.cloud.dialogflow.v2beta1.Document}
 */
public  final class Document extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.v2beta1.Document)
    DocumentOrBuilder {
private static final long serialVersionUID = 0L;
  // Use Document.newBuilder() to construct.
  private Document(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private Document() {
    name_ = "";
    displayName_ = "";
    mimeType_ = "";
    knowledgeTypes_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private Document(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            name_ = s;
            break;
          }
          case 18: {
            java.lang.String s = input.readStringRequireUtf8();

            displayName_ = s;
            break;
          }
          case 26: {
            java.lang.String s = input.readStringRequireUtf8();

            mimeType_ = s;
            break;
          }
          case 32: {
            int rawValue = input.readEnum();
            if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
              knowledgeTypes_ = new java.util.ArrayList<java.lang.Integer>();
              mutable_bitField0_ |= 0x00000008;
            }
            knowledgeTypes_.add(rawValue);
            break;
          }
          case 34: {
            int length = input.readRawVarint32();
            int oldLimit = input.pushLimit(length);
            while(input.getBytesUntilLimit() > 0) {
              int rawValue = input.readEnum();
              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                knowledgeTypes_ = new java.util.ArrayList<java.lang.Integer>();
                mutable_bitField0_ |= 0x00000008;
              }
              knowledgeTypes_.add(rawValue);
            }
            input.popLimit(oldLimit);
            break;
          }
          case 42: {
            java.lang.String s = input.readStringRequireUtf8();
            sourceCase_ = 5;
            source_ = s;
            break;
          }
          case 50: {
            java.lang.String s = input.readStringRequireUtf8();
            sourceCase_ = 6;
            source_ = s;
            break;
          }
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
        knowledgeTypes_ = java.util.Collections.unmodifiableList(knowledgeTypes_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.cloud.dialogflow.v2beta1.DocumentProto.internal_static_google_cloud_dialogflow_v2beta1_Document_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.dialogflow.v2beta1.DocumentProto.internal_static_google_cloud_dialogflow_v2beta1_Document_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.dialogflow.v2beta1.Document.class, com.google.cloud.dialogflow.v2beta1.Document.Builder.class);
  }

  /**
   * <pre>
   * The knowledge type of document content.
   * </pre>
   *
   * Protobuf enum {@code google.cloud.dialogflow.v2beta1.Document.KnowledgeType}
   */
  public enum KnowledgeType
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     * <pre>
     * The type is unspecified or arbitrary.
     * </pre>
     *
     * <code>KNOWLEDGE_TYPE_UNSPECIFIED = 0;</code>
     */
    KNOWLEDGE_TYPE_UNSPECIFIED(0),
    /**
     * <pre>
     * The document content contains question and answer pairs as either HTML or
     * CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats
     * may fail to be parsed.
     * CSV must have questions in the first column and answers in the second,
     * with no header. Because of this explicit format, they are always parsed
     * accurately.
     * </pre>
     *
     * <code>FAQ = 1;</code>
     */
    FAQ(1),
    /**
     * <pre>
     * Documents for which unstructured text is extracted and used for
     * question answering.
     * </pre>
     *
     * <code>EXTRACTIVE_QA = 2;</code>
     */
    EXTRACTIVE_QA(2),
    UNRECOGNIZED(-1),
    ;

    /**
     * <pre>
     * The type is unspecified or arbitrary.
     * </pre>
     *
     * <code>KNOWLEDGE_TYPE_UNSPECIFIED = 0;</code>
     */
    public static final int KNOWLEDGE_TYPE_UNSPECIFIED_VALUE = 0;
    /**
     * <pre>
     * The document content contains question and answer pairs as either HTML or
     * CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats
     * may fail to be parsed.
     * CSV must have questions in the first column and answers in the second,
     * with no header. Because of this explicit format, they are always parsed
     * accurately.
     * </pre>
     *
     * <code>FAQ = 1;</code>
     */
    public static final int FAQ_VALUE = 1;
    /**
     * <pre>
     * Documents for which unstructured text is extracted and used for
     * question answering.
     * </pre>
     *
     * <code>EXTRACTIVE_QA = 2;</code>
     */
    public static final int EXTRACTIVE_QA_VALUE = 2;


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

    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static KnowledgeType valueOf(int value) {
      return forNumber(value);
    }

    public static KnowledgeType forNumber(int value) {
      switch (value) {
        case 0: return KNOWLEDGE_TYPE_UNSPECIFIED;
        case 1: return FAQ;
        case 2: return EXTRACTIVE_QA;
        default: return null;
      }
    }

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

    public final com.google.protobuf.Descriptors.EnumValueDescriptor
        getValueDescriptor() {
      return getDescriptor().getValues().get(ordinal());
    }
    public final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptorForType() {
      return getDescriptor();
    }
    public static final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptor() {
      return com.google.cloud.dialogflow.v2beta1.Document.getDescriptor().getEnumTypes().get(0);
    }

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

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

    // @@protoc_insertion_point(enum_scope:google.cloud.dialogflow.v2beta1.Document.KnowledgeType)
  }

  private int bitField0_;
  private int sourceCase_ = 0;
  private java.lang.Object source_;
  public enum SourceCase
      implements com.google.protobuf.Internal.EnumLite {
    CONTENT_URI(5),
    CONTENT(6),
    SOURCE_NOT_SET(0);
    private final int value;
    private SourceCase(int value) {
      this.value = value;
    }
    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static SourceCase valueOf(int value) {
      return forNumber(value);
    }

    public static SourceCase forNumber(int value) {
      switch (value) {
        case 5: return CONTENT_URI;
        case 6: return CONTENT;
        case 0: return SOURCE_NOT_SET;
        default: return null;
      }
    }
    public int getNumber() {
      return this.value;
    }
  };

  public SourceCase
  getSourceCase() {
    return SourceCase.forNumber(
        sourceCase_);
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   * <pre>
   * The document resource name.
   * The name must be empty when creating a document.
   * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
   * ID&gt;/documents/&lt;Document ID&gt;`.
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  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>
   * The document resource name.
   * The name must be empty when creating a document.
   * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
   * ID&gt;/documents/&lt;Document ID&gt;`.
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  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 DISPLAY_NAME_FIELD_NUMBER = 2;
  private volatile java.lang.Object displayName_;
  /**
   * <pre>
   * Required. The display name of the document. The name must be 1024 bytes or
   * less; otherwise, the creation request fails.
   * </pre>
   *
   * <code>string display_name = 2;</code>
   */
  public java.lang.String getDisplayName() {
    java.lang.Object ref = displayName_;
    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();
      displayName_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Required. The display name of the document. The name must be 1024 bytes or
   * less; otherwise, the creation request fails.
   * </pre>
   *
   * <code>string display_name = 2;</code>
   */
  public com.google.protobuf.ByteString
      getDisplayNameBytes() {
    java.lang.Object ref = displayName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      displayName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int MIME_TYPE_FIELD_NUMBER = 3;
  private volatile java.lang.Object mimeType_;
  /**
   * <pre>
   * Required. The MIME type of this document.
   * </pre>
   *
   * <code>string mime_type = 3;</code>
   */
  public java.lang.String getMimeType() {
    java.lang.Object ref = mimeType_;
    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();
      mimeType_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Required. The MIME type of this document.
   * </pre>
   *
   * <code>string mime_type = 3;</code>
   */
  public com.google.protobuf.ByteString
      getMimeTypeBytes() {
    java.lang.Object ref = mimeType_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      mimeType_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int KNOWLEDGE_TYPES_FIELD_NUMBER = 4;
  private java.util.List<java.lang.Integer> knowledgeTypes_;
  private static final com.google.protobuf.Internal.ListAdapter.Converter<
      java.lang.Integer, com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType> knowledgeTypes_converter_ =
          new com.google.protobuf.Internal.ListAdapter.Converter<
              java.lang.Integer, com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType>() {
            public com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType convert(java.lang.Integer from) {
              @SuppressWarnings("deprecation")
              com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType result = com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType.valueOf(from);
              return result == null ? com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType.UNRECOGNIZED : result;
            }
          };
  /**
   * <pre>
   * Required. The knowledge type of document content.
   * </pre>
   *
   * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
   */
  public java.util.List<com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType> getKnowledgeTypesList() {
    return new com.google.protobuf.Internal.ListAdapter<
        java.lang.Integer, com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType>(knowledgeTypes_, knowledgeTypes_converter_);
  }
  /**
   * <pre>
   * Required. The knowledge type of document content.
   * </pre>
   *
   * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
   */
  public int getKnowledgeTypesCount() {
    return knowledgeTypes_.size();
  }
  /**
   * <pre>
   * Required. The knowledge type of document content.
   * </pre>
   *
   * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType getKnowledgeTypes(int index) {
    return knowledgeTypes_converter_.convert(knowledgeTypes_.get(index));
  }
  /**
   * <pre>
   * Required. The knowledge type of document content.
   * </pre>
   *
   * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
   */
  public java.util.List<java.lang.Integer>
  getKnowledgeTypesValueList() {
    return knowledgeTypes_;
  }
  /**
   * <pre>
   * Required. The knowledge type of document content.
   * </pre>
   *
   * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
   */
  public int getKnowledgeTypesValue(int index) {
    return knowledgeTypes_.get(index);
  }
  private int knowledgeTypesMemoizedSerializedSize;

  public static final int CONTENT_URI_FIELD_NUMBER = 5;
  /**
   * <pre>
   * The URI where the file content is located.
   * For documents stored in Google Cloud Storage, these URIs must have
   * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
   * NOTE: External URLs must correspond to public webpages, i.e., they must
   * be indexed by Google Search. In particular, URLs for showing documents in
   * Google Cloud Storage (i.e. the URL in your browser) are not supported.
   * Instead use the `gs://` format URI described above.
   * </pre>
   *
   * <code>string content_uri = 5;</code>
   */
  public java.lang.String getContentUri() {
    java.lang.Object ref = "";
    if (sourceCase_ == 5) {
      ref = source_;
    }
    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();
      if (sourceCase_ == 5) {
        source_ = s;
      }
      return s;
    }
  }
  /**
   * <pre>
   * The URI where the file content is located.
   * For documents stored in Google Cloud Storage, these URIs must have
   * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
   * NOTE: External URLs must correspond to public webpages, i.e., they must
   * be indexed by Google Search. In particular, URLs for showing documents in
   * Google Cloud Storage (i.e. the URL in your browser) are not supported.
   * Instead use the `gs://` format URI described above.
   * </pre>
   *
   * <code>string content_uri = 5;</code>
   */
  public com.google.protobuf.ByteString
      getContentUriBytes() {
    java.lang.Object ref = "";
    if (sourceCase_ == 5) {
      ref = source_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      if (sourceCase_ == 5) {
        source_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CONTENT_FIELD_NUMBER = 6;
  /**
   * <pre>
   * The raw content of the document. This field is only permitted for
   * EXTRACTIVE_QA and FAQ knowledge types.
   * </pre>
   *
   * <code>string content = 6;</code>
   */
  public java.lang.String getContent() {
    java.lang.Object ref = "";
    if (sourceCase_ == 6) {
      ref = source_;
    }
    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();
      if (sourceCase_ == 6) {
        source_ = s;
      }
      return s;
    }
  }
  /**
   * <pre>
   * The raw content of the document. This field is only permitted for
   * EXTRACTIVE_QA and FAQ knowledge types.
   * </pre>
   *
   * <code>string content = 6;</code>
   */
  public com.google.protobuf.ByteString
      getContentBytes() {
    java.lang.Object ref = "";
    if (sourceCase_ == 6) {
      ref = source_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      if (sourceCase_ == 6) {
        source_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    getSerializedSize();
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_);
    }
    if (!getMimeTypeBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, mimeType_);
    }
    if (getKnowledgeTypesList().size() > 0) {
      output.writeUInt32NoTag(34);
      output.writeUInt32NoTag(knowledgeTypesMemoizedSerializedSize);
    }
    for (int i = 0; i < knowledgeTypes_.size(); i++) {
      output.writeEnumNoTag(knowledgeTypes_.get(i));
    }
    if (sourceCase_ == 5) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 5, source_);
    }
    if (sourceCase_ == 6) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, source_);
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_);
    }
    if (!getMimeTypeBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, mimeType_);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < knowledgeTypes_.size(); i++) {
        dataSize += com.google.protobuf.CodedOutputStream
          .computeEnumSizeNoTag(knowledgeTypes_.get(i));
      }
      size += dataSize;
      if (!getKnowledgeTypesList().isEmpty()) {  size += 1;
        size += com.google.protobuf.CodedOutputStream
          .computeUInt32SizeNoTag(dataSize);
      }knowledgeTypesMemoizedSerializedSize = dataSize;
    }
    if (sourceCase_ == 5) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, source_);
    }
    if (sourceCase_ == 6) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, source_);
    }
    size += unknownFields.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.dialogflow.v2beta1.Document)) {
      return super.equals(obj);
    }
    com.google.cloud.dialogflow.v2beta1.Document other = (com.google.cloud.dialogflow.v2beta1.Document) obj;

    boolean result = true;
    result = result && getName()
        .equals(other.getName());
    result = result && getDisplayName()
        .equals(other.getDisplayName());
    result = result && getMimeType()
        .equals(other.getMimeType());
    result = result && knowledgeTypes_.equals(other.knowledgeTypes_);
    result = result && getSourceCase().equals(
        other.getSourceCase());
    if (!result) return false;
    switch (sourceCase_) {
      case 5:
        result = result && getContentUri()
            .equals(other.getContentUri());
        break;
      case 6:
        result = result && getContent()
            .equals(other.getContent());
        break;
      case 0:
      default:
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @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();
    hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getDisplayName().hashCode();
    hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER;
    hash = (53 * hash) + getMimeType().hashCode();
    if (getKnowledgeTypesCount() > 0) {
      hash = (37 * hash) + KNOWLEDGE_TYPES_FIELD_NUMBER;
      hash = (53 * hash) + knowledgeTypes_.hashCode();
    }
    switch (sourceCase_) {
      case 5:
        hash = (37 * hash) + CONTENT_URI_FIELD_NUMBER;
        hash = (53 * hash) + getContentUri().hashCode();
        break;
      case 6:
        hash = (37 * hash) + CONTENT_FIELD_NUMBER;
        hash = (53 * hash) + getContent().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.dialogflow.v2beta1.Document parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document 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.dialogflow.v2beta1.Document parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document 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.dialogflow.v2beta1.Document parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document 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.dialogflow.v2beta1.Document parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document 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.dialogflow.v2beta1.Document parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.dialogflow.v2beta1.Document 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.dialogflow.v2beta1.Document 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 document resource.
   * </pre>
   *
   * Protobuf type {@code google.cloud.dialogflow.v2beta1.Document}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.v2beta1.Document)
      com.google.cloud.dialogflow.v2beta1.DocumentOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.cloud.dialogflow.v2beta1.DocumentProto.internal_static_google_cloud_dialogflow_v2beta1_Document_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.dialogflow.v2beta1.DocumentProto.internal_static_google_cloud_dialogflow_v2beta1_Document_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.dialogflow.v2beta1.Document.class, com.google.cloud.dialogflow.v2beta1.Document.Builder.class);
    }

    // Construct using com.google.cloud.dialogflow.v2beta1.Document.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      name_ = "";

      displayName_ = "";

      mimeType_ = "";

      knowledgeTypes_ = java.util.Collections.emptyList();
      bitField0_ = (bitField0_ & ~0x00000008);
      sourceCase_ = 0;
      source_ = null;
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.cloud.dialogflow.v2beta1.DocumentProto.internal_static_google_cloud_dialogflow_v2beta1_Document_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.dialogflow.v2beta1.Document getDefaultInstanceForType() {
      return com.google.cloud.dialogflow.v2beta1.Document.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.dialogflow.v2beta1.Document buildPartial() {
      com.google.cloud.dialogflow.v2beta1.Document result = new com.google.cloud.dialogflow.v2beta1.Document(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.name_ = name_;
      result.displayName_ = displayName_;
      result.mimeType_ = mimeType_;
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        knowledgeTypes_ = java.util.Collections.unmodifiableList(knowledgeTypes_);
        bitField0_ = (bitField0_ & ~0x00000008);
      }
      result.knowledgeTypes_ = knowledgeTypes_;
      if (sourceCase_ == 5) {
        result.source_ = source_;
      }
      if (sourceCase_ == 6) {
        result.source_ = source_;
      }
      result.bitField0_ = to_bitField0_;
      result.sourceCase_ = sourceCase_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return (Builder) super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.dialogflow.v2beta1.Document) {
        return mergeFrom((com.google.cloud.dialogflow.v2beta1.Document)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.dialogflow.v2beta1.Document other) {
      if (other == com.google.cloud.dialogflow.v2beta1.Document.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getDisplayName().isEmpty()) {
        displayName_ = other.displayName_;
        onChanged();
      }
      if (!other.getMimeType().isEmpty()) {
        mimeType_ = other.mimeType_;
        onChanged();
      }
      if (!other.knowledgeTypes_.isEmpty()) {
        if (knowledgeTypes_.isEmpty()) {
          knowledgeTypes_ = other.knowledgeTypes_;
          bitField0_ = (bitField0_ & ~0x00000008);
        } else {
          ensureKnowledgeTypesIsMutable();
          knowledgeTypes_.addAll(other.knowledgeTypes_);
        }
        onChanged();
      }
      switch (other.getSourceCase()) {
        case CONTENT_URI: {
          sourceCase_ = 5;
          source_ = other.source_;
          onChanged();
          break;
        }
        case CONTENT: {
          sourceCase_ = 6;
          source_ = other.source_;
          onChanged();
          break;
        }
        case SOURCE_NOT_SET: {
          break;
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      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 {
      com.google.cloud.dialogflow.v2beta1.Document parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.dialogflow.v2beta1.Document) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int sourceCase_ = 0;
    private java.lang.Object source_;
    public SourceCase
        getSourceCase() {
      return SourceCase.forNumber(
          sourceCase_);
    }

    public Builder clearSource() {
      sourceCase_ = 0;
      source_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private java.lang.Object name_ = "";
    /**
     * <pre>
     * The document resource name.
     * The name must be empty when creating a document.
     * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
     * ID&gt;/documents/&lt;Document ID&gt;`.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    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>
     * The document resource name.
     * The name must be empty when creating a document.
     * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
     * ID&gt;/documents/&lt;Document ID&gt;`.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    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>
     * The document resource name.
     * The name must be empty when creating a document.
     * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
     * ID&gt;/documents/&lt;Document ID&gt;`.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      name_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The document resource name.
     * The name must be empty when creating a document.
     * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
     * ID&gt;/documents/&lt;Document ID&gt;`.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder clearName() {
      
      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The document resource name.
     * The name must be empty when creating a document.
     * Format: `projects/&lt;Project ID&gt;/knowledgeBases/&lt;Knowledge Base
     * ID&gt;/documents/&lt;Document ID&gt;`.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      name_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object displayName_ = "";
    /**
     * <pre>
     * Required. The display name of the document. The name must be 1024 bytes or
     * less; otherwise, the creation request fails.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public java.lang.String getDisplayName() {
      java.lang.Object ref = displayName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        displayName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Required. The display name of the document. The name must be 1024 bytes or
     * less; otherwise, the creation request fails.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public com.google.protobuf.ByteString
        getDisplayNameBytes() {
      java.lang.Object ref = displayName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        displayName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Required. The display name of the document. The name must be 1024 bytes or
     * less; otherwise, the creation request fails.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public Builder setDisplayName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      displayName_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The display name of the document. The name must be 1024 bytes or
     * less; otherwise, the creation request fails.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public Builder clearDisplayName() {
      
      displayName_ = getDefaultInstance().getDisplayName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The display name of the document. The name must be 1024 bytes or
     * less; otherwise, the creation request fails.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public Builder setDisplayNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      displayName_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object mimeType_ = "";
    /**
     * <pre>
     * Required. The MIME type of this document.
     * </pre>
     *
     * <code>string mime_type = 3;</code>
     */
    public java.lang.String getMimeType() {
      java.lang.Object ref = mimeType_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        mimeType_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Required. The MIME type of this document.
     * </pre>
     *
     * <code>string mime_type = 3;</code>
     */
    public com.google.protobuf.ByteString
        getMimeTypeBytes() {
      java.lang.Object ref = mimeType_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        mimeType_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Required. The MIME type of this document.
     * </pre>
     *
     * <code>string mime_type = 3;</code>
     */
    public Builder setMimeType(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      mimeType_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The MIME type of this document.
     * </pre>
     *
     * <code>string mime_type = 3;</code>
     */
    public Builder clearMimeType() {
      
      mimeType_ = getDefaultInstance().getMimeType();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The MIME type of this document.
     * </pre>
     *
     * <code>string mime_type = 3;</code>
     */
    public Builder setMimeTypeBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      mimeType_ = value;
      onChanged();
      return this;
    }

    private java.util.List<java.lang.Integer> knowledgeTypes_ =
      java.util.Collections.emptyList();
    private void ensureKnowledgeTypesIsMutable() {
      if (!((bitField0_ & 0x00000008) == 0x00000008)) {
        knowledgeTypes_ = new java.util.ArrayList<java.lang.Integer>(knowledgeTypes_);
        bitField0_ |= 0x00000008;
      }
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public java.util.List<com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType> getKnowledgeTypesList() {
      return new com.google.protobuf.Internal.ListAdapter<
          java.lang.Integer, com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType>(knowledgeTypes_, knowledgeTypes_converter_);
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public int getKnowledgeTypesCount() {
      return knowledgeTypes_.size();
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType getKnowledgeTypes(int index) {
      return knowledgeTypes_converter_.convert(knowledgeTypes_.get(index));
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder setKnowledgeTypes(
        int index, com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureKnowledgeTypesIsMutable();
      knowledgeTypes_.set(index, value.getNumber());
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder addKnowledgeTypes(com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureKnowledgeTypesIsMutable();
      knowledgeTypes_.add(value.getNumber());
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder addAllKnowledgeTypes(
        java.lang.Iterable<? extends com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType> values) {
      ensureKnowledgeTypesIsMutable();
      for (com.google.cloud.dialogflow.v2beta1.Document.KnowledgeType value : values) {
        knowledgeTypes_.add(value.getNumber());
      }
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder clearKnowledgeTypes() {
      knowledgeTypes_ = java.util.Collections.emptyList();
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public java.util.List<java.lang.Integer>
    getKnowledgeTypesValueList() {
      return java.util.Collections.unmodifiableList(knowledgeTypes_);
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public int getKnowledgeTypesValue(int index) {
      return knowledgeTypes_.get(index);
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder setKnowledgeTypesValue(
        int index, int value) {
      ensureKnowledgeTypesIsMutable();
      knowledgeTypes_.set(index, value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder addKnowledgeTypesValue(int value) {
      ensureKnowledgeTypesIsMutable();
      knowledgeTypes_.add(value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The knowledge type of document content.
     * </pre>
     *
     * <code>repeated .google.cloud.dialogflow.v2beta1.Document.KnowledgeType knowledge_types = 4;</code>
     */
    public Builder addAllKnowledgeTypesValue(
        java.lang.Iterable<java.lang.Integer> values) {
      ensureKnowledgeTypesIsMutable();
      for (int value : values) {
        knowledgeTypes_.add(value);
      }
      onChanged();
      return this;
    }

    /**
     * <pre>
     * The URI where the file content is located.
     * For documents stored in Google Cloud Storage, these URIs must have
     * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
     * NOTE: External URLs must correspond to public webpages, i.e., they must
     * be indexed by Google Search. In particular, URLs for showing documents in
     * Google Cloud Storage (i.e. the URL in your browser) are not supported.
     * Instead use the `gs://` format URI described above.
     * </pre>
     *
     * <code>string content_uri = 5;</code>
     */
    public java.lang.String getContentUri() {
      java.lang.Object ref = "";
      if (sourceCase_ == 5) {
        ref = source_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (sourceCase_ == 5) {
          source_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The URI where the file content is located.
     * For documents stored in Google Cloud Storage, these URIs must have
     * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
     * NOTE: External URLs must correspond to public webpages, i.e., they must
     * be indexed by Google Search. In particular, URLs for showing documents in
     * Google Cloud Storage (i.e. the URL in your browser) are not supported.
     * Instead use the `gs://` format URI described above.
     * </pre>
     *
     * <code>string content_uri = 5;</code>
     */
    public com.google.protobuf.ByteString
        getContentUriBytes() {
      java.lang.Object ref = "";
      if (sourceCase_ == 5) {
        ref = source_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        if (sourceCase_ == 5) {
          source_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The URI where the file content is located.
     * For documents stored in Google Cloud Storage, these URIs must have
     * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
     * NOTE: External URLs must correspond to public webpages, i.e., they must
     * be indexed by Google Search. In particular, URLs for showing documents in
     * Google Cloud Storage (i.e. the URL in your browser) are not supported.
     * Instead use the `gs://` format URI described above.
     * </pre>
     *
     * <code>string content_uri = 5;</code>
     */
    public Builder setContentUri(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  sourceCase_ = 5;
      source_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The URI where the file content is located.
     * For documents stored in Google Cloud Storage, these URIs must have
     * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
     * NOTE: External URLs must correspond to public webpages, i.e., they must
     * be indexed by Google Search. In particular, URLs for showing documents in
     * Google Cloud Storage (i.e. the URL in your browser) are not supported.
     * Instead use the `gs://` format URI described above.
     * </pre>
     *
     * <code>string content_uri = 5;</code>
     */
    public Builder clearContentUri() {
      if (sourceCase_ == 5) {
        sourceCase_ = 0;
        source_ = null;
        onChanged();
      }
      return this;
    }
    /**
     * <pre>
     * The URI where the file content is located.
     * For documents stored in Google Cloud Storage, these URIs must have
     * the form `gs://&lt;bucket-name&gt;/&lt;object-name&gt;`.
     * NOTE: External URLs must correspond to public webpages, i.e., they must
     * be indexed by Google Search. In particular, URLs for showing documents in
     * Google Cloud Storage (i.e. the URL in your browser) are not supported.
     * Instead use the `gs://` format URI described above.
     * </pre>
     *
     * <code>string content_uri = 5;</code>
     */
    public Builder setContentUriBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      sourceCase_ = 5;
      source_ = value;
      onChanged();
      return this;
    }

    /**
     * <pre>
     * The raw content of the document. This field is only permitted for
     * EXTRACTIVE_QA and FAQ knowledge types.
     * </pre>
     *
     * <code>string content = 6;</code>
     */
    public java.lang.String getContent() {
      java.lang.Object ref = "";
      if (sourceCase_ == 6) {
        ref = source_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (sourceCase_ == 6) {
          source_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The raw content of the document. This field is only permitted for
     * EXTRACTIVE_QA and FAQ knowledge types.
     * </pre>
     *
     * <code>string content = 6;</code>
     */
    public com.google.protobuf.ByteString
        getContentBytes() {
      java.lang.Object ref = "";
      if (sourceCase_ == 6) {
        ref = source_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        if (sourceCase_ == 6) {
          source_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The raw content of the document. This field is only permitted for
     * EXTRACTIVE_QA and FAQ knowledge types.
     * </pre>
     *
     * <code>string content = 6;</code>
     */
    public Builder setContent(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  sourceCase_ = 6;
      source_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The raw content of the document. This field is only permitted for
     * EXTRACTIVE_QA and FAQ knowledge types.
     * </pre>
     *
     * <code>string content = 6;</code>
     */
    public Builder clearContent() {
      if (sourceCase_ == 6) {
        sourceCase_ = 0;
        source_ = null;
        onChanged();
      }
      return this;
    }
    /**
     * <pre>
     * The raw content of the document. This field is only permitted for
     * EXTRACTIVE_QA and FAQ knowledge types.
     * </pre>
     *
     * <code>string content = 6;</code>
     */
    public Builder setContentBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      sourceCase_ = 6;
      source_ = value;
      onChanged();
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(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.dialogflow.v2beta1.Document)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.dialogflow.v2beta1.Document)
  private static final com.google.cloud.dialogflow.v2beta1.Document DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.cloud.dialogflow.v2beta1.Document();
  }

  public static com.google.cloud.dialogflow.v2beta1.Document getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<Document>
      PARSER = new com.google.protobuf.AbstractParser<Document>() {
    @java.lang.Override
    public Document parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new Document(input, extensionRegistry);
    }
  };

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

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

  @java.lang.Override
  public com.google.cloud.dialogflow.v2beta1.Document getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

