// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;

import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoEnum;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.Utf8String;

public final class ProductOuterClass {
  /**
   * Protobuf type {@code Product}
   */
  public static final class Product extends ProtoMessage<Product> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional int64 begin_time = 3;</code>
     */
    private long beginTime;

    /**
     * <code>optional int64 end_time = 6;</code>
     */
    private long endTime;

    /**
     * <code>optional uint32 max_buy_times = 4;</code>
     */
    private int maxBuyTimes;

    /**
     * <code>optional uint32 buy_times = 7;</code>
     */
    private int buyTimes;

    /**
     * <code>optional .Product.ProductGiftType product_gift_type = 13;</code>
     */
    private int productGiftType;

    /**
     * <code>optional bool is_first_recharge = 14;</code>
     */
    private boolean isFirstRecharge;

    /**
     * <code>optional string product_id = 2;</code>
     */
    private final Utf8String productId = Utf8String.newEmptyInstance();

    /**
     * <code>optional string price_tier = 11;</code>
     */
    private final Utf8String priceTier = Utf8String.newEmptyInstance();

    private Product() {
    }

    /**
     * @return a new empty instance of {@code Product}
     */
    public static Product newInstance() {
      return new Product();
    }

    /**
     * <code>optional int64 begin_time = 3;</code>
     * @return whether the beginTime field is set
     */
    public boolean hasBeginTime() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int64 begin_time = 3;</code>
     * @return this
     */
    public Product clearBeginTime() {
      bitField0_ &= ~0x00000001;
      beginTime = 0L;
      return this;
    }

    /**
     * <code>optional int64 begin_time = 3;</code>
     * @return the beginTime
     */
    public long getBeginTime() {
      return beginTime;
    }

    /**
     * <code>optional int64 begin_time = 3;</code>
     * @param value the beginTime to set
     * @return this
     */
    public Product setBeginTime(final long value) {
      bitField0_ |= 0x00000001;
      beginTime = value;
      return this;
    }

    /**
     * <code>optional int64 end_time = 6;</code>
     * @return whether the endTime field is set
     */
    public boolean hasEndTime() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional int64 end_time = 6;</code>
     * @return this
     */
    public Product clearEndTime() {
      bitField0_ &= ~0x00000002;
      endTime = 0L;
      return this;
    }

    /**
     * <code>optional int64 end_time = 6;</code>
     * @return the endTime
     */
    public long getEndTime() {
      return endTime;
    }

    /**
     * <code>optional int64 end_time = 6;</code>
     * @param value the endTime to set
     * @return this
     */
    public Product setEndTime(final long value) {
      bitField0_ |= 0x00000002;
      endTime = value;
      return this;
    }

