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

package com.google.cloud.dialogflow.v2beta1;

/**
 * <pre>
 * The request to detect user's intent.
 * </pre>
 *
 * Protobuf type {@code google.cloud.dialogflow.v2beta1.DetectIntentRequest}
 */
public  final class DetectIntentRequest extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.cloud.dialogflow.v2beta1.DetectIntentRequest)
    DetectIntentRequestOrBuilder {
private static final long serialVersionUID = 0L;
  // Use DetectIntentRequest.newBuilder() to construct.
  private DetectIntentRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private DetectIntentRequest() {
    session_ = "";
    inputAudio_ = com.google.protobuf.ByteString.EMPTY;
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private DetectIntentRequest(
      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();

            session_ = s;
            break;
          }
          case 18: {
            com.google.cloud.dialogflow.v2beta1.QueryParameters.Builder subBuilder = null;
            if (queryParams_ != null) {
              subBuilder = queryParams_.toBuilder();
            }
            queryParams_ = input.readMessage(com.google.cloud.dialogflow.v2beta1.QueryParameters.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(queryParams_);
              queryParams_ = subBuilder.buildPartial();
            }

            break;
          }
          case 26: {
            com.google.cloud.dialogflow.v2beta1.QueryInput.Builder subBuilder = null;
            if (queryInput_ != null) {
              subBuilder = queryInput_.toBuilder();
            }
            queryInput_ = input.readMessage(com.google.cloud.dialogflow.v2beta1.QueryInput.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(queryInput_);
              queryInput_ = subBuilder.buildPartial();
            }

            break;
          }
          case 34: {
            com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.Builder subBuilder = null;
            if (outputAudioConfig_ != null) {
              subBuilder = outputAudioConfig_.toBuilder();
            }
            outputAudioConfig_ = input.readMessage(com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(outputAudioConfig_);
              outputAudioConfig_ = subBuilder.buildPartial();
            }

            break;
          }
          case 42: {

            inputAudio_ = input.readBytes();
            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 {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.cloud.dialogflow.v2beta1.SessionProto.internal_static_google_cloud_dialogflow_v2beta1_DetectIntentRequest_descriptor;
  }

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

  public static final int SESSION_FIELD_NUMBER = 1;
  private volatile java.lang.Object session_;
  /**
   * <pre>
   * Required. The name of the session this query is sent to. Format:
   * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
   * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
   * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
   * default 'draft' environment. If `User ID` is not specified, we are using
   * "-". It’s up to the API caller to choose an appropriate `Session ID` and
   * `User Id`. They can be a random numbers or some type of user and session
   * identifiers (preferably hashed). The length of the `Session ID` and
   * `User ID` must not exceed 36 characters.
   * </pre>
   *
   * <code>string session = 1;</code>
   */
  public java.lang.String getSession() {
    java.lang.Object ref = session_;
    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();
      session_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Required. The name of the session this query is sent to. Format:
   * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
   * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
   * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
   * default 'draft' environment. If `User ID` is not specified, we are using
   * "-". It’s up to the API caller to choose an appropriate `Session ID` and
   * `User Id`. They can be a random numbers or some type of user and session
   * identifiers (preferably hashed). The length of the `Session ID` and
   * `User ID` must not exceed 36 characters.
   * </pre>
   *
   * <code>string session = 1;</code>
   */
  public com.google.protobuf.ByteString
      getSessionBytes() {
    java.lang.Object ref = session_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      session_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int QUERY_PARAMS_FIELD_NUMBER = 2;
  private com.google.cloud.dialogflow.v2beta1.QueryParameters queryParams_;
  /**
   * <pre>
   * Optional. The parameters of this query.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
   */
  public boolean hasQueryParams() {
    return queryParams_ != null;
  }
  /**
   * <pre>
   * Optional. The parameters of this query.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.QueryParameters getQueryParams() {
    return queryParams_ == null ? com.google.cloud.dialogflow.v2beta1.QueryParameters.getDefaultInstance() : queryParams_;
  }
  /**
   * <pre>
   * Optional. The parameters of this query.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.QueryParametersOrBuilder getQueryParamsOrBuilder() {
    return getQueryParams();
  }

  public static final int QUERY_INPUT_FIELD_NUMBER = 3;
  private com.google.cloud.dialogflow.v2beta1.QueryInput queryInput_;
  /**
   * <pre>
   * Required. The input specification. It can be set to:
   * 1.  an audio config
   *     which instructs the speech recognizer how to process the speech audio,
   * 2.  a conversational query in the form of text, or
   * 3.  an event that specifies which intent to trigger.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
   */
  public boolean hasQueryInput() {
    return queryInput_ != null;
  }
  /**
   * <pre>
   * Required. The input specification. It can be set to:
   * 1.  an audio config
   *     which instructs the speech recognizer how to process the speech audio,
   * 2.  a conversational query in the form of text, or
   * 3.  an event that specifies which intent to trigger.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.QueryInput getQueryInput() {
    return queryInput_ == null ? com.google.cloud.dialogflow.v2beta1.QueryInput.getDefaultInstance() : queryInput_;
  }
  /**
   * <pre>
   * Required. The input specification. It can be set to:
   * 1.  an audio config
   *     which instructs the speech recognizer how to process the speech audio,
   * 2.  a conversational query in the form of text, or
   * 3.  an event that specifies which intent to trigger.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder getQueryInputOrBuilder() {
    return getQueryInput();
  }

  public static final int OUTPUT_AUDIO_CONFIG_FIELD_NUMBER = 4;
  private com.google.cloud.dialogflow.v2beta1.OutputAudioConfig outputAudioConfig_;
  /**
   * <pre>
   * Optional. Instructs the speech synthesizer how to generate the output
   * audio. If this field is not set and agent-level speech synthesizer is not
   * configured, no output audio is generated.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
   */
  public boolean hasOutputAudioConfig() {
    return outputAudioConfig_ != null;
  }
  /**
   * <pre>
   * Optional. Instructs the speech synthesizer how to generate the output
   * audio. If this field is not set and agent-level speech synthesizer is not
   * configured, no output audio is generated.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.OutputAudioConfig getOutputAudioConfig() {
    return outputAudioConfig_ == null ? com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.getDefaultInstance() : outputAudioConfig_;
  }
  /**
   * <pre>
   * Optional. Instructs the speech synthesizer how to generate the output
   * audio. If this field is not set and agent-level speech synthesizer is not
   * configured, no output audio is generated.
   * </pre>
   *
   * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
   */
  public com.google.cloud.dialogflow.v2beta1.OutputAudioConfigOrBuilder getOutputAudioConfigOrBuilder() {
    return getOutputAudioConfig();
  }

  public static final int INPUT_AUDIO_FIELD_NUMBER = 5;
  private com.google.protobuf.ByteString inputAudio_;
  /**
   * <pre>
   * Optional. The natural language speech audio to be processed. This field
   * should be populated iff `query_input` is set to an input audio config.
   * A single request can contain up to 1 minute of speech audio data.
   * </pre>
   *
   * <code>bytes input_audio = 5;</code>
   */
  public com.google.protobuf.ByteString getInputAudio() {
    return inputAudio_;
  }

  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 (!getSessionBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, session_);
    }
    if (queryParams_ != null) {
      output.writeMessage(2, getQueryParams());
    }
    if (queryInput_ != null) {
      output.writeMessage(3, getQueryInput());
    }
    if (outputAudioConfig_ != null) {
      output.writeMessage(4, getOutputAudioConfig());
    }
    if (!inputAudio_.isEmpty()) {
      output.writeBytes(5, inputAudio_);
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getSessionBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, session_);
    }
    if (queryParams_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(2, getQueryParams());
    }
    if (queryInput_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(3, getQueryInput());
    }
    if (outputAudioConfig_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(4, getOutputAudioConfig());
    }
    if (!inputAudio_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(5, inputAudio_);
    }
    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.DetectIntentRequest)) {
      return super.equals(obj);
    }
    com.google.cloud.dialogflow.v2beta1.DetectIntentRequest other = (com.google.cloud.dialogflow.v2beta1.DetectIntentRequest) obj;

    boolean result = true;
    result = result && getSession()
        .equals(other.getSession());
    result = result && (hasQueryParams() == other.hasQueryParams());
    if (hasQueryParams()) {
      result = result && getQueryParams()
          .equals(other.getQueryParams());
    }
    result = result && (hasQueryInput() == other.hasQueryInput());
    if (hasQueryInput()) {
      result = result && getQueryInput()
          .equals(other.getQueryInput());
    }
    result = result && (hasOutputAudioConfig() == other.hasOutputAudioConfig());
    if (hasOutputAudioConfig()) {
      result = result && getOutputAudioConfig()
          .equals(other.getOutputAudioConfig());
    }
    result = result && getInputAudio()
        .equals(other.getInputAudio());
    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) + SESSION_FIELD_NUMBER;
    hash = (53 * hash) + getSession().hashCode();
    if (hasQueryParams()) {
      hash = (37 * hash) + QUERY_PARAMS_FIELD_NUMBER;
      hash = (53 * hash) + getQueryParams().hashCode();
    }
    if (hasQueryInput()) {
      hash = (37 * hash) + QUERY_INPUT_FIELD_NUMBER;
      hash = (53 * hash) + getQueryInput().hashCode();
    }
    if (hasOutputAudioConfig()) {
      hash = (37 * hash) + OUTPUT_AUDIO_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getOutputAudioConfig().hashCode();
    }
    hash = (37 * hash) + INPUT_AUDIO_FIELD_NUMBER;
    hash = (53 * hash) + getInputAudio().hashCode();
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.dialogflow.v2beta1.DetectIntentRequest parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.dialogflow.v2beta1.DetectIntentRequest 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.DetectIntentRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.dialogflow.v2beta1.DetectIntentRequest 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.DetectIntentRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.dialogflow.v2beta1.DetectIntentRequest 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.DetectIntentRequest parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.dialogflow.v2beta1.DetectIntentRequest 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.DetectIntentRequest parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.cloud.dialogflow.v2beta1.DetectIntentRequest 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.DetectIntentRequest 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.DetectIntentRequest 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.DetectIntentRequest 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>
   * The request to detect user's intent.
   * </pre>
   *
   * Protobuf type {@code google.cloud.dialogflow.v2beta1.DetectIntentRequest}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.cloud.dialogflow.v2beta1.DetectIntentRequest)
      com.google.cloud.dialogflow.v2beta1.DetectIntentRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.cloud.dialogflow.v2beta1.SessionProto.internal_static_google_cloud_dialogflow_v2beta1_DetectIntentRequest_descriptor;
    }

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

    // Construct using com.google.cloud.dialogflow.v2beta1.DetectIntentRequest.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();
      session_ = "";

      if (queryParamsBuilder_ == null) {
        queryParams_ = null;
      } else {
        queryParams_ = null;
        queryParamsBuilder_ = null;
      }
      if (queryInputBuilder_ == null) {
        queryInput_ = null;
      } else {
        queryInput_ = null;
        queryInputBuilder_ = null;
      }
      if (outputAudioConfigBuilder_ == null) {
        outputAudioConfig_ = null;
      } else {
        outputAudioConfig_ = null;
        outputAudioConfigBuilder_ = null;
      }
      inputAudio_ = com.google.protobuf.ByteString.EMPTY;

      return this;
    }

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

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

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

    @java.lang.Override
    public com.google.cloud.dialogflow.v2beta1.DetectIntentRequest buildPartial() {
      com.google.cloud.dialogflow.v2beta1.DetectIntentRequest result = new com.google.cloud.dialogflow.v2beta1.DetectIntentRequest(this);
      result.session_ = session_;
      if (queryParamsBuilder_ == null) {
        result.queryParams_ = queryParams_;
      } else {
        result.queryParams_ = queryParamsBuilder_.build();
      }
      if (queryInputBuilder_ == null) {
        result.queryInput_ = queryInput_;
      } else {
        result.queryInput_ = queryInputBuilder_.build();
      }
      if (outputAudioConfigBuilder_ == null) {
        result.outputAudioConfig_ = outputAudioConfig_;
      } else {
        result.outputAudioConfig_ = outputAudioConfigBuilder_.build();
      }
      result.inputAudio_ = inputAudio_;
      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.DetectIntentRequest) {
        return mergeFrom((com.google.cloud.dialogflow.v2beta1.DetectIntentRequest)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.dialogflow.v2beta1.DetectIntentRequest other) {
      if (other == com.google.cloud.dialogflow.v2beta1.DetectIntentRequest.getDefaultInstance()) return this;
      if (!other.getSession().isEmpty()) {
        session_ = other.session_;
        onChanged();
      }
      if (other.hasQueryParams()) {
        mergeQueryParams(other.getQueryParams());
      }
      if (other.hasQueryInput()) {
        mergeQueryInput(other.getQueryInput());
      }
      if (other.hasOutputAudioConfig()) {
        mergeOutputAudioConfig(other.getOutputAudioConfig());
      }
      if (other.getInputAudio() != com.google.protobuf.ByteString.EMPTY) {
        setInputAudio(other.getInputAudio());
      }
      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.DetectIntentRequest parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.dialogflow.v2beta1.DetectIntentRequest) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private java.lang.Object session_ = "";
    /**
     * <pre>
     * Required. The name of the session this query is sent to. Format:
     * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
     * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
     * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
     * default 'draft' environment. If `User ID` is not specified, we are using
     * "-". It’s up to the API caller to choose an appropriate `Session ID` and
     * `User Id`. They can be a random numbers or some type of user and session
     * identifiers (preferably hashed). The length of the `Session ID` and
     * `User ID` must not exceed 36 characters.
     * </pre>
     *
     * <code>string session = 1;</code>
     */
    public java.lang.String getSession() {
      java.lang.Object ref = session_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        session_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Required. The name of the session this query is sent to. Format:
     * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
     * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
     * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
     * default 'draft' environment. If `User ID` is not specified, we are using
     * "-". It’s up to the API caller to choose an appropriate `Session ID` and
     * `User Id`. They can be a random numbers or some type of user and session
     * identifiers (preferably hashed). The length of the `Session ID` and
     * `User ID` must not exceed 36 characters.
     * </pre>
     *
     * <code>string session = 1;</code>
     */
    public com.google.protobuf.ByteString
        getSessionBytes() {
      java.lang.Object ref = session_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        session_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Required. The name of the session this query is sent to. Format:
     * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
     * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
     * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
     * default 'draft' environment. If `User ID` is not specified, we are using
     * "-". It’s up to the API caller to choose an appropriate `Session ID` and
     * `User Id`. They can be a random numbers or some type of user and session
     * identifiers (preferably hashed). The length of the `Session ID` and
     * `User ID` must not exceed 36 characters.
     * </pre>
     *
     * <code>string session = 1;</code>
     */
    public Builder setSession(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      session_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The name of the session this query is sent to. Format:
     * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
     * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
     * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
     * default 'draft' environment. If `User ID` is not specified, we are using
     * "-". It’s up to the API caller to choose an appropriate `Session ID` and
     * `User Id`. They can be a random numbers or some type of user and session
     * identifiers (preferably hashed). The length of the `Session ID` and
     * `User ID` must not exceed 36 characters.
     * </pre>
     *
     * <code>string session = 1;</code>
     */
    public Builder clearSession() {
      
      session_ = getDefaultInstance().getSession();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The name of the session this query is sent to. Format:
     * `projects/&lt;Project ID&gt;/agent/sessions/&lt;Session ID&gt;`, or
     * `projects/&lt;Project ID&gt;/agent/environments/&lt;Environment ID&gt;/users/&lt;User
     * ID&gt;/sessions/&lt;Session ID&gt;`. If `Environment ID` is not specified, we assume
     * default 'draft' environment. If `User ID` is not specified, we are using
     * "-". It’s up to the API caller to choose an appropriate `Session ID` and
     * `User Id`. They can be a random numbers or some type of user and session
     * identifiers (preferably hashed). The length of the `Session ID` and
     * `User ID` must not exceed 36 characters.
     * </pre>
     *
     * <code>string session = 1;</code>
     */
    public Builder setSessionBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      session_ = value;
      onChanged();
      return this;
    }

    private com.google.cloud.dialogflow.v2beta1.QueryParameters queryParams_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.dialogflow.v2beta1.QueryParameters, com.google.cloud.dialogflow.v2beta1.QueryParameters.Builder, com.google.cloud.dialogflow.v2beta1.QueryParametersOrBuilder> queryParamsBuilder_;
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public boolean hasQueryParams() {
      return queryParamsBuilder_ != null || queryParams_ != null;
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.QueryParameters getQueryParams() {
      if (queryParamsBuilder_ == null) {
        return queryParams_ == null ? com.google.cloud.dialogflow.v2beta1.QueryParameters.getDefaultInstance() : queryParams_;
      } else {
        return queryParamsBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public Builder setQueryParams(com.google.cloud.dialogflow.v2beta1.QueryParameters value) {
      if (queryParamsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        queryParams_ = value;
        onChanged();
      } else {
        queryParamsBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public Builder setQueryParams(
        com.google.cloud.dialogflow.v2beta1.QueryParameters.Builder builderForValue) {
      if (queryParamsBuilder_ == null) {
        queryParams_ = builderForValue.build();
        onChanged();
      } else {
        queryParamsBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public Builder mergeQueryParams(com.google.cloud.dialogflow.v2beta1.QueryParameters value) {
      if (queryParamsBuilder_ == null) {
        if (queryParams_ != null) {
          queryParams_ =
            com.google.cloud.dialogflow.v2beta1.QueryParameters.newBuilder(queryParams_).mergeFrom(value).buildPartial();
        } else {
          queryParams_ = value;
        }
        onChanged();
      } else {
        queryParamsBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public Builder clearQueryParams() {
      if (queryParamsBuilder_ == null) {
        queryParams_ = null;
        onChanged();
      } else {
        queryParams_ = null;
        queryParamsBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.QueryParameters.Builder getQueryParamsBuilder() {
      
      onChanged();
      return getQueryParamsFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.QueryParametersOrBuilder getQueryParamsOrBuilder() {
      if (queryParamsBuilder_ != null) {
        return queryParamsBuilder_.getMessageOrBuilder();
      } else {
        return queryParams_ == null ?
            com.google.cloud.dialogflow.v2beta1.QueryParameters.getDefaultInstance() : queryParams_;
      }
    }
    /**
     * <pre>
     * Optional. The parameters of this query.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryParameters query_params = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.dialogflow.v2beta1.QueryParameters, com.google.cloud.dialogflow.v2beta1.QueryParameters.Builder, com.google.cloud.dialogflow.v2beta1.QueryParametersOrBuilder> 
        getQueryParamsFieldBuilder() {
      if (queryParamsBuilder_ == null) {
        queryParamsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.dialogflow.v2beta1.QueryParameters, com.google.cloud.dialogflow.v2beta1.QueryParameters.Builder, com.google.cloud.dialogflow.v2beta1.QueryParametersOrBuilder>(
                getQueryParams(),
                getParentForChildren(),
                isClean());
        queryParams_ = null;
      }
      return queryParamsBuilder_;
    }

    private com.google.cloud.dialogflow.v2beta1.QueryInput queryInput_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.dialogflow.v2beta1.QueryInput, com.google.cloud.dialogflow.v2beta1.QueryInput.Builder, com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder> queryInputBuilder_;
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public boolean hasQueryInput() {
      return queryInputBuilder_ != null || queryInput_ != null;
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.QueryInput getQueryInput() {
      if (queryInputBuilder_ == null) {
        return queryInput_ == null ? com.google.cloud.dialogflow.v2beta1.QueryInput.getDefaultInstance() : queryInput_;
      } else {
        return queryInputBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public Builder setQueryInput(com.google.cloud.dialogflow.v2beta1.QueryInput value) {
      if (queryInputBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        queryInput_ = value;
        onChanged();
      } else {
        queryInputBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public Builder setQueryInput(
        com.google.cloud.dialogflow.v2beta1.QueryInput.Builder builderForValue) {
      if (queryInputBuilder_ == null) {
        queryInput_ = builderForValue.build();
        onChanged();
      } else {
        queryInputBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public Builder mergeQueryInput(com.google.cloud.dialogflow.v2beta1.QueryInput value) {
      if (queryInputBuilder_ == null) {
        if (queryInput_ != null) {
          queryInput_ =
            com.google.cloud.dialogflow.v2beta1.QueryInput.newBuilder(queryInput_).mergeFrom(value).buildPartial();
        } else {
          queryInput_ = value;
        }
        onChanged();
      } else {
        queryInputBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public Builder clearQueryInput() {
      if (queryInputBuilder_ == null) {
        queryInput_ = null;
        onChanged();
      } else {
        queryInput_ = null;
        queryInputBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.QueryInput.Builder getQueryInputBuilder() {
      
      onChanged();
      return getQueryInputFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder getQueryInputOrBuilder() {
      if (queryInputBuilder_ != null) {
        return queryInputBuilder_.getMessageOrBuilder();
      } else {
        return queryInput_ == null ?
            com.google.cloud.dialogflow.v2beta1.QueryInput.getDefaultInstance() : queryInput_;
      }
    }
    /**
     * <pre>
     * Required. The input specification. It can be set to:
     * 1.  an audio config
     *     which instructs the speech recognizer how to process the speech audio,
     * 2.  a conversational query in the form of text, or
     * 3.  an event that specifies which intent to trigger.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.QueryInput query_input = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.dialogflow.v2beta1.QueryInput, com.google.cloud.dialogflow.v2beta1.QueryInput.Builder, com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder> 
        getQueryInputFieldBuilder() {
      if (queryInputBuilder_ == null) {
        queryInputBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.dialogflow.v2beta1.QueryInput, com.google.cloud.dialogflow.v2beta1.QueryInput.Builder, com.google.cloud.dialogflow.v2beta1.QueryInputOrBuilder>(
                getQueryInput(),
                getParentForChildren(),
                isClean());
        queryInput_ = null;
      }
      return queryInputBuilder_;
    }

    private com.google.cloud.dialogflow.v2beta1.OutputAudioConfig outputAudioConfig_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.dialogflow.v2beta1.OutputAudioConfig, com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.Builder, com.google.cloud.dialogflow.v2beta1.OutputAudioConfigOrBuilder> outputAudioConfigBuilder_;
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public boolean hasOutputAudioConfig() {
      return outputAudioConfigBuilder_ != null || outputAudioConfig_ != null;
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.OutputAudioConfig getOutputAudioConfig() {
      if (outputAudioConfigBuilder_ == null) {
        return outputAudioConfig_ == null ? com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.getDefaultInstance() : outputAudioConfig_;
      } else {
        return outputAudioConfigBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public Builder setOutputAudioConfig(com.google.cloud.dialogflow.v2beta1.OutputAudioConfig value) {
      if (outputAudioConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        outputAudioConfig_ = value;
        onChanged();
      } else {
        outputAudioConfigBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public Builder setOutputAudioConfig(
        com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.Builder builderForValue) {
      if (outputAudioConfigBuilder_ == null) {
        outputAudioConfig_ = builderForValue.build();
        onChanged();
      } else {
        outputAudioConfigBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public Builder mergeOutputAudioConfig(com.google.cloud.dialogflow.v2beta1.OutputAudioConfig value) {
      if (outputAudioConfigBuilder_ == null) {
        if (outputAudioConfig_ != null) {
          outputAudioConfig_ =
            com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.newBuilder(outputAudioConfig_).mergeFrom(value).buildPartial();
        } else {
          outputAudioConfig_ = value;
        }
        onChanged();
      } else {
        outputAudioConfigBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public Builder clearOutputAudioConfig() {
      if (outputAudioConfigBuilder_ == null) {
        outputAudioConfig_ = null;
        onChanged();
      } else {
        outputAudioConfig_ = null;
        outputAudioConfigBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.Builder getOutputAudioConfigBuilder() {
      
      onChanged();
      return getOutputAudioConfigFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    public com.google.cloud.dialogflow.v2beta1.OutputAudioConfigOrBuilder getOutputAudioConfigOrBuilder() {
      if (outputAudioConfigBuilder_ != null) {
        return outputAudioConfigBuilder_.getMessageOrBuilder();
      } else {
        return outputAudioConfig_ == null ?
            com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.getDefaultInstance() : outputAudioConfig_;
      }
    }
    /**
     * <pre>
     * Optional. Instructs the speech synthesizer how to generate the output
     * audio. If this field is not set and agent-level speech synthesizer is not
     * configured, no output audio is generated.
     * </pre>
     *
     * <code>.google.cloud.dialogflow.v2beta1.OutputAudioConfig output_audio_config = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.dialogflow.v2beta1.OutputAudioConfig, com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.Builder, com.google.cloud.dialogflow.v2beta1.OutputAudioConfigOrBuilder> 
        getOutputAudioConfigFieldBuilder() {
      if (outputAudioConfigBuilder_ == null) {
        outputAudioConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.dialogflow.v2beta1.OutputAudioConfig, com.google.cloud.dialogflow.v2beta1.OutputAudioConfig.Builder, com.google.cloud.dialogflow.v2beta1.OutputAudioConfigOrBuilder>(
                getOutputAudioConfig(),
                getParentForChildren(),
                isClean());
        outputAudioConfig_ = null;
      }
      return outputAudioConfigBuilder_;
    }

    private com.google.protobuf.ByteString inputAudio_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <pre>
     * Optional. The natural language speech audio to be processed. This field
     * should be populated iff `query_input` is set to an input audio config.
     * A single request can contain up to 1 minute of speech audio data.
     * </pre>
     *
     * <code>bytes input_audio = 5;</code>
     */
    public com.google.protobuf.ByteString getInputAudio() {
      return inputAudio_;
    }
    /**
     * <pre>
     * Optional. The natural language speech audio to be processed. This field
     * should be populated iff `query_input` is set to an input audio config.
     * A single request can contain up to 1 minute of speech audio data.
     * </pre>
     *
     * <code>bytes input_audio = 5;</code>
     */
    public Builder setInputAudio(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      inputAudio_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. The natural language speech audio to be processed. This field
     * should be populated iff `query_input` is set to an input audio config.
     * A single request can contain up to 1 minute of speech audio data.
     * </pre>
     *
     * <code>bytes input_audio = 5;</code>
     */
    public Builder clearInputAudio() {
      
      inputAudio_ = getDefaultInstance().getInputAudio();
      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.DetectIntentRequest)
  }

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

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

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

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

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

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

}

