/*
 * 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/user_event.proto

package com.google.cloud.recommendationengine.v1beta1;

/**
 *
 *
 * <pre>
 * Detailed product information associated with a user event.
 * </pre>
 *
 * Protobuf type {@code google.cloud.recommendationengine.v1beta1.ProductDetail}
 */
public final class ProductDetail extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.recommendationengine.v1beta1.ProductDetail)
    ProductDetailOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ProductDetail.newBuilder() to construct.
  private ProductDetail(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ProductDetail() {
    id_ = "";
    currencyCode_ = "";
    stockState_ = 0;
  }

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

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

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

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

              currencyCode_ = s;
              break;
            }
          case 29:
            {
              originalPrice_ = input.readFloat();
              break;
            }
          case 37:
            {
              displayPrice_ = input.readFloat();
              break;
            }
          case 40:
            {
              int rawValue = input.readEnum();

              stockState_ = rawValue;
              break;
            }
          case 48:
            {
              quantity_ = input.readInt32();
              break;
            }
          case 56:
            {
              availableQuantity_ = input.readInt32();
              break;
            }
          case 66:
            {
              com.google.cloud.recommendationengine.v1beta1.FeatureMap.Builder subBuilder = null;
              if (itemAttributes_ != null) {
                subBuilder = itemAttributes_.toBuilder();
              }
              itemAttributes_ =
                  input.readMessage(
                      com.google.cloud.recommendationengine.v1beta1.FeatureMap.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(itemAttributes_);
                itemAttributes_ = subBuilder.buildPartial();
              }

              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

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

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

  public static final int ID_FIELD_NUMBER = 1;
  private volatile java.lang.Object id_;
  /**
   *
   *
   * <pre>
   * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
   * characters.
   * </pre>
   *
   * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The id.
   */
  @java.lang.Override
  public java.lang.String getId() {
    java.lang.Object ref = id_;
    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();
      id_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
   * characters.
   * </pre>
   *
   * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
   *
   * @return The bytes for id.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getIdBytes() {
    java.lang.Object ref = id_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      id_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int CURRENCY_CODE_FIELD_NUMBER = 2;
  private volatile java.lang.Object currencyCode_;
  /**
   *
   *
   * <pre>
   * Optional. Currency code for price/costs. Use three-character ISO-4217
   * code. Required only if originalPrice or displayPrice is set.
   * </pre>
   *
   * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The currencyCode.
   */
  @java.lang.Override
  public java.lang.String getCurrencyCode() {
    java.lang.Object ref = currencyCode_;
    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();
      currencyCode_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Optional. Currency code for price/costs. Use three-character ISO-4217
   * code. Required only if originalPrice or displayPrice is set.
   * </pre>
   *
   * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The bytes for currencyCode.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getCurrencyCodeBytes() {
    java.lang.Object ref = currencyCode_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      currencyCode_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int ORIGINAL_PRICE_FIELD_NUMBER = 3;
  private float originalPrice_;
  /**
   *
   *
   * <pre>
   * Optional. Original price of the product. If provided, this will override
   * the original price in Catalog for this product.
   * </pre>
   *
   * <code>float original_price = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The originalPrice.
   */
  @java.lang.Override
  public float getOriginalPrice() {
    return originalPrice_;
  }

  public static final int DISPLAY_PRICE_FIELD_NUMBER = 4;
  private float displayPrice_;
  /**
   *
   *
   * <pre>
   * Optional. Display price of the product (e.g. discounted price). If
   * provided, this will override the display price in Catalog for this product.
   * </pre>
   *
   * <code>float display_price = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The displayPrice.
   */
  @java.lang.Override
  public float getDisplayPrice() {
    return displayPrice_;
  }

  public static final int STOCK_STATE_FIELD_NUMBER = 5;
  private int stockState_;
  /**
   *
   *
   * <pre>
   * Optional. Item stock state. If provided, this overrides the stock state
   * in Catalog for items in this event.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The enum numeric value on the wire for stockState.
   */
  @java.lang.Override
  public int getStockStateValue() {
    return stockState_;
  }
  /**
   *
   *
   * <pre>
   * Optional. Item stock state. If provided, this overrides the stock state
   * in Catalog for items in this event.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The stockState.
   */
  @java.lang.Override
  public com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState
      getStockState() {
    @SuppressWarnings("deprecation")
    com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState result =
        com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState.valueOf(
            stockState_);
    return result == null
        ? com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState.UNRECOGNIZED
        : result;
  }

  public static final int QUANTITY_FIELD_NUMBER = 6;
  private int quantity_;
  /**
   *
   *
   * <pre>
   * Optional. Quantity of the product associated with the user event. For
   * example, this field will be 2 if two products are added to the shopping
   * cart for `add-to-cart` event. Required for `add-to-cart`, `add-to-list`,
   * `remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event
   * types.
   * </pre>
   *
   * <code>int32 quantity = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The quantity.
   */
  @java.lang.Override
  public int getQuantity() {
    return quantity_;
  }

  public static final int AVAILABLE_QUANTITY_FIELD_NUMBER = 7;
  private int availableQuantity_;
  /**
   *
   *
   * <pre>
   * Optional. Quantity of the products in stock when a user event happens.
   * Optional. If provided, this overrides the available quantity in Catalog for
   * this event. and can only be set if `stock_status` is set to `IN_STOCK`.
   * Note that if an item is out of stock, you must set the `stock_state` field
   * to be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not
   * sufficient to mark the item out of stock.
   * </pre>
   *
   * <code>int32 available_quantity = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
   *
   * @return The availableQuantity.
   */
  @java.lang.Override
  public int getAvailableQuantity() {
    return availableQuantity_;
  }

  public static final int ITEM_ATTRIBUTES_FIELD_NUMBER = 8;
  private com.google.cloud.recommendationengine.v1beta1.FeatureMap itemAttributes_;
  /**
   *
   *
   * <pre>
   * Optional. Extra features associated with a product in the user event.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return Whether the itemAttributes field is set.
   */
  @java.lang.Override
  public boolean hasItemAttributes() {
    return itemAttributes_ != null;
  }
  /**
   *
   *
   * <pre>
   * Optional. Extra features associated with a product in the user event.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The itemAttributes.
   */
  @java.lang.Override
  public com.google.cloud.recommendationengine.v1beta1.FeatureMap getItemAttributes() {
    return itemAttributes_ == null
        ? com.google.cloud.recommendationengine.v1beta1.FeatureMap.getDefaultInstance()
        : itemAttributes_;
  }
  /**
   *
   *
   * <pre>
   * Optional. Extra features associated with a product in the user event.
   * </pre>
   *
   * <code>
   * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.recommendationengine.v1beta1.FeatureMapOrBuilder
      getItemAttributesOrBuilder() {
    return getItemAttributes();
  }

  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(id_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(currencyCode_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, currencyCode_);
    }
    if (originalPrice_ != 0F) {
      output.writeFloat(3, originalPrice_);
    }
    if (displayPrice_ != 0F) {
      output.writeFloat(4, displayPrice_);
    }
    if (stockState_
        != com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState
            .STOCK_STATE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(5, stockState_);
    }
    if (quantity_ != 0) {
      output.writeInt32(6, quantity_);
    }
    if (availableQuantity_ != 0) {
      output.writeInt32(7, availableQuantity_);
    }
    if (itemAttributes_ != null) {
      output.writeMessage(8, getItemAttributes());
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(currencyCode_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, currencyCode_);
    }
    if (originalPrice_ != 0F) {
      size += com.google.protobuf.CodedOutputStream.computeFloatSize(3, originalPrice_);
    }
    if (displayPrice_ != 0F) {
      size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, displayPrice_);
    }
    if (stockState_
        != com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState
            .STOCK_STATE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, stockState_);
    }
    if (quantity_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(6, quantity_);
    }
    if (availableQuantity_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(7, availableQuantity_);
    }
    if (itemAttributes_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getItemAttributes());
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

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

    if (!getId().equals(other.getId())) return false;
    if (!getCurrencyCode().equals(other.getCurrencyCode())) return false;
    if (java.lang.Float.floatToIntBits(getOriginalPrice())
        != java.lang.Float.floatToIntBits(other.getOriginalPrice())) return false;
    if (java.lang.Float.floatToIntBits(getDisplayPrice())
        != java.lang.Float.floatToIntBits(other.getDisplayPrice())) return false;
    if (stockState_ != other.stockState_) return false;
    if (getQuantity() != other.getQuantity()) return false;
    if (getAvailableQuantity() != other.getAvailableQuantity()) return false;
    if (hasItemAttributes() != other.hasItemAttributes()) return false;
    if (hasItemAttributes()) {
      if (!getItemAttributes().equals(other.getItemAttributes())) return false;
    }
    if (!unknownFields.equals(other.unknownFields)) 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) + ID_FIELD_NUMBER;
    hash = (53 * hash) + getId().hashCode();
    hash = (37 * hash) + CURRENCY_CODE_FIELD_NUMBER;
    hash = (53 * hash) + getCurrencyCode().hashCode();
    hash = (37 * hash) + ORIGINAL_PRICE_FIELD_NUMBER;
    hash = (53 * hash) + java.lang.Float.floatToIntBits(getOriginalPrice());
    hash = (37 * hash) + DISPLAY_PRICE_FIELD_NUMBER;
    hash = (53 * hash) + java.lang.Float.floatToIntBits(getDisplayPrice());
    hash = (37 * hash) + STOCK_STATE_FIELD_NUMBER;
    hash = (53 * hash) + stockState_;
    hash = (37 * hash) + QUANTITY_FIELD_NUMBER;
    hash = (53 * hash) + getQuantity();
    hash = (37 * hash) + AVAILABLE_QUANTITY_FIELD_NUMBER;
    hash = (53 * hash) + getAvailableQuantity();
    if (hasItemAttributes()) {
      hash = (37 * hash) + ITEM_ATTRIBUTES_FIELD_NUMBER;
      hash = (53 * hash) + getItemAttributes().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

  public static com.google.cloud.recommendationengine.v1beta1.ProductDetail 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.ProductDetail 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.ProductDetail 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.ProductDetail 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>
   * Detailed product information associated with a user event.
   * </pre>
   *
   * Protobuf type {@code google.cloud.recommendationengine.v1beta1.ProductDetail}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.recommendationengine.v1beta1.ProductDetail)
      com.google.cloud.recommendationengine.v1beta1.ProductDetailOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.recommendationengine.v1beta1.UserEventOuterClass
          .internal_static_google_cloud_recommendationengine_v1beta1_ProductDetail_descriptor;
    }

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

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

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      id_ = "";

      currencyCode_ = "";

      originalPrice_ = 0F;

      displayPrice_ = 0F;

      stockState_ = 0;

      quantity_ = 0;

      availableQuantity_ = 0;

      if (itemAttributesBuilder_ == null) {
        itemAttributes_ = null;
      } else {
        itemAttributes_ = null;
        itemAttributesBuilder_ = null;
      }
      return this;
    }

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

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

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

    @java.lang.Override
    public com.google.cloud.recommendationengine.v1beta1.ProductDetail buildPartial() {
      com.google.cloud.recommendationengine.v1beta1.ProductDetail result =
          new com.google.cloud.recommendationengine.v1beta1.ProductDetail(this);
      result.id_ = id_;
      result.currencyCode_ = currencyCode_;
      result.originalPrice_ = originalPrice_;
      result.displayPrice_ = displayPrice_;
      result.stockState_ = stockState_;
      result.quantity_ = quantity_;
      result.availableQuantity_ = availableQuantity_;
      if (itemAttributesBuilder_ == null) {
        result.itemAttributes_ = itemAttributes_;
      } else {
        result.itemAttributes_ = itemAttributesBuilder_.build();
      }
      onBuilt();
      return result;
    }

    @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.ProductDetail) {
        return mergeFrom((com.google.cloud.recommendationengine.v1beta1.ProductDetail) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.recommendationengine.v1beta1.ProductDetail other) {
      if (other == com.google.cloud.recommendationengine.v1beta1.ProductDetail.getDefaultInstance())
        return this;
      if (!other.getId().isEmpty()) {
        id_ = other.id_;
        onChanged();
      }
      if (!other.getCurrencyCode().isEmpty()) {
        currencyCode_ = other.currencyCode_;
        onChanged();
      }
      if (other.getOriginalPrice() != 0F) {
        setOriginalPrice(other.getOriginalPrice());
      }
      if (other.getDisplayPrice() != 0F) {
        setDisplayPrice(other.getDisplayPrice());
      }
      if (other.stockState_ != 0) {
        setStockStateValue(other.getStockStateValue());
      }
      if (other.getQuantity() != 0) {
        setQuantity(other.getQuantity());
      }
      if (other.getAvailableQuantity() != 0) {
        setAvailableQuantity(other.getAvailableQuantity());
      }
      if (other.hasItemAttributes()) {
        mergeItemAttributes(other.getItemAttributes());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.cloud.recommendationengine.v1beta1.ProductDetail parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage =
            (com.google.cloud.recommendationengine.v1beta1.ProductDetail) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private java.lang.Object id_ = "";
    /**
     *
     *
     * <pre>
     * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
     * characters.
     * </pre>
     *
     * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The id.
     */
    public java.lang.String getId() {
      java.lang.Object ref = id_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        id_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
     * characters.
     * </pre>
     *
     * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return The bytes for id.
     */
    public com.google.protobuf.ByteString getIdBytes() {
      java.lang.Object ref = id_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        id_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
     * characters.
     * </pre>
     *
     * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The id to set.
     * @return This builder for chaining.
     */
    public Builder setId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      id_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
     * characters.
     * </pre>
     *
     * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearId() {

      id_ = getDefaultInstance().getId();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. Catalog item ID. UTF-8 encoded string with a length limit of 128
     * characters.
     * </pre>
     *
     * <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     *
     * @param value The bytes for id to set.
     * @return This builder for chaining.
     */
    public Builder setIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      id_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object currencyCode_ = "";
    /**
     *
     *
     * <pre>
     * Optional. Currency code for price/costs. Use three-character ISO-4217
     * code. Required only if originalPrice or displayPrice is set.
     * </pre>
     *
     * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The currencyCode.
     */
    public java.lang.String getCurrencyCode() {
      java.lang.Object ref = currencyCode_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        currencyCode_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Currency code for price/costs. Use three-character ISO-4217
     * code. Required only if originalPrice or displayPrice is set.
     * </pre>
     *
     * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The bytes for currencyCode.
     */
    public com.google.protobuf.ByteString getCurrencyCodeBytes() {
      java.lang.Object ref = currencyCode_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        currencyCode_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Currency code for price/costs. Use three-character ISO-4217
     * code. Required only if originalPrice or displayPrice is set.
     * </pre>
     *
     * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The currencyCode to set.
     * @return This builder for chaining.
     */
    public Builder setCurrencyCode(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      currencyCode_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Currency code for price/costs. Use three-character ISO-4217
     * code. Required only if originalPrice or displayPrice is set.
     * </pre>
     *
     * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearCurrencyCode() {

      currencyCode_ = getDefaultInstance().getCurrencyCode();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Currency code for price/costs. Use three-character ISO-4217
     * code. Required only if originalPrice or displayPrice is set.
     * </pre>
     *
     * <code>string currency_code = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The bytes for currencyCode to set.
     * @return This builder for chaining.
     */
    public Builder setCurrencyCodeBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      currencyCode_ = value;
      onChanged();
      return this;
    }

    private float originalPrice_;
    /**
     *
     *
     * <pre>
     * Optional. Original price of the product. If provided, this will override
     * the original price in Catalog for this product.
     * </pre>
     *
     * <code>float original_price = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The originalPrice.
     */
    @java.lang.Override
    public float getOriginalPrice() {
      return originalPrice_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Original price of the product. If provided, this will override
     * the original price in Catalog for this product.
     * </pre>
     *
     * <code>float original_price = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The originalPrice to set.
     * @return This builder for chaining.
     */
    public Builder setOriginalPrice(float value) {

      originalPrice_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Original price of the product. If provided, this will override
     * the original price in Catalog for this product.
     * </pre>
     *
     * <code>float original_price = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearOriginalPrice() {

      originalPrice_ = 0F;
      onChanged();
      return this;
    }

    private float displayPrice_;
    /**
     *
     *
     * <pre>
     * Optional. Display price of the product (e.g. discounted price). If
     * provided, this will override the display price in Catalog for this product.
     * </pre>
     *
     * <code>float display_price = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The displayPrice.
     */
    @java.lang.Override
    public float getDisplayPrice() {
      return displayPrice_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Display price of the product (e.g. discounted price). If
     * provided, this will override the display price in Catalog for this product.
     * </pre>
     *
     * <code>float display_price = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The displayPrice to set.
     * @return This builder for chaining.
     */
    public Builder setDisplayPrice(float value) {

      displayPrice_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Display price of the product (e.g. discounted price). If
     * provided, this will override the display price in Catalog for this product.
     * </pre>
     *
     * <code>float display_price = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearDisplayPrice() {

      displayPrice_ = 0F;
      onChanged();
      return this;
    }

    private int stockState_ = 0;
    /**
     *
     *
     * <pre>
     * Optional. Item stock state. If provided, this overrides the stock state
     * in Catalog for items in this event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The enum numeric value on the wire for stockState.
     */
    @java.lang.Override
    public int getStockStateValue() {
      return stockState_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Item stock state. If provided, this overrides the stock state
     * in Catalog for items in this event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param value The enum numeric value on the wire for stockState to set.
     * @return This builder for chaining.
     */
    public Builder setStockStateValue(int value) {

      stockState_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Item stock state. If provided, this overrides the stock state
     * in Catalog for items in this event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The stockState.
     */
    @java.lang.Override
    public com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState
        getStockState() {
      @SuppressWarnings("deprecation")
      com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState result =
          com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState.valueOf(
              stockState_);
      return result == null
          ? com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Optional. Item stock state. If provided, this overrides the stock state
     * in Catalog for items in this event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @param value The stockState to set.
     * @return This builder for chaining.
     */
    public Builder setStockState(
        com.google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState value) {
      if (value == null) {
        throw new NullPointerException();
      }

      stockState_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Item stock state. If provided, this overrides the stock state
     * in Catalog for items in this event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState stock_state = 5 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return This builder for chaining.
     */
    public Builder clearStockState() {

      stockState_ = 0;
      onChanged();
      return this;
    }

    private int quantity_;
    /**
     *
     *
     * <pre>
     * Optional. Quantity of the product associated with the user event. For
     * example, this field will be 2 if two products are added to the shopping
     * cart for `add-to-cart` event. Required for `add-to-cart`, `add-to-list`,
     * `remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event
     * types.
     * </pre>
     *
     * <code>int32 quantity = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The quantity.
     */
    @java.lang.Override
    public int getQuantity() {
      return quantity_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Quantity of the product associated with the user event. For
     * example, this field will be 2 if two products are added to the shopping
     * cart for `add-to-cart` event. Required for `add-to-cart`, `add-to-list`,
     * `remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event
     * types.
     * </pre>
     *
     * <code>int32 quantity = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The quantity to set.
     * @return This builder for chaining.
     */
    public Builder setQuantity(int value) {

      quantity_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Quantity of the product associated with the user event. For
     * example, this field will be 2 if two products are added to the shopping
     * cart for `add-to-cart` event. Required for `add-to-cart`, `add-to-list`,
     * `remove-from-cart`, `checkout-start`, `purchase-complete`, `refund` event
     * types.
     * </pre>
     *
     * <code>int32 quantity = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearQuantity() {

      quantity_ = 0;
      onChanged();
      return this;
    }

    private int availableQuantity_;
    /**
     *
     *
     * <pre>
     * Optional. Quantity of the products in stock when a user event happens.
     * Optional. If provided, this overrides the available quantity in Catalog for
     * this event. and can only be set if `stock_status` is set to `IN_STOCK`.
     * Note that if an item is out of stock, you must set the `stock_state` field
     * to be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not
     * sufficient to mark the item out of stock.
     * </pre>
     *
     * <code>int32 available_quantity = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return The availableQuantity.
     */
    @java.lang.Override
    public int getAvailableQuantity() {
      return availableQuantity_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Quantity of the products in stock when a user event happens.
     * Optional. If provided, this overrides the available quantity in Catalog for
     * this event. and can only be set if `stock_status` is set to `IN_STOCK`.
     * Note that if an item is out of stock, you must set the `stock_state` field
     * to be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not
     * sufficient to mark the item out of stock.
     * </pre>
     *
     * <code>int32 available_quantity = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @param value The availableQuantity to set.
     * @return This builder for chaining.
     */
    public Builder setAvailableQuantity(int value) {

      availableQuantity_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Quantity of the products in stock when a user event happens.
     * Optional. If provided, this overrides the available quantity in Catalog for
     * this event. and can only be set if `stock_status` is set to `IN_STOCK`.
     * Note that if an item is out of stock, you must set the `stock_state` field
     * to be `OUT_OF_STOCK`. Leaving this field unspecified / as zero is not
     * sufficient to mark the item out of stock.
     * </pre>
     *
     * <code>int32 available_quantity = 7 [(.google.api.field_behavior) = OPTIONAL];</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearAvailableQuantity() {

      availableQuantity_ = 0;
      onChanged();
      return this;
    }

    private com.google.cloud.recommendationengine.v1beta1.FeatureMap itemAttributes_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.recommendationengine.v1beta1.FeatureMap,
            com.google.cloud.recommendationengine.v1beta1.FeatureMap.Builder,
            com.google.cloud.recommendationengine.v1beta1.FeatureMapOrBuilder>
        itemAttributesBuilder_;
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the itemAttributes field is set.
     */
    public boolean hasItemAttributes() {
      return itemAttributesBuilder_ != null || itemAttributes_ != null;
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The itemAttributes.
     */
    public com.google.cloud.recommendationengine.v1beta1.FeatureMap getItemAttributes() {
      if (itemAttributesBuilder_ == null) {
        return itemAttributes_ == null
            ? com.google.cloud.recommendationengine.v1beta1.FeatureMap.getDefaultInstance()
            : itemAttributes_;
      } else {
        return itemAttributesBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setItemAttributes(
        com.google.cloud.recommendationengine.v1beta1.FeatureMap value) {
      if (itemAttributesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        itemAttributes_ = value;
        onChanged();
      } else {
        itemAttributesBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setItemAttributes(
        com.google.cloud.recommendationengine.v1beta1.FeatureMap.Builder builderForValue) {
      if (itemAttributesBuilder_ == null) {
        itemAttributes_ = builderForValue.build();
        onChanged();
      } else {
        itemAttributesBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder mergeItemAttributes(
        com.google.cloud.recommendationengine.v1beta1.FeatureMap value) {
      if (itemAttributesBuilder_ == null) {
        if (itemAttributes_ != null) {
          itemAttributes_ =
              com.google.cloud.recommendationengine.v1beta1.FeatureMap.newBuilder(itemAttributes_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          itemAttributes_ = value;
        }
        onChanged();
      } else {
        itemAttributesBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder clearItemAttributes() {
      if (itemAttributesBuilder_ == null) {
        itemAttributes_ = null;
        onChanged();
      } else {
        itemAttributes_ = null;
        itemAttributesBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.cloud.recommendationengine.v1beta1.FeatureMap.Builder
        getItemAttributesBuilder() {

      onChanged();
      return getItemAttributesFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.cloud.recommendationengine.v1beta1.FeatureMapOrBuilder
        getItemAttributesOrBuilder() {
      if (itemAttributesBuilder_ != null) {
        return itemAttributesBuilder_.getMessageOrBuilder();
      } else {
        return itemAttributes_ == null
            ? com.google.cloud.recommendationengine.v1beta1.FeatureMap.getDefaultInstance()
            : itemAttributes_;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Extra features associated with a product in the user event.
     * </pre>
     *
     * <code>
     * .google.cloud.recommendationengine.v1beta1.FeatureMap item_attributes = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.recommendationengine.v1beta1.FeatureMap,
            com.google.cloud.recommendationengine.v1beta1.FeatureMap.Builder,
            com.google.cloud.recommendationengine.v1beta1.FeatureMapOrBuilder>
        getItemAttributesFieldBuilder() {
      if (itemAttributesBuilder_ == null) {
        itemAttributesBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.recommendationengine.v1beta1.FeatureMap,
                com.google.cloud.recommendationengine.v1beta1.FeatureMap.Builder,
                com.google.cloud.recommendationengine.v1beta1.FeatureMapOrBuilder>(
                getItemAttributes(), getParentForChildren(), isClean());
        itemAttributes_ = null;
      }
      return itemAttributesBuilder_;
    }

    @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.ProductDetail)
  }

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

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

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

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

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

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

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