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

package com.google.cloud.recommendationengine.v1beta1;

/**
 *
 *
 * <pre>
 * Request message for Predict method.
 * </pre>
 *
 * Protobuf type {@code google.cloud.recommendationengine.v1beta1.PredictRequest}
 */
public final class PredictRequest extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.recommendationengine.v1beta1.PredictRequest)
    PredictRequestOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use PredictRequest.newBuilder() to construct.
  private PredictRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private PredictRequest() {
    name_ = "";
    pageToken_ = "";
    filter_ = "";
  }

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

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
        .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(int number) {
    switch (number) {
      case 6:
        return internalGetParams();
      case 9:
        return internalGetLabels();
      default:
        throw new RuntimeException("Invalid map field number: " + number);
    }
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
        .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.recommendationengine.v1beta1.PredictRequest.class,
            com.google.cloud.recommendationengine.v1beta1.PredictRequest.Builder.class);
  }

  public static final int NAME_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object name_ = "";
  /**
   *
   *
   * <pre>
   * Required. Full resource name of the format:
   * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
   * The id of the recommendation engine placement. This id is used to identify
   * the set of models that will be used to make the prediction.
   * We currently support three placements with the following IDs by default:
   * * `shopping_cart`: Predicts items frequently bought together with one or
   *   more catalog items in the same shopping session. Commonly displayed after
   *   `add-to-cart` events, on product detail pages, or on the shopping cart
   *   page.
   * * `home_page`: Predicts the next product that a user will most likely
   *   engage with or purchase based on the shopping or viewing history of the
   *   specified `userId` or `visitorId`. For example - Recommendations for you.
   * * `product_detail`: Predicts the next product that a user will most likely
   *   engage with or purchase. The prediction is based on the shopping or
   *   viewing history of the specified `userId` or `visitorId` and its
   *   relevance to a specified `CatalogItem`. Typically used on product detail
   *   pages. For example - More items like this.
   * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
   *   specified `userId` or `visitorId`, most recent ones first. Returns
   *   nothing if neither of them has viewed any items yet. For example -
   *   Recently viewed.
   * The full list of available placements can be seen at
   * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
   * </pre>
   *
   * <code>
   * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   * </code>
   *
   * @return The name.
   */
  @java.lang.Override
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      name_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Required. Full resource name of the format:
   * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
   * The id of the recommendation engine placement. This id is used to identify
   * the set of models that will be used to make the prediction.
   * We currently support three placements with the following IDs by default:
   * * `shopping_cart`: Predicts items frequently bought together with one or
   *   more catalog items in the same shopping session. Commonly displayed after
   *   `add-to-cart` events, on product detail pages, or on the shopping cart
   *   page.
   * * `home_page`: Predicts the next product that a user will most likely
   *   engage with or purchase based on the shopping or viewing history of the
   *   specified `userId` or `visitorId`. For example - Recommendations for you.
   * * `product_detail`: Predicts the next product that a user will most likely
   *   engage with or purchase. The prediction is based on the shopping or
   *   viewing history of the specified `userId` or `visitorId` and its
   *   relevance to a specified `CatalogItem`. Typically used on product detail
   *   pages. For example - More items like this.
   * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
   *   specified `userId` or `visitorId`, most recent ones first. Returns
   *   nothing if neither of them has viewed any items yet. For example -
   *   Recently viewed.
   * The full list of available placements can be seen at
   * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
   * </pre>
   *
   * <code>
   * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
   * </code>
   *
   * @return The bytes for name.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int USER_EVENT_FIELD_NUMBER = 2;
  private com.google.cloud.recommendationengine.v1beta1.UserEvent userEvent_;
  /**
   *
   *
   * <pre>
   * Required. Context about the user, what they are looking at and what action
   * they took to trigger the predict request. Note that this user event detail
   * won't be ingested to userEvent logs. Thus, a separate userEvent write
   * request is required for event logging.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
   * </code>
   *
   * @return Whether the userEvent field is set.
   */
  @java.lang.Override
  public boolean hasUserEvent() {
    return userEvent_ != null;
  }
  /**
   *
   *
   * <pre>
   * Required. Context about the user, what they are looking at and what action
   * they took to trigger the predict request. Note that this user event detail
   * won't be ingested to userEvent logs. Thus, a separate userEvent write
   * request is required for event logging.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
   * </code>
   *
   * @return The userEvent.
   */
  @java.lang.Override
  public com.google.cloud.recommendationengine.v1beta1.UserEvent getUserEvent() {
    return userEvent_ == null
        ? com.google.cloud.recommendationengine.v1beta1.UserEvent.getDefaultInstance()
        : userEvent_;
  }
  /**
   *
   *
   * <pre>
   * Required. Context about the user, what they are looking at and what action
   * they took to trigger the predict request. Note that this user event detail
   * won't be ingested to userEvent logs. Thus, a separate userEvent write
   * request is required for event logging.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.recommendationengine.v1beta1.UserEventOrBuilder getUserEventOrBuilder() {
    return userEvent_ == null
        ? com.google.cloud.recommendationengine.v1beta1.UserEvent.getDefaultInstance()
        : userEvent_;
  }

  public static final int PAGE_SIZE_FIELD_NUMBER = 7;
  private int pageSize_ = 0;
  /**
   *
   *
   * <pre>
   * Optional. Maximum number of results to return per page. Set this property
   * to the number of prediction results required. If zero, the service will
   * choose a reasonable default.
   * </pre>
   *
   * <code>int32 page_size = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The pageSize.
   */
  @java.lang.Override
  public int getPageSize() {
    return pageSize_;
  }

  public static final int PAGE_TOKEN_FIELD_NUMBER = 8;

  @SuppressWarnings("serial")
  private volatile java.lang.Object pageToken_ = "";
  /**
   *
   *
   * <pre>
   * Optional. The previous PredictResponse.next_page_token.
   * </pre>
   *
   * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The pageToken.
   */
  @java.lang.Override
  public java.lang.String getPageToken() {
    java.lang.Object ref = pageToken_;
    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();
      pageToken_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Optional. The previous PredictResponse.next_page_token.
   * </pre>
   *
   * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The bytes for pageToken.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getPageTokenBytes() {
    java.lang.Object ref = pageToken_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      pageToken_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int FILTER_FIELD_NUMBER = 3;

  @SuppressWarnings("serial")
  private volatile java.lang.Object filter_ = "";
  /**
   *
   *
   * <pre>
   * Optional. Filter for restricting prediction results. Accepts values for
   * tags and the `filterOutOfStockItems` flag.
   *  * Tag expressions. Restricts predictions to items that match all of the
   *    specified tags. Boolean operators `OR` and `NOT` are supported if the
   *    expression is enclosed in parentheses, and must be separated from the
   *    tag values by a space. `-"tagA"` is also supported and is equivalent to
   *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
   *    with a size limit of 1 KiB.
   *  * filterOutOfStockItems. Restricts predictions to items that do not have a
   *    stockState value of OUT_OF_STOCK.
   * Examples:
   *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
   *  * filterOutOfStockItems  tag=(-"promotional")
   *  * filterOutOfStockItems
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The filter.
   */
  @java.lang.Override
  public java.lang.String getFilter() {
    java.lang.Object ref = filter_;
    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();
      filter_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Optional. Filter for restricting prediction results. Accepts values for
   * tags and the `filterOutOfStockItems` flag.
   *  * Tag expressions. Restricts predictions to items that match all of the
   *    specified tags. Boolean operators `OR` and `NOT` are supported if the
   *    expression is enclosed in parentheses, and must be separated from the
   *    tag values by a space. `-"tagA"` is also supported and is equivalent to
   *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
   *    with a size limit of 1 KiB.
   *  * filterOutOfStockItems. Restricts predictions to items that do not have a
   *    stockState value of OUT_OF_STOCK.
   * Examples:
   *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
   *  * filterOutOfStockItems  tag=(-"promotional")
   *  * filterOutOfStockItems
   * </pre>
   *
   * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The bytes for filter.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getFilterBytes() {
    java.lang.Object ref = filter_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      filter_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DRY_RUN_FIELD_NUMBER = 4;
  private boolean dryRun_ = false;
  /**
   *
   *
   * <pre>
   * Optional. Use dryRun mode for this prediction query. If set to true, a
   * dummy model will be used that returns arbitrary catalog items.
   * Note that the dryRun mode should only be used for testing the API, or if
   * the model is not ready.
   * </pre>
   *
   * <code>bool dry_run = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The dryRun.
   */
  @java.lang.Override
  public boolean getDryRun() {
    return dryRun_;
  }

  public static final int PARAMS_FIELD_NUMBER = 6;

  private static final class ParamsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value>
        defaultEntry =
            com.google.protobuf.MapEntry
                .<java.lang.String, com.google.protobuf.Value>newDefaultInstance(
                    com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
                        .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_ParamsEntry_descriptor,
                    com.google.protobuf.WireFormat.FieldType.STRING,
                    "",
                    com.google.protobuf.WireFormat.FieldType.MESSAGE,
                    com.google.protobuf.Value.getDefaultInstance());
  }

  @SuppressWarnings("serial")
  private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> params_;

  private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value>
      internalGetParams() {
    if (params_ == null) {
      return com.google.protobuf.MapField.emptyMapField(ParamsDefaultEntryHolder.defaultEntry);
    }
    return params_;
  }

  public int getParamsCount() {
    return internalGetParams().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Optional. Additional domain specific parameters for the predictions.
   * Allowed values:
   * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
   *    object will be returned in the
   *   `PredictResponse.PredictionResult.itemMetadata` object in the method
   *    response.
   * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
   *    corresponding to each returned item will be set in the `metadata`
   *    field in the prediction response. The given 'score' indicates the
   *    probability of an item being clicked/purchased given the user's context
   *    and history.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public boolean containsParams(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetParams().getMap().containsKey(key);
  }
  /** Use {@link #getParamsMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, com.google.protobuf.Value> getParams() {
    return getParamsMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. Additional domain specific parameters for the predictions.
   * Allowed values:
   * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
   *    object will be returned in the
   *   `PredictResponse.PredictionResult.itemMetadata` object in the method
   *    response.
   * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
   *    corresponding to each returned item will be set in the `metadata`
   *    field in the prediction response. The given 'score' indicates the
   *    probability of an item being clicked/purchased given the user's context
   *    and history.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, com.google.protobuf.Value> getParamsMap() {
    return internalGetParams().getMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. Additional domain specific parameters for the predictions.
   * Allowed values:
   * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
   *    object will be returned in the
   *   `PredictResponse.PredictionResult.itemMetadata` object in the method
   *    response.
   * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
   *    corresponding to each returned item will be set in the `metadata`
   *    field in the prediction response. The given 'score' indicates the
   *    probability of an item being clicked/purchased given the user's context
   *    and history.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public /* nullable */ com.google.protobuf.Value getParamsOrDefault(
      java.lang.String key,
      /* nullable */
      com.google.protobuf.Value defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Optional. Additional domain specific parameters for the predictions.
   * Allowed values:
   * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
   *    object will be returned in the
   *   `PredictResponse.PredictionResult.itemMetadata` object in the method
   *    response.
   * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
   *    corresponding to each returned item will be set in the `metadata`
   *    field in the prediction response. The given 'score' indicates the
   *    probability of an item being clicked/purchased given the user's context
   *    and history.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int LABELS_FIELD_NUMBER = 9;

  private static final class LabelsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry =
        com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance(
            com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
                .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_LabelsEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

  @SuppressWarnings("serial")
  private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_;

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
    if (labels_ == null) {
      return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
    }
    return labels_;
  }

  public int getLabelsCount() {
    return internalGetLabels().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels for the predict request.
   *  * Label keys can contain lowercase letters, digits and hyphens, must start
   *    with a letter, and must end with a letter or digit.
   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
   *    must start with a letter, and must end with a letter or digit.
   *  * No more than 64 labels can be associated with a given request.
   * See https://goo.gl/xmQnxf for more information on and examples of labels.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public boolean containsLabels(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetLabels().getMap().containsKey(key);
  }
  /** Use {@link #getLabelsMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getLabels() {
    return getLabelsMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels for the predict request.
   *  * Label keys can contain lowercase letters, digits and hyphens, must start
   *    with a letter, and must end with a letter or digit.
   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
   *    must start with a letter, and must end with a letter or digit.
   *  * No more than 64 labels can be associated with a given request.
   * See https://goo.gl/xmQnxf for more information on and examples of labels.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
    return internalGetLabels().getMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels for the predict request.
   *  * Label keys can contain lowercase letters, digits and hyphens, must start
   *    with a letter, and must end with a letter or digit.
   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
   *    must start with a letter, and must end with a letter or digit.
   *  * No more than 64 labels can be associated with a given request.
   * See https://goo.gl/xmQnxf for more information on and examples of labels.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public /* nullable */ java.lang.String getLabelsOrDefault(
      java.lang.String key,
      /* nullable */
      java.lang.String defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels for the predict request.
   *  * Label keys can contain lowercase letters, digits and hyphens, must start
   *    with a letter, and must end with a letter or digit.
   *  * Non-zero label values can contain lowercase letters, digits and hyphens,
   *    must start with a letter, and must end with a letter or digit.
   *  * No more than 64 labels can be associated with a given request.
   * See https://goo.gl/xmQnxf for more information on and examples of labels.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
   */
  @java.lang.Override
  public java.lang.String getLabelsOrThrow(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  private byte memoizedIsInitialized = -1;

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (userEvent_ != null) {
      output.writeMessage(2, getUserEvent());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, filter_);
    }
    if (dryRun_ != false) {
      output.writeBool(4, dryRun_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetParams(), ParamsDefaultEntryHolder.defaultEntry, 6);
    if (pageSize_ != 0) {
      output.writeInt32(7, pageSize_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 8, pageToken_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 9);
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (userEvent_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUserEvent());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, filter_);
    }
    if (dryRun_ != false) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, dryRun_);
    }
    for (java.util.Map.Entry<java.lang.String, com.google.protobuf.Value> entry :
        internalGetParams().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> params__ =
          ParamsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, params__);
    }
    if (pageSize_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(7, pageSize_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, pageToken_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
          LabelsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, labels__);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.recommendationengine.v1beta1.PredictRequest)) {
      return super.equals(obj);
    }
    com.google.cloud.recommendationengine.v1beta1.PredictRequest other =
        (com.google.cloud.recommendationengine.v1beta1.PredictRequest) obj;

    if (!getName().equals(other.getName())) return false;
    if (hasUserEvent() != other.hasUserEvent()) return false;
    if (hasUserEvent()) {
      if (!getUserEvent().equals(other.getUserEvent())) return false;
    }
    if (getPageSize() != other.getPageSize()) return false;
    if (!getPageToken().equals(other.getPageToken())) return false;
    if (!getFilter().equals(other.getFilter())) return false;
    if (getDryRun() != other.getDryRun()) return false;
    if (!internalGetParams().equals(other.internalGetParams())) return false;
    if (!internalGetLabels().equals(other.internalGetLabels())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    if (hasUserEvent()) {
      hash = (37 * hash) + USER_EVENT_FIELD_NUMBER;
      hash = (53 * hash) + getUserEvent().hashCode();
    }
    hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER;
    hash = (53 * hash) + getPageSize();
    hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER;
    hash = (53 * hash) + getPageToken().hashCode();
    hash = (37 * hash) + FILTER_FIELD_NUMBER;
    hash = (53 * hash) + getFilter().hashCode();
    hash = (37 * hash) + DRY_RUN_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDryRun());
    if (!internalGetParams().getMap().isEmpty()) {
      hash = (37 * hash) + PARAMS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetParams().hashCode();
    }
    if (!internalGetLabels().getMap().isEmpty()) {
      hash = (37 * hash) + LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetLabels().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.recommendationengine.v1beta1.PredictRequest parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.recommendationengine.v1beta1.PredictRequest 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.recommendationengine.v1beta1.PredictRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

  public static com.google.cloud.recommendationengine.v1beta1.PredictRequest 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.recommendationengine.v1beta1.PredictRequest parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.recommendationengine.v1beta1.PredictRequest 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.recommendationengine.v1beta1.PredictRequest parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.recommendationengine.v1beta1.PredictRequest 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.recommendationengine.v1beta1.PredictRequest 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>
   * Request message for Predict method.
   * </pre>
   *
   * Protobuf type {@code google.cloud.recommendationengine.v1beta1.PredictRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.recommendationengine.v1beta1.PredictRequest)
      com.google.cloud.recommendationengine.v1beta1.PredictRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
          .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(int number) {
      switch (number) {
        case 6:
          return internalGetParams();
        case 9:
          return internalGetLabels();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
      switch (number) {
        case 6:
          return internalGetMutableParams();
        case 9:
          return internalGetMutableLabels();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
          .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.recommendationengine.v1beta1.PredictRequest.class,
              com.google.cloud.recommendationengine.v1beta1.PredictRequest.Builder.class);
    }

    // Construct using com.google.cloud.recommendationengine.v1beta1.PredictRequest.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      name_ = "";
      userEvent_ = null;
      if (userEventBuilder_ != null) {
        userEventBuilder_.dispose();
        userEventBuilder_ = null;
      }
      pageSize_ = 0;
      pageToken_ = "";
      filter_ = "";
      dryRun_ = false;
      internalGetMutableParams().clear();
      internalGetMutableLabels().clear();
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.recommendationengine.v1beta1.PredictionServiceOuterClass
          .internal_static_google_cloud_recommendationengine_v1beta1_PredictRequest_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.recommendationengine.v1beta1.PredictRequest
        getDefaultInstanceForType() {
      return com.google.cloud.recommendationengine.v1beta1.PredictRequest.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.recommendationengine.v1beta1.PredictRequest buildPartial() {
      com.google.cloud.recommendationengine.v1beta1.PredictRequest result =
          new com.google.cloud.recommendationengine.v1beta1.PredictRequest(this);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartial0(
        com.google.cloud.recommendationengine.v1beta1.PredictRequest result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.name_ = name_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.userEvent_ = userEventBuilder_ == null ? userEvent_ : userEventBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.pageSize_ = pageSize_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.pageToken_ = pageToken_;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.filter_ = filter_;
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.dryRun_ = dryRun_;
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.params_ = internalGetParams();
        result.params_.makeImmutable();
      }
      if (((from_bitField0_ & 0x00000080) != 0)) {
        result.labels_ = internalGetLabels();
        result.labels_.makeImmutable();
      }
    }

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

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

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

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

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

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

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

    public Builder mergeFrom(com.google.cloud.recommendationengine.v1beta1.PredictRequest other) {
      if (other
          == com.google.cloud.recommendationengine.v1beta1.PredictRequest.getDefaultInstance())
        return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (other.hasUserEvent()) {
        mergeUserEvent(other.getUserEvent());
      }
      if (other.getPageSize() != 0) {
        setPageSize(other.getPageSize());
      }
      if (!other.getPageToken().isEmpty()) {
        pageToken_ = other.pageToken_;
        bitField0_ |= 0x00000008;
        onChanged();
      }
      if (!other.getFilter().isEmpty()) {
        filter_ = other.filter_;
        bitField0_ |= 0x00000010;
        onChanged();
      }
      if (other.getDryRun() != false) {
        setDryRun(other.getDryRun());
      }
      internalGetMutableParams().mergeFrom(other.internalGetParams());
      bitField0_ |= 0x00000040;
      internalGetMutableLabels().mergeFrom(other.internalGetLabels());
      bitField0_ |= 0x00000080;
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                name_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                input.readMessage(getUserEventFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                filter_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000010;
                break;
              } // case 26
            case 32:
              {
                dryRun_ = input.readBool();
                bitField0_ |= 0x00000020;
                break;
              } // case 32
            case 50:
              {
                com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> params__ =
                    input.readMessage(
                        ParamsDefaultEntryHolder.defaultEntry.getParserForType(),
                        extensionRegistry);
                internalGetMutableParams()
                    .getMutableMap()
                    .put(params__.getKey(), params__.getValue());
                bitField0_ |= 0x00000040;
                break;
              } // case 50
            case 56:
              {
                pageSize_ = input.readInt32();
                bitField0_ |= 0x00000004;
                break;
              } // case 56
            case 66:
              {
                pageToken_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000008;
                break;
              } // case 66
            case 74:
              {
                com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
                    input.readMessage(
                        LabelsDefaultEntryHolder.defaultEntry.getParserForType(),
                        extensionRegistry);
                internalGetMutableLabels()
                    .getMutableMap()
                    .put(labels__.getKey(), labels__.getValue());
                bitField0_ |= 0x00000080;
                break;
              } // case 74
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private java.lang.Object name_ = "";
    /**
     *
     *
     * <pre>
     * Required. Full resource name of the format:
     * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
     * The id of the recommendation engine placement. This id is used to identify
     * the set of models that will be used to make the prediction.
     * We currently support three placements with the following IDs by default:
     * * `shopping_cart`: Predicts items frequently bought together with one or
     *   more catalog items in the same shopping session. Commonly displayed after
     *   `add-to-cart` events, on product detail pages, or on the shopping cart
     *   page.
     * * `home_page`: Predicts the next product that a user will most likely
     *   engage with or purchase based on the shopping or viewing history of the
     *   specified `userId` or `visitorId`. For example - Recommendations for you.
     * * `product_detail`: Predicts the next product that a user will most likely
     *   engage with or purchase. The prediction is based on the shopping or
     *   viewing history of the specified `userId` or `visitorId` and its
     *   relevance to a specified `CatalogItem`. Typically used on product detail
     *   pages. For example - More items like this.
     * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
     *   specified `userId` or `visitorId`, most recent ones first. Returns
     *   nothing if neither of them has viewed any items yet. For example -
     *   Recently viewed.
     * The full list of available placements can be seen at
     * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
     * </pre>
     *
     * <code>
     * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The name.
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. Full resource name of the format:
     * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
     * The id of the recommendation engine placement. This id is used to identify
     * the set of models that will be used to make the prediction.
     * We currently support three placements with the following IDs by default:
     * * `shopping_cart`: Predicts items frequently bought together with one or
     *   more catalog items in the same shopping session. Commonly displayed after
     *   `add-to-cart` events, on product detail pages, or on the shopping cart
     *   page.
     * * `home_page`: Predicts the next product that a user will most likely
     *   engage with or purchase based on the shopping or viewing history of the
     *   specified `userId` or `visitorId`. For example - Recommendations for you.
     * * `product_detail`: Predicts the next product that a user will most likely
     *   engage with or purchase. The prediction is based on the shopping or
     *   viewing history of the specified `userId` or `visitorId` and its
     *   relevance to a specified `CatalogItem`. Typically used on product detail
     *   pages. For example - More items like this.
     * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
     *   specified `userId` or `visitorId`, most recent ones first. Returns
     *   nothing if neither of them has viewed any items yet. For example -
     *   Recently viewed.
     * The full list of available placements can be seen at
     * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
     * </pre>
     *
     * <code>
     * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return The bytes for name.
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. Full resource name of the format:
     * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
     * The id of the recommendation engine placement. This id is used to identify
     * the set of models that will be used to make the prediction.
     * We currently support three placements with the following IDs by default:
     * * `shopping_cart`: Predicts items frequently bought together with one or
     *   more catalog items in the same shopping session. Commonly displayed after
     *   `add-to-cart` events, on product detail pages, or on the shopping cart
     *   page.
     * * `home_page`: Predicts the next product that a user will most likely
     *   engage with or purchase based on the shopping or viewing history of the
     *   specified `userId` or `visitorId`. For example - Recommendations for you.
     * * `product_detail`: Predicts the next product that a user will most likely
     *   engage with or purchase. The prediction is based on the shopping or
     *   viewing history of the specified `userId` or `visitorId` and its
     *   relevance to a specified `CatalogItem`. Typically used on product detail
     *   pages. For example - More items like this.
     * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
     *   specified `userId` or `visitorId`, most recent ones first. Returns
     *   nothing if neither of them has viewed any items yet. For example -
     *   Recently viewed.
     * The full list of available placements can be seen at
     * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
     * </pre>
     *
     * <code>
     * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @param value The name to set.
     * @return This builder for chaining.
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      name_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Full resource name of the format:
     * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
     * The id of the recommendation engine placement. This id is used to identify
     * the set of models that will be used to make the prediction.
     * We currently support three placements with the following IDs by default:
     * * `shopping_cart`: Predicts items frequently bought together with one or
     *   more catalog items in the same shopping session. Commonly displayed after
     *   `add-to-cart` events, on product detail pages, or on the shopping cart
     *   page.
     * * `home_page`: Predicts the next product that a user will most likely
     *   engage with or purchase based on the shopping or viewing history of the
     *   specified `userId` or `visitorId`. For example - Recommendations for you.
     * * `product_detail`: Predicts the next product that a user will most likely
     *   engage with or purchase. The prediction is based on the shopping or
     *   viewing history of the specified `userId` or `visitorId` and its
     *   relevance to a specified `CatalogItem`. Typically used on product detail
     *   pages. For example - More items like this.
     * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
     *   specified `userId` or `visitorId`, most recent ones first. Returns
     *   nothing if neither of them has viewed any items yet. For example -
     *   Recently viewed.
     * The full list of available placements can be seen at
     * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
     * </pre>
     *
     * <code>
     * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearName() {
      name_ = getDefaultInstance().getName();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Full resource name of the format:
     * `{name=projects/&#42;&#47;locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/&#42;}`
     * The id of the recommendation engine placement. This id is used to identify
     * the set of models that will be used to make the prediction.
     * We currently support three placements with the following IDs by default:
     * * `shopping_cart`: Predicts items frequently bought together with one or
     *   more catalog items in the same shopping session. Commonly displayed after
     *   `add-to-cart` events, on product detail pages, or on the shopping cart
     *   page.
     * * `home_page`: Predicts the next product that a user will most likely
     *   engage with or purchase based on the shopping or viewing history of the
     *   specified `userId` or `visitorId`. For example - Recommendations for you.
     * * `product_detail`: Predicts the next product that a user will most likely
     *   engage with or purchase. The prediction is based on the shopping or
     *   viewing history of the specified `userId` or `visitorId` and its
     *   relevance to a specified `CatalogItem`. Typically used on product detail
     *   pages. For example - More items like this.
     * * `recently_viewed_default`: Returns up to 75 items recently viewed by the
     *   specified `userId` or `visitorId`, most recent ones first. Returns
     *   nothing if neither of them has viewed any items yet. For example -
     *   Recently viewed.
     * The full list of available placements can be seen at
     * https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
     * </pre>
     *
     * <code>
     * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
     * </code>
     *
     * @param value The bytes for name to set.
     * @return This builder for chaining.
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      name_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private com.google.cloud.recommendationengine.v1beta1.UserEvent userEvent_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.recommendationengine.v1beta1.UserEvent,
            com.google.cloud.recommendationengine.v1beta1.UserEvent.Builder,
            com.google.cloud.recommendationengine.v1beta1.UserEventOrBuilder>
        userEventBuilder_;
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return Whether the userEvent field is set.
     */
    public boolean hasUserEvent() {
      return ((bitField0_ & 0x00000002) != 0);
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     *
     * @return The userEvent.
     */
    public com.google.cloud.recommendationengine.v1beta1.UserEvent getUserEvent() {
      if (userEventBuilder_ == null) {
        return userEvent_ == null
            ? com.google.cloud.recommendationengine.v1beta1.UserEvent.getDefaultInstance()
            : userEvent_;
      } else {
        return userEventBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    public Builder setUserEvent(com.google.cloud.recommendationengine.v1beta1.UserEvent value) {
      if (userEventBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        userEvent_ = value;
      } else {
        userEventBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    public Builder setUserEvent(
        com.google.cloud.recommendationengine.v1beta1.UserEvent.Builder builderForValue) {
      if (userEventBuilder_ == null) {
        userEvent_ = builderForValue.build();
      } else {
        userEventBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    public Builder mergeUserEvent(com.google.cloud.recommendationengine.v1beta1.UserEvent value) {
      if (userEventBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)
            && userEvent_ != null
            && userEvent_
                != com.google.cloud.recommendationengine.v1beta1.UserEvent.getDefaultInstance()) {
          getUserEventBuilder().mergeFrom(value);
        } else {
          userEvent_ = value;
        }
      } else {
        userEventBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    public Builder clearUserEvent() {
      bitField0_ = (bitField0_ & ~0x00000002);
      userEvent_ = null;
      if (userEventBuilder_ != null) {
        userEventBuilder_.dispose();
        userEventBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    public com.google.cloud.recommendationengine.v1beta1.UserEvent.Builder getUserEventBuilder() {
      bitField0_ |= 0x00000002;
      onChanged();
      return getUserEventFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    public com.google.cloud.recommendationengine.v1beta1.UserEventOrBuilder
        getUserEventOrBuilder() {
      if (userEventBuilder_ != null) {
        return userEventBuilder_.getMessageOrBuilder();
      } else {
        return userEvent_ == null
            ? com.google.cloud.recommendationengine.v1beta1.UserEvent.getDefaultInstance()
            : userEvent_;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. Context about the user, what they are looking at and what action
     * they took to trigger the predict request. Note that this user event detail
     * won't be ingested to userEvent logs. Thus, a separate userEvent write
     * request is required for event logging.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED];
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.recommendationengine.v1beta1.UserEvent,
            com.google.cloud.recommendationengine.v1beta1.UserEvent.Builder,
            com.google.cloud.recommendationengine.v1beta1.UserEventOrBuilder>
        getUserEventFieldBuilder() {
      if (userEventBuilder_ == null) {
        userEventBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.recommendationengine.v1beta1.UserEvent,
                com.google.cloud.recommendationengine.v1beta1.UserEvent.Builder,
                com.google.cloud.recommendationengine.v1beta1.UserEventOrBuilder>(
                getUserEvent(), getParentForChildren(), isClean());
        userEvent_ = null;
      }
      return userEventBuilder_;
    }

    private int pageSize_;
    /**
     *
     *
     * <pre>
     * Optional. Maximum number of results to return per page. Set this property
     * to the number of prediction results required. If zero, the service will
     * choose a reasonable default.
     * </pre>
     *
     * <code>int32 page_size = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The pageSize.
     */
    @java.lang.Override
    public int getPageSize() {
      return pageSize_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Maximum number of results to return per page. Set this property
     * to the number of prediction results required. If zero, the service will
     * choose a reasonable default.
     * </pre>
     *
     * <code>int32 page_size = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The pageSize to set.
     * @return This builder for chaining.
     */
    public Builder setPageSize(int value) {

      pageSize_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Maximum number of results to return per page. Set this property
     * to the number of prediction results required. If zero, the service will
     * choose a reasonable default.
     * </pre>
     *
     * <code>int32 page_size = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearPageSize() {
      bitField0_ = (bitField0_ & ~0x00000004);
      pageSize_ = 0;
      onChanged();
      return this;
    }

    private java.lang.Object pageToken_ = "";
    /**
     *
     *
     * <pre>
     * Optional. The previous PredictResponse.next_page_token.
     * </pre>
     *
     * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The pageToken.
     */
    public java.lang.String getPageToken() {
      java.lang.Object ref = pageToken_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        pageToken_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The previous PredictResponse.next_page_token.
     * </pre>
     *
     * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for pageToken.
     */
    public com.google.protobuf.ByteString getPageTokenBytes() {
      java.lang.Object ref = pageToken_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        pageToken_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The previous PredictResponse.next_page_token.
     * </pre>
     *
     * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The pageToken to set.
     * @return This builder for chaining.
     */
    public Builder setPageToken(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      pageToken_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The previous PredictResponse.next_page_token.
     * </pre>
     *
     * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearPageToken() {
      pageToken_ = getDefaultInstance().getPageToken();
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The previous PredictResponse.next_page_token.
     * </pre>
     *
     * <code>string page_token = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The bytes for pageToken to set.
     * @return This builder for chaining.
     */
    public Builder setPageTokenBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      pageToken_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }

    private java.lang.Object filter_ = "";
    /**
     *
     *
     * <pre>
     * Optional. Filter for restricting prediction results. Accepts values for
     * tags and the `filterOutOfStockItems` flag.
     *  * Tag expressions. Restricts predictions to items that match all of the
     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
     *    expression is enclosed in parentheses, and must be separated from the
     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
     *    with a size limit of 1 KiB.
     *  * filterOutOfStockItems. Restricts predictions to items that do not have a
     *    stockState value of OUT_OF_STOCK.
     * Examples:
     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
     *  * filterOutOfStockItems  tag=(-"promotional")
     *  * filterOutOfStockItems
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The filter.
     */
    public java.lang.String getFilter() {
      java.lang.Object ref = filter_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        filter_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Filter for restricting prediction results. Accepts values for
     * tags and the `filterOutOfStockItems` flag.
     *  * Tag expressions. Restricts predictions to items that match all of the
     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
     *    expression is enclosed in parentheses, and must be separated from the
     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
     *    with a size limit of 1 KiB.
     *  * filterOutOfStockItems. Restricts predictions to items that do not have a
     *    stockState value of OUT_OF_STOCK.
     * Examples:
     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
     *  * filterOutOfStockItems  tag=(-"promotional")
     *  * filterOutOfStockItems
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for filter.
     */
    public com.google.protobuf.ByteString getFilterBytes() {
      java.lang.Object ref = filter_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        filter_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Filter for restricting prediction results. Accepts values for
     * tags and the `filterOutOfStockItems` flag.
     *  * Tag expressions. Restricts predictions to items that match all of the
     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
     *    expression is enclosed in parentheses, and must be separated from the
     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
     *    with a size limit of 1 KiB.
     *  * filterOutOfStockItems. Restricts predictions to items that do not have a
     *    stockState value of OUT_OF_STOCK.
     * Examples:
     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
     *  * filterOutOfStockItems  tag=(-"promotional")
     *  * filterOutOfStockItems
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The filter to set.
     * @return This builder for chaining.
     */
    public Builder setFilter(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      filter_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Filter for restricting prediction results. Accepts values for
     * tags and the `filterOutOfStockItems` flag.
     *  * Tag expressions. Restricts predictions to items that match all of the
     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
     *    expression is enclosed in parentheses, and must be separated from the
     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
     *    with a size limit of 1 KiB.
     *  * filterOutOfStockItems. Restricts predictions to items that do not have a
     *    stockState value of OUT_OF_STOCK.
     * Examples:
     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
     *  * filterOutOfStockItems  tag=(-"promotional")
     *  * filterOutOfStockItems
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearFilter() {
      filter_ = getDefaultInstance().getFilter();
      bitField0_ = (bitField0_ & ~0x00000010);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Filter for restricting prediction results. Accepts values for
     * tags and the `filterOutOfStockItems` flag.
     *  * Tag expressions. Restricts predictions to items that match all of the
     *    specified tags. Boolean operators `OR` and `NOT` are supported if the
     *    expression is enclosed in parentheses, and must be separated from the
     *    tag values by a space. `-"tagA"` is also supported and is equivalent to
     *    `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
     *    with a size limit of 1 KiB.
     *  * filterOutOfStockItems. Restricts predictions to items that do not have a
     *    stockState value of OUT_OF_STOCK.
     * Examples:
     *  * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
     *  * filterOutOfStockItems  tag=(-"promotional")
     *  * filterOutOfStockItems
     * </pre>
     *
     * <code>string filter = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The bytes for filter to set.
     * @return This builder for chaining.
     */
    public Builder setFilterBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      filter_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }

    private boolean dryRun_;
    /**
     *
     *
     * <pre>
     * Optional. Use dryRun mode for this prediction query. If set to true, a
     * dummy model will be used that returns arbitrary catalog items.
     * Note that the dryRun mode should only be used for testing the API, or if
     * the model is not ready.
     * </pre>
     *
     * <code>bool dry_run = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The dryRun.
     */
    @java.lang.Override
    public boolean getDryRun() {
      return dryRun_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Use dryRun mode for this prediction query. If set to true, a
     * dummy model will be used that returns arbitrary catalog items.
     * Note that the dryRun mode should only be used for testing the API, or if
     * the model is not ready.
     * </pre>
     *
     * <code>bool dry_run = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The dryRun to set.
     * @return This builder for chaining.
     */
    public Builder setDryRun(boolean value) {

      dryRun_ = value;
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Use dryRun mode for this prediction query. If set to true, a
     * dummy model will be used that returns arbitrary catalog items.
     * Note that the dryRun mode should only be used for testing the API, or if
     * the model is not ready.
     * </pre>
     *
     * <code>bool dry_run = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearDryRun() {
      bitField0_ = (bitField0_ & ~0x00000020);
      dryRun_ = false;
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> params_;

    private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value>
        internalGetParams() {
      if (params_ == null) {
        return com.google.protobuf.MapField.emptyMapField(ParamsDefaultEntryHolder.defaultEntry);
      }
      return params_;
    }

    private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value>
        internalGetMutableParams() {
      if (params_ == null) {
        params_ = com.google.protobuf.MapField.newMapField(ParamsDefaultEntryHolder.defaultEntry);
      }
      if (!params_.isMutable()) {
        params_ = params_.copy();
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return params_;
    }

    public int getParamsCount() {
      return internalGetParams().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public boolean containsParams(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetParams().getMap().containsKey(key);
    }
    /** Use {@link #getParamsMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, com.google.protobuf.Value> getParams() {
      return getParamsMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, com.google.protobuf.Value> getParamsMap() {
      return internalGetParams().getMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public /* nullable */ com.google.protobuf.Value getParamsOrDefault(
        java.lang.String key,
        /* nullable */
        com.google.protobuf.Value defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    @java.lang.Override
    public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearParams() {
      bitField0_ = (bitField0_ & ~0x00000040);
      internalGetMutableParams().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder removeParams(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableParams().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, com.google.protobuf.Value> getMutableParams() {
      bitField0_ |= 0x00000040;
      return internalGetMutableParams().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder putParams(java.lang.String key, com.google.protobuf.Value value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }
      internalGetMutableParams().getMutableMap().put(key, value);
      bitField0_ |= 0x00000040;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Additional domain specific parameters for the predictions.
     * Allowed values:
     * * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
     *    object will be returned in the
     *   `PredictResponse.PredictionResult.itemMetadata` object in the method
     *    response.
     * * `returnItemScore`: Boolean. If set to true, the prediction 'score'
     *    corresponding to each returned item will be set in the `metadata`
     *    field in the prediction response. The given 'score' indicates the
     *    probability of an item being clicked/purchased given the user's context
     *    and history.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.protobuf.Value&gt; params = 6 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder putAllParams(java.util.Map<java.lang.String, com.google.protobuf.Value> values) {
      internalGetMutableParams().getMutableMap().putAll(values);
      bitField0_ |= 0x00000040;
      return this;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_;

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
      if (labels_ == null) {
        return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      return labels_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetMutableLabels() {
      if (labels_ == null) {
        labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      if (!labels_.isMutable()) {
        labels_ = labels_.copy();
      }
      bitField0_ |= 0x00000080;
      onChanged();
      return labels_;
    }

    public int getLabelsCount() {
      return internalGetLabels().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public boolean containsLabels(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetLabels().getMap().containsKey(key);
    }
    /** Use {@link #getLabelsMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getLabels() {
      return getLabelsMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
      return internalGetLabels().getMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public /* nullable */ java.lang.String getLabelsOrDefault(
        java.lang.String key,
        /* nullable */
        java.lang.String defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    @java.lang.Override
    public java.lang.String getLabelsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearLabels() {
      bitField0_ = (bitField0_ & ~0x00000080);
      internalGetMutableLabels().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder removeLabels(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableLabels().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableLabels() {
      bitField0_ |= 0x00000080;
      return internalGetMutableLabels().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder putLabels(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }
      internalGetMutableLabels().getMutableMap().put(key, value);
      bitField0_ |= 0x00000080;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels for the predict request.
     *  * Label keys can contain lowercase letters, digits and hyphens, must start
     *    with a letter, and must end with a letter or digit.
     *  * Non-zero label values can contain lowercase letters, digits and hyphens,
     *    must start with a letter, and must end with a letter or digit.
     *  * No more than 64 labels can be associated with a given request.
     * See https://goo.gl/xmQnxf for more information on and examples of labels.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableLabels().getMutableMap().putAll(values);
      bitField0_ |= 0x00000080;
      return this;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.cloud.recommendationengine.v1beta1.PredictRequest)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.recommendationengine.v1beta1.PredictRequest)
  private static final com.google.cloud.recommendationengine.v1beta1.PredictRequest
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.recommendationengine.v1beta1.PredictRequest();
  }

  public static com.google.cloud.recommendationengine.v1beta1.PredictRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.cloud.recommendationengine.v1beta1.PredictRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