    /**
     * <code>optional uint32 max_buy_times = 4;</code>
     * @return whether the maxBuyTimes field is set
     */
    public boolean hasMaxBuyTimes() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 max_buy_times = 4;</code>
     * @return this
     */
    public Product clearMaxBuyTimes() {
      bitField0_ &= ~0x00000004;
      maxBuyTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 max_buy_times = 4;</code>
     * @return the maxBuyTimes
     */
    public int getMaxBuyTimes() {
      return maxBuyTimes;
    }

    /**
     * <code>optional uint32 max_buy_times = 4;</code>
     * @param value the maxBuyTimes to set
     * @return this
     */
    public Product setMaxBuyTimes(final int value) {
      bitField0_ |= 0x00000004;
      maxBuyTimes = value;
      return this;
    }

    /**
     * <code>optional uint32 buy_times = 7;</code>
     * @return whether the buyTimes field is set
     */
    public boolean hasBuyTimes() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 buy_times = 7;</code>
     * @return this
     */
    public Product clearBuyTimes() {
      bitField0_ &= ~0x00000008;
      buyTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 buy_times = 7;</code>
     * @return the buyTimes
     */
    public int getBuyTimes() {
      return buyTimes;
    }

    /**
     * <code>optional uint32 buy_times = 7;</code>
     * @param value the buyTimes to set
     * @return this
     */
    public Product setBuyTimes(final int value) {
      bitField0_ |= 0x00000008;
      buyTimes = value;
      return this;
    }

    /**
     * <code>optional .Product.ProductGiftType product_gift_type = 13;</code>
     * @return whether the productGiftType field is set
     */
    public boolean hasProductGiftType() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional .Product.ProductGiftType product_gift_type = 13;</code>
     * @return this
     */
    public Product clearProductGiftType() {
      bitField0_ &= ~0x00000010;
      productGiftType = 0;
      return this;
    }

    /**
     * <code>optional .Product.ProductGiftType product_gift_type = 13;</code>
     * @return the productGiftType
     */
    public ProductGiftType getProductGiftType() {
      return ProductGiftType.forNumber(productGiftType);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link Product#getProductGiftType()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getProductGiftTypeValue() {
      return productGiftType;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link ProductGiftType}. Setting an invalid value
     * can cause {@link Product#getProductGiftType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public Product setProductGiftTypeValue(final int value) {
      bitField0_ |= 0x00000010;
      productGiftType = value;
      return this;
    }

    /**
     * <code>optional .Product.ProductGiftType product_gift_type = 13;</code>
     * @param value the productGiftType to set
     * @return this
     */
    public Product setProductGiftType(final ProductGiftType value) {
      bitField0_ |= 0x00000010;
      productGiftType = value.getNumber();
      return this;
    }

    /**
     * <code>optional bool is_first_recharge = 14;</code>
     * @return whether the isFirstRecharge field is set
     */
    public boolean hasIsFirstRecharge() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional bool is_first_recharge = 14;</code>
     * @return this
     */
    public Product clearIsFirstRecharge() {
      bitField0_ &= ~0x00000020;
      isFirstRecharge = false;
      return this;
    }

    /**
     * <code>optional bool is_first_recharge = 14;</code>
     * @return the isFirstRecharge
     */
    public boolean getIsFirstRecharge() {
      return isFirstRecharge;
    }

    /**
     * <code>optional bool is_first_recharge = 14;</code>
     * @param value the isFirstRecharge to set
     * @return this
     */
    public Product setIsFirstRecharge(final boolean value) {
      bitField0_ |= 0x00000020;
      isFirstRecharge = value;
      return this;
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @return whether the productId field is set
     */
    public boolean hasProductId() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @return this
     */
    public Product clearProductId() {
      bitField0_ &= ~0x00000040;
      productId.clear();
      return this;
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @return the productId
     */
    public String getProductId() {
      return productId.getString();
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @return internal {@code Utf8String} representation of productId for reading
     */
    public Utf8String getProductIdBytes() {
      return this.productId;
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @return internal {@code Utf8String} representation of productId for modifications
     */
    public Utf8String getMutableProductIdBytes() {
      bitField0_ |= 0x00000040;
      return this.productId;
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @param value the productId to set
     * @return this
     */
    public Product setProductId(final CharSequence value) {
      bitField0_ |= 0x00000040;
      productId.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string product_id = 2;</code>
     * @param value the productId to set
     * @return this
     */
    public Product setProductId(final Utf8String value) {
      bitField0_ |= 0x00000040;
      productId.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @return whether the priceTier field is set
     */
    public boolean hasPriceTier() {
      return (bitField0_ & 0x00000080) != 0;
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @return this
     */
    public Product clearPriceTier() {
      bitField0_ &= ~0x00000080;
      priceTier.clear();
      return this;
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @return the priceTier
     */
    public String getPriceTier() {
      return priceTier.getString();
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @return internal {@code Utf8String} representation of priceTier for reading
     */
    public Utf8String getPriceTierBytes() {
      return this.priceTier;
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @return internal {@code Utf8String} representation of priceTier for modifications
     */
    public Utf8String getMutablePriceTierBytes() {
      bitField0_ |= 0x00000080;
      return this.priceTier;
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @param value the priceTier to set
     * @return this
     */
    public Product setPriceTier(final CharSequence value) {
      bitField0_ |= 0x00000080;
      priceTier.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string price_tier = 11;</code>
     * @param value the priceTier to set
     * @return this
     */
    public Product setPriceTier(final Utf8String value) {
      bitField0_ |= 0x00000080;
      priceTier.copyFrom(value);
      return this;
    }

    @Override
    public Product copyFrom(final Product other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        beginTime = other.beginTime;
        endTime = other.endTime;
        maxBuyTimes = other.maxBuyTimes;
        buyTimes = other.buyTimes;
        productGiftType = other.productGiftType;
        isFirstRecharge = other.isFirstRecharge;
        productId.copyFrom(other.productId);
        priceTier.copyFrom(other.priceTier);
      }
      return this;
    }

    @Override
    public Product mergeFrom(final Product other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasBeginTime()) {
        setBeginTime(other.beginTime);
      }
      if (other.hasEndTime()) {
        setEndTime(other.endTime);
      }
      if (other.hasMaxBuyTimes()) {
        setMaxBuyTimes(other.maxBuyTimes);
      }
      if (other.hasBuyTimes()) {
        setBuyTimes(other.buyTimes);
      }
      if (other.hasProductGiftType()) {
        setProductGiftTypeValue(other.productGiftType);
      }
      if (other.hasIsFirstRecharge()) {
        setIsFirstRecharge(other.isFirstRecharge);
      }
      if (other.hasProductId()) {
        getMutableProductIdBytes().copyFrom(other.productId);
      }
      if (other.hasPriceTier()) {
        getMutablePriceTierBytes().copyFrom(other.priceTier);
      }
      return this;
    }

    @Override
    public Product clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      beginTime = 0L;
      endTime = 0L;
      maxBuyTimes = 0;
      buyTimes = 0;
      productGiftType = 0;
      isFirstRecharge = false;
      productId.clear();
      priceTier.clear();
      return this;
    }

    @Override
    public Product clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      productId.clear();
      priceTier.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof Product)) {
        return false;
      }
      Product other = (Product) o;
      return bitField0_ == other.bitField0_
        && (!hasBeginTime() || beginTime == other.beginTime)
        && (!hasEndTime() || endTime == other.endTime)
        && (!hasMaxBuyTimes() || maxBuyTimes == other.maxBuyTimes)
        && (!hasBuyTimes() || buyTimes == other.buyTimes)
        && (!hasProductGiftType() || productGiftType == other.productGiftType)
        && (!hasIsFirstRecharge() || isFirstRecharge == other.isFirstRecharge)
        && (!hasProductId() || productId.equals(other.productId))
        && (!hasPriceTier() || priceTier.equals(other.priceTier));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeInt64NoTag(beginTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 48);
        output.writeInt64NoTag(endTime);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(maxBuyTimes);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(buyTimes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 104);
        output.writeEnumNoTag(productGiftType);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 112);
        output.writeBoolNoTag(isFirstRecharge);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawByte((byte) 18);
        output.writeStringNoTag(productId);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeRawByte((byte) 90);
        output.writeStringNoTag(priceTier);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt64SizeNoTag(beginTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeInt64SizeNoTag(endTime);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(maxBuyTimes);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(buyTimes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(productGiftType);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 1 + ProtoSink.computeStringSizeNoTag(productId);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        size += 1 + ProtoSink.computeStringSizeNoTag(priceTier);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public Product mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // beginTime
            beginTime = input.readInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // endTime
            endTime = input.readInt64();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // maxBuyTimes
            maxBuyTimes = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // buyTimes
            buyTimes = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 104) {
              break;
            }
          }
          case 104: {
            // productGiftType
            final int value = input.readInt32();
            if (ProductGiftType.forNumber(value) != null) {
              productGiftType = value;
              bitField0_ |= 0x00000010;
            }
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // isFirstRecharge
            isFirstRecharge = input.readBool();
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // productId
            input.readString(productId);
            bitField0_ |= 0x00000040;
            tag = input.readTag();
            if (tag != 90) {
              break;
            }
          }
          case 90: {
            // priceTier
            input.readString(priceTier);
            bitField0_ |= 0x00000080;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeInt64(FieldNames.beginTime, beginTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeInt64(FieldNames.endTime, endTime);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.maxBuyTimes, maxBuyTimes);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.buyTimes, buyTimes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeEnum(FieldNames.productGiftType, productGiftType, ProductGiftType.converter());
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeBool(FieldNames.isFirstRecharge, isFirstRecharge);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeString(FieldNames.productId, productId);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeString(FieldNames.priceTier, priceTier);
      }
      output.endObject();
    }

    @Override
    public Product mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1072839914:
          case 1112183971: {
            if (input.isAtField(FieldNames.beginTime)) {
              if (!input.trySkipNullValue()) {
                beginTime = input.readInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1607243192:
          case 1725551537: {
            if (input.isAtField(FieldNames.endTime)) {
              if (!input.trySkipNullValue()) {
                endTime = input.readInt64();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1037705700:
          case -802382030: {
            if (input.isAtField(FieldNames.maxBuyTimes)) {
              if (!input.trySkipNullValue()) {
                maxBuyTimes = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -994591648:
          case -442602419: {
            if (input.isAtField(FieldNames.buyTimes)) {
              if (!input.trySkipNullValue()) {
                buyTimes = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 996157081:
          case 713409945: {
            if (input.isAtField(FieldNames.productGiftType)) {
              if (!input.trySkipNullValue()) {
                final ProductGiftType value = input.readEnum(ProductGiftType.converter());
                if (value != null) {
                  productGiftType = value.getNumber();
                  bitField0_ |= 0x00000010;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1091216275:
          case 1798441739: {
            if (input.isAtField(FieldNames.isFirstRecharge)) {
              if (!input.trySkipNullValue()) {
                isFirstRecharge = input.readBool();
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1051830678:
          case 1753008747: {
            if (input.isAtField(FieldNames.productId)) {
              if (!input.trySkipNullValue()) {
                input.readString(productId);
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2125747509:
          case -1463173352: {
            if (input.isAtField(FieldNames.priceTier)) {
              if (!input.trySkipNullValue()) {
                input.readString(priceTier);
                bitField0_ |= 0x00000080;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

    @Override
    public Product clone() {
      return new Product().copyFrom(this);
    }

    @Override
    public boolean isEmpty() {
      return ((bitField0_) == 0);
    }

    public static Product parseFrom(final byte[] data) throws InvalidProtocolBufferException {
      return ProtoMessage.mergeFrom(new Product(), data).checkInitialized();
    }

    public static Product parseFrom(final ProtoSource input) throws IOException {
      return ProtoMessage.mergeFrom(new Product(), input).checkInitialized();
    }

    public static Product parseFrom(final JsonSource input) throws IOException {
      return ProtoMessage.mergeFrom(new Product(), input).checkInitialized();
    }

    /**
     * @return factory for creating Product messages
     */
    public static MessageFactory<Product> getFactory() {
      return ProductFactory.INSTANCE;
    }

    /**
     * Protobuf enum {@code ProductGiftType}
     */
    public enum ProductGiftType implements ProtoEnum<ProductGiftType> {
      /**
       * <code>PRODUCT_GIFT_NONE = 0;</code>
       */
      PRODUCT_GIFT_NONE("PRODUCT_GIFT_NONE", 0),

      /**
       * <code>PRODUCT_GIFT_COIN = 1;</code>
       */
      PRODUCT_GIFT_COIN("PRODUCT_GIFT_COIN", 1),

      /**
       * <code>PRODUCT_GIFT_MONTH_CARD = 2;</code>
       */
      PRODUCT_GIFT_MONTH_CARD("PRODUCT_GIFT_MONTH_CARD", 2),

      /**
       * <code>PRODUCT_GIFT_BP_68 = 3;</code>
       */
      PRODUCT_GIFT_BP_68("PRODUCT_GIFT_BP_68", 3),

      /**
       * <code>PRODUCT_GIFT_BP_128 = 4;</code>
       */
      PRODUCT_GIFT_BP_128("PRODUCT_GIFT_BP_128", 4),

      /**
       * <code>PRODUCT_GIFT_BP68_UPGRADE_128 = 5;</code>
       */
      PRODUCT_GIFT_BP68_UPGRADE_128("PRODUCT_GIFT_BP68_UPGRADE_128", 5),

      /**
       * <code>PRODUCT_GIFT_POINT_CARD = 6;</code>
       */
      PRODUCT_GIFT_POINT_CARD("PRODUCT_GIFT_POINT_CARD", 6),

      /**
       * <code>PRODUCT_GIFT_PS_PRE_ORDER_1 = 7;</code>
       */
      PRODUCT_GIFT_PS_PRE_ORDER_1("PRODUCT_GIFT_PS_PRE_ORDER_1", 7),

      /**
       * <code>PRODUCT_GIFT_PS_PRE_ORDER_2 = 8;</code>
       */
      PRODUCT_GIFT_PS_PRE_ORDER_2("PRODUCT_GIFT_PS_PRE_ORDER_2", 8),

      /**
       * <code>PRODUCT_GIFT_GOOGLE_POINTS_100 = 9;</code>
       */
      PRODUCT_GIFT_GOOGLE_POINTS_100("PRODUCT_GIFT_GOOGLE_POINTS_100", 9),

      /**
       * <code>PRODUCT_GIFT_GOOGLE_POINTS_150 = 10;</code>
       */
      PRODUCT_GIFT_GOOGLE_POINTS_150("PRODUCT_GIFT_GOOGLE_POINTS_150", 10),

      /**
       * <code>PRODUCT_GIFT_PS_POINT_CARD_030 = 11;</code>
       */
      PRODUCT_GIFT_PS_POINT_CARD_030("PRODUCT_GIFT_PS_POINT_CARD_030", 11),

      /**
       * <code>PRODUCT_GIFT_PS_POINT_CARD_050 = 12;</code>
       */
      PRODUCT_GIFT_PS_POINT_CARD_050("PRODUCT_GIFT_PS_POINT_CARD_050", 12),

      /**
       * <code>PRODUCT_GIFT_PS_POINT_CARD_100 = 13;</code>
       */
      PRODUCT_GIFT_PS_POINT_CARD_100("PRODUCT_GIFT_PS_POINT_CARD_100", 13),

      /**
       * <code>PRODUCT_GIFT_PSN_PLUS = 14;</code>
       */
      PRODUCT_GIFT_PSN_PLUS("PRODUCT_GIFT_PSN_PLUS", 14),

      /**
       * <code>PRODUCT_GIFT_SINGLE_6 = 15;</code>
       */
      PRODUCT_GIFT_SINGLE_6("PRODUCT_GIFT_SINGLE_6", 15),

      /**
       * <code>PRODUCT_GIFT_DAILY_LOGIN_30 = 16;</code>
       */
      PRODUCT_GIFT_DAILY_LOGIN_30("PRODUCT_GIFT_DAILY_LOGIN_30", 16),

      /**
       * <code>PRODUCT_GIFT_APPLE_GIFT_CARD = 17;</code>
       */
      PRODUCT_GIFT_APPLE_GIFT_CARD("PRODUCT_GIFT_APPLE_GIFT_CARD", 17),

      /**
       * <code>PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1 = 18;</code>
       */
      PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1("PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1", 18),

      /**
       * <code>PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10 = 19;</code>
       */
      PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10("PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10", 19),

      /**
       * <code>PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1 = 20;</code>
       */
      PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1("PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1", 20),

      /**
       * <code>PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10 = 21;</code>
       */
      PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10("PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10", 21),

      /**
       * <code>PRODUCT_GIFT_TICKET_10 = 22;</code>
       */
      PRODUCT_GIFT_TICKET_10("PRODUCT_GIFT_TICKET_10", 22);

      /**
       * <code>PRODUCT_GIFT_NONE = 0;</code>
       */
      public static final int PRODUCT_GIFT_NONE_VALUE = 0;

      /**
       * <code>PRODUCT_GIFT_COIN = 1;</code>
       */
      public static final int PRODUCT_GIFT_COIN_VALUE = 1;

      /**
       * <code>PRODUCT_GIFT_MONTH_CARD = 2;</code>
       */
      public static final int PRODUCT_GIFT_MONTH_CARD_VALUE = 2;

      /**
       * <code>PRODUCT_GIFT_BP_68 = 3;</code>
       */
      public static final int PRODUCT_GIFT_BP_68_VALUE = 3;

      /**
       * <code>PRODUCT_GIFT_BP_128 = 4;</code>
       */
      public static final int PRODUCT_GIFT_BP_128_VALUE = 4;

      /**
       * <code>PRODUCT_GIFT_BP68_UPGRADE_128 = 5;</code>
       */
      public static final int PRODUCT_GIFT_BP68_UPGRADE_128_VALUE = 5;

      /**
       * <code>PRODUCT_GIFT_POINT_CARD = 6;</code>
       */
      public static final int PRODUCT_GIFT_POINT_CARD_VALUE = 6;

      /**
       * <code>PRODUCT_GIFT_PS_PRE_ORDER_1 = 7;</code>
       */
      public static final int PRODUCT_GIFT_PS_PRE_ORDER_1_VALUE = 7;

      /**
       * <code>PRODUCT_GIFT_PS_PRE_ORDER_2 = 8;</code>
       */
      public static final int PRODUCT_GIFT_PS_PRE_ORDER_2_VALUE = 8;

      /**
       * <code>PRODUCT_GIFT_GOOGLE_POINTS_100 = 9;</code>
       */
      public static final int PRODUCT_GIFT_GOOGLE_POINTS_100_VALUE = 9;

      /**
       * <code>PRODUCT_GIFT_GOOGLE_POINTS_150 = 10;</code>
       */
      public static final int PRODUCT_GIFT_GOOGLE_POINTS_150_VALUE = 10;

      /**
       * <code>PRODUCT_GIFT_PS_POINT_CARD_030 = 11;</code>
       */
      public static final int PRODUCT_GIFT_PS_POINT_CARD_030_VALUE = 11;

      /**
       * <code>PRODUCT_GIFT_PS_POINT_CARD_050 = 12;</code>
       */
      public static final int PRODUCT_GIFT_PS_POINT_CARD_050_VALUE = 12;

      /**
       * <code>PRODUCT_GIFT_PS_POINT_CARD_100 = 13;</code>
       */
      public static final int PRODUCT_GIFT_PS_POINT_CARD_100_VALUE = 13;

      /**
       * <code>PRODUCT_GIFT_PSN_PLUS = 14;</code>
       */
      public static final int PRODUCT_GIFT_PSN_PLUS_VALUE = 14;

      /**
       * <code>PRODUCT_GIFT_SINGLE_6 = 15;</code>
       */
      public static final int PRODUCT_GIFT_SINGLE_6_VALUE = 15;

      /**
       * <code>PRODUCT_GIFT_DAILY_LOGIN_30 = 16;</code>
       */
      public static final int PRODUCT_GIFT_DAILY_LOGIN_30_VALUE = 16;

      /**
       * <code>PRODUCT_GIFT_APPLE_GIFT_CARD = 17;</code>
       */
      public static final int PRODUCT_GIFT_APPLE_GIFT_CARD_VALUE = 17;

      /**
       * <code>PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1 = 18;</code>
       */
      public static final int PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1_VALUE = 18;

      /**
       * <code>PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10 = 19;</code>
       */
      public static final int PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10_VALUE = 19;

      /**
       * <code>PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1 = 20;</code>
       */
      public static final int PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1_VALUE = 20;

      /**
       * <code>PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10 = 21;</code>
       */
      public static final int PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10_VALUE = 21;

      /**
       * <code>PRODUCT_GIFT_TICKET_10 = 22;</code>
       */
      public static final int PRODUCT_GIFT_TICKET_10_VALUE = 22;

      private final String name;

      private final int number;

      private ProductGiftType(String name, int number) {
        this.name = name;
        this.number = number;
      }

      /**
       * @return the string representation of enum entry
       */
      @Override
      public String getName() {
        return name;
      }

      /**
       * @return the numeric wire value of this enum entry
       */
      @Override
      public int getNumber() {
        return number;
      }

      /**
       * @return a converter that maps between this enum's numeric and text representations
       */
      public static ProtoEnum.EnumConverter<ProductGiftType> converter() {
        return ProductGiftTypeConverter.INSTANCE;
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value, or null if unknown.
       */
      public static ProductGiftType forNumber(int value) {
        return ProductGiftTypeConverter.INSTANCE.forNumber(value);
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @param other Fallback value in case the value is not known.
       * @return The enum associated with the given numeric wire value, or the fallback value if unknown.
       */
      public static ProductGiftType forNumberOr(int number, ProductGiftType other) {
        ProductGiftType value = forNumber(number);
        return value == null ? other : value;
      }

      enum ProductGiftTypeConverter implements ProtoEnum.EnumConverter<ProductGiftType> {
        INSTANCE;

        private static final ProductGiftType[] lookup = new ProductGiftType[23];

        static {
          lookup[0] = PRODUCT_GIFT_NONE;
          lookup[1] = PRODUCT_GIFT_COIN;
          lookup[2] = PRODUCT_GIFT_MONTH_CARD;
          lookup[3] = PRODUCT_GIFT_BP_68;
          lookup[4] = PRODUCT_GIFT_BP_128;
          lookup[5] = PRODUCT_GIFT_BP68_UPGRADE_128;
          lookup[6] = PRODUCT_GIFT_POINT_CARD;
          lookup[7] = PRODUCT_GIFT_PS_PRE_ORDER_1;
          lookup[8] = PRODUCT_GIFT_PS_PRE_ORDER_2;
          lookup[9] = PRODUCT_GIFT_GOOGLE_POINTS_100;
          lookup[10] = PRODUCT_GIFT_GOOGLE_POINTS_150;
          lookup[11] = PRODUCT_GIFT_PS_POINT_CARD_030;
          lookup[12] = PRODUCT_GIFT_PS_POINT_CARD_050;
          lookup[13] = PRODUCT_GIFT_PS_POINT_CARD_100;
          lookup[14] = PRODUCT_GIFT_PSN_PLUS;
          lookup[15] = PRODUCT_GIFT_SINGLE_6;
          lookup[16] = PRODUCT_GIFT_DAILY_LOGIN_30;
          lookup[17] = PRODUCT_GIFT_APPLE_GIFT_CARD;
          lookup[18] = PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1;
          lookup[19] = PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10;
          lookup[20] = PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1;
          lookup[21] = PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10;
          lookup[22] = PRODUCT_GIFT_TICKET_10;
        }

        @Override
        public final ProductGiftType forNumber(final int value) {
          if (value >= 0 && value < lookup.length) {
            return lookup[value];
          }
          return null;
        }

        @Override
        public final ProductGiftType forName(final CharSequence value) {
          switch (value.length()) {
            case 17: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_NONE", value)) {
                return PRODUCT_GIFT_NONE;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_COIN", value)) {
                return PRODUCT_GIFT_COIN;
              }
              break;
            }
            case 18: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_BP_68", value)) {
                return PRODUCT_GIFT_BP_68;
              }
              break;
            }
            case 19: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_BP_128", value)) {
                return PRODUCT_GIFT_BP_128;
              }
              break;
            }
            case 21: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_PSN_PLUS", value)) {
                return PRODUCT_GIFT_PSN_PLUS;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_SINGLE_6", value)) {
                return PRODUCT_GIFT_SINGLE_6;
              }
              break;
            }
            case 22: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_TICKET_10", value)) {
                return PRODUCT_GIFT_TICKET_10;
              }
              break;
            }
            case 23: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_MONTH_CARD", value)) {
                return PRODUCT_GIFT_MONTH_CARD;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_POINT_CARD", value)) {
                return PRODUCT_GIFT_POINT_CARD;
              }
              break;
            }
            case 27: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_PS_PRE_ORDER_1", value)) {
                return PRODUCT_GIFT_PS_PRE_ORDER_1;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_PS_PRE_ORDER_2", value)) {
                return PRODUCT_GIFT_PS_PRE_ORDER_2;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_DAILY_LOGIN_30", value)) {
                return PRODUCT_GIFT_DAILY_LOGIN_30;
              }
              break;
            }
            case 28: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_APPLE_GIFT_CARD", value)) {
                return PRODUCT_GIFT_APPLE_GIFT_CARD;
              }
              break;
            }
            case 29: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_BP68_UPGRADE_128", value)) {
                return PRODUCT_GIFT_BP68_UPGRADE_128;
              }
              break;
            }
            case 30: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_GOOGLE_POINTS_100", value)) {
                return PRODUCT_GIFT_GOOGLE_POINTS_100;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_GOOGLE_POINTS_150", value)) {
                return PRODUCT_GIFT_GOOGLE_POINTS_150;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_PS_POINT_CARD_030", value)) {
                return PRODUCT_GIFT_PS_POINT_CARD_030;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_PS_POINT_CARD_050", value)) {
                return PRODUCT_GIFT_PS_POINT_CARD_050;
              }
              if (ProtoUtil.isEqual("PRODUCT_GIFT_PS_POINT_CARD_100", value)) {
                return PRODUCT_GIFT_PS_POINT_CARD_100;
              }
              break;
            }
            case 34: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1", value)) {
                return PRODUCT_GIFT_FTC_UP_GACHA_TICKET_1;
              }
              break;
            }
            case 35: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10", value)) {
                return PRODUCT_GIFT_FTC_UP_GACHA_TICKET_10;
              }
              break;
            }
            case 38: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1", value)) {
                return PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_1;
              }
              break;
            }
            case 39: {
              if (ProtoUtil.isEqual("PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10", value)) {
                return PRODUCT_GIFT_FTC_NORMAL_GACHA_TICKET_10;
              }
              break;
            }
          }
          return null;
        }
      }
    }

    private enum ProductFactory implements MessageFactory<Product> {
      INSTANCE;

      @Override
      public Product create() {
        return Product.newInstance();
      }
    }

    /**
     * Contains name constants used for serializing JSON
     */
    static class FieldNames {
      static final FieldName beginTime = FieldName.forField("beginTime", "begin_time");

      static final FieldName endTime = FieldName.forField("endTime", "end_time");

      static final FieldName maxBuyTimes = FieldName.forField("maxBuyTimes", "max_buy_times");

      static final FieldName buyTimes = FieldName.forField("buyTimes", "buy_times");

      static final FieldName productGiftType = FieldName.forField("productGiftType", "product_gift_type");

      static final FieldName isFirstRecharge = FieldName.forField("isFirstRecharge", "is_first_recharge");

      static final FieldName productId = FieldName.forField("productId", "product_id");

      static final FieldName priceTier = FieldName.forField("priceTier", "price_tier");
    }
  }
}
