// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedByte;

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

    /**
     * <code>optional int64 RefreshTime = 3;</code>
     */
    private long refreshTime;

    /**
     * <code>optional uint32 ActivityId = 1;</code>
     */
    private int activityId;

    /**
     * <code>optional uint32 ShopId = 2;</code>
     */
    private int shopId;

    /**
     * <code>optional uint32 GoodsId = 4;</code>
     */
    private int goodsId;

    /**
     * <code>optional uint32 Number = 5;</code>
     */
    private int number;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private ActivityShopPurchaseReq() {
    }

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

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

    /**
     * <code>optional int64 RefreshTime = 3;</code>
     * @return this
     */
    public ActivityShopPurchaseReq clearRefreshTime() {
      bitField0_ &= ~0x00000001;
      refreshTime = 0L;
      return this;
    }

    /**
     * <code>optional int64 RefreshTime = 3;</code>
     * @return the refreshTime
     */
    public long getRefreshTime() {
      return refreshTime;
    }

    /**
     * <code>optional int64 RefreshTime = 3;</code>
     * @param value the refreshTime to set
     * @return this
     */
    public ActivityShopPurchaseReq setRefreshTime(final long value) {
      bitField0_ |= 0x00000001;
      refreshTime = value;
      return this;
    }

    /**
     * <code>optional uint32 ActivityId = 1;</code>
     * @return whether the activityId field is set
     */
    public boolean hasActivityId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 ActivityId = 1;</code>
     * @return this
     */
    public ActivityShopPurchaseReq clearActivityId() {
      bitField0_ &= ~0x00000002;
      activityId = 0;
      return this;
    }

    /**
     * <code>optional uint32 ActivityId = 1;</code>
     * @return the activityId
     */
    public int getActivityId() {
      return activityId;
    }

    /**
     * <code>optional uint32 ActivityId = 1;</code>
     * @param value the activityId to set
     * @return this
     */
    public ActivityShopPurchaseReq setActivityId(final int value) {
      bitField0_ |= 0x00000002;
      activityId = value;
      return this;
    }

    /**
     * <code>optional uint32 ShopId = 2;</code>
     * @return whether the shopId field is set
     */
    public boolean hasShopId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 ShopId = 2;</code>
     * @return this
     */
    public ActivityShopPurchaseReq clearShopId() {
      bitField0_ &= ~0x00000004;
      shopId = 0;
      return this;
    }

    /**
     * <code>optional uint32 ShopId = 2;</code>
     * @return the shopId
     */
    public int getShopId() {
      return shopId;
    }

    /**
     * <code>optional uint32 ShopId = 2;</code>
     * @param value the shopId to set
     * @return this
     */
    public ActivityShopPurchaseReq setShopId(final int value) {
      bitField0_ |= 0x00000004;
      shopId = value;
      return this;
    }

    /**
     * <code>optional uint32 GoodsId = 4;</code>
     * @return whether the goodsId field is set
     */
    public boolean hasGoodsId() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 GoodsId = 4;</code>
     * @return this
     */
    public ActivityShopPurchaseReq clearGoodsId() {
      bitField0_ &= ~0x00000008;
      goodsId = 0;
      return this;
    }

    /**
     * <code>optional uint32 GoodsId = 4;</code>
     * @return the goodsId
     */
    public int getGoodsId() {
      return goodsId;
    }

    /**
     * <code>optional uint32 GoodsId = 4;</code>
     * @param value the goodsId to set
     * @return this
     */
    public ActivityShopPurchaseReq setGoodsId(final int value) {
      bitField0_ |= 0x00000008;
      goodsId = value;
      return this;
    }

    /**
     * <code>optional uint32 Number = 5;</code>
     * @return whether the number field is set
     */
    public boolean hasNumber() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional uint32 Number = 5;</code>
     * @return this
     */
    public ActivityShopPurchaseReq clearNumber() {
      bitField0_ &= ~0x00000010;
      number = 0;
      return this;
    }

    /**
     * <code>optional uint32 Number = 5;</code>
     * @return the number
     */
    public int getNumber() {
      return number;
    }

    /**
     * <code>optional uint32 Number = 5;</code>
     * @param value the number to set
     * @return this
     */
    public ActivityShopPurchaseReq setNumber(final int value) {
      bitField0_ |= 0x00000010;
      number = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public ActivityShopPurchaseReq clearNextPackage() {
      bitField0_ &= ~0x00000020;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000020;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public ActivityShopPurchaseReq addNextPackage(final byte value) {
      bitField0_ |= 0x00000020;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public ActivityShopPurchaseReq addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000020;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public ActivityShopPurchaseReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000020;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public ActivityShopPurchaseReq copyFrom(final ActivityShopPurchaseReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        refreshTime = other.refreshTime;
        activityId = other.activityId;
        shopId = other.shopId;
        goodsId = other.goodsId;
        number = other.number;
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public ActivityShopPurchaseReq mergeFrom(final ActivityShopPurchaseReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRefreshTime()) {
        setRefreshTime(other.refreshTime);
      }
      if (other.hasActivityId()) {
        setActivityId(other.activityId);
      }
      if (other.hasShopId()) {
        setShopId(other.shopId);
      }
      if (other.hasGoodsId()) {
        setGoodsId(other.goodsId);
      }
      if (other.hasNumber()) {
        setNumber(other.number);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public ActivityShopPurchaseReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      refreshTime = 0L;
      activityId = 0;
      shopId = 0;
      goodsId = 0;
      number = 0;
      nextPackage.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ActivityShopPurchaseReq)) {
        return false;
      }
      ActivityShopPurchaseReq other = (ActivityShopPurchaseReq) o;
      return bitField0_ == other.bitField0_
        && (!hasRefreshTime() || refreshTime == other.refreshTime)
        && (!hasActivityId() || activityId == other.activityId)
        && (!hasShopId() || shopId == other.shopId)
        && (!hasGoodsId() || goodsId == other.goodsId)
        && (!hasNumber() || number == other.number)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeInt64NoTag(refreshTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(activityId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(shopId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(goodsId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(number);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt64SizeNoTag(refreshTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(activityId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(shopId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(goodsId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(number);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ActivityShopPurchaseReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // refreshTime
            refreshTime = input.readInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 8) {
              break;
            }
          }
          case 8: {
            // activityId
            activityId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // shopId
            shopId = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // goodsId
            goodsId = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // number
            number = input.readUInt32();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000020;
            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.refreshTime, refreshTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.activityId, activityId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.shopId, shopId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.goodsId, goodsId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeUInt32(FieldNames.number, number);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public ActivityShopPurchaseReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 280566824: {
            if (input.isAtField(FieldNames.refreshTime)) {
              if (!input.trySkipNullValue()) {
                refreshTime = input.readInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -252882774: {
            if (input.isAtField(FieldNames.activityId)) {
              if (!input.trySkipNullValue()) {
                activityId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1819284783: {
            if (input.isAtField(FieldNames.shopId)) {
              if (!input.trySkipNullValue()) {
                shopId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1871690481: {
            if (input.isAtField(FieldNames.goodsId)) {
              if (!input.trySkipNullValue()) {
                goodsId = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1950496919: {
            if (input.isAtField(FieldNames.number)) {
              if (!input.trySkipNullValue()) {
                number = input.readUInt32();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ActivityShopPurchaseReqFactory implements MessageFactory<ActivityShopPurchaseReq> {
      INSTANCE;

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

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

      static final FieldName activityId = FieldName.forField("ActivityId");

      static final FieldName shopId = FieldName.forField("ShopId");

      static final FieldName goodsId = FieldName.forField("GoodsId");

      static final FieldName number = FieldName.forField("Number");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }

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

    /**
     * <code>optional uint32 PurchasedNumber = 3;</code>
     */
    private int purchasedNumber;

    /**
     * <code>optional bool IsRefresh = 1;</code>
     */
    private boolean isRefresh;

    /**
     * <code>optional .ResidentShop Shop = 2;</code>
     */
    private final Public.ResidentShop shop = Public.ResidentShop.newInstance();

    /**
     * <code>optional .ChangeInfo Change = 4;</code>
     */
    private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private ActivityShopPurchaseResp() {
    }

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

    /**
     * <code>optional uint32 PurchasedNumber = 3;</code>
     * @return whether the purchasedNumber field is set
     */
    public boolean hasPurchasedNumber() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 PurchasedNumber = 3;</code>
     * @return this
     */
    public ActivityShopPurchaseResp clearPurchasedNumber() {
      bitField0_ &= ~0x00000001;
      purchasedNumber = 0;
      return this;
    }

    /**
     * <code>optional uint32 PurchasedNumber = 3;</code>
     * @return the purchasedNumber
     */
    public int getPurchasedNumber() {
      return purchasedNumber;
    }

    /**
     * <code>optional uint32 PurchasedNumber = 3;</code>
     * @param value the purchasedNumber to set
     * @return this
     */
    public ActivityShopPurchaseResp setPurchasedNumber(final int value) {
      bitField0_ |= 0x00000001;
      purchasedNumber = value;
      return this;
    }

    /**
     * <code>optional bool IsRefresh = 1;</code>
     * @return whether the isRefresh field is set
     */
    public boolean hasIsRefresh() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bool IsRefresh = 1;</code>
     * @return this
     */
    public ActivityShopPurchaseResp clearIsRefresh() {
      bitField0_ &= ~0x00000002;
      isRefresh = false;
      return this;
    }

    /**
     * <code>optional bool IsRefresh = 1;</code>
     * @return the isRefresh
     */
    public boolean getIsRefresh() {
      return isRefresh;
    }

    /**
     * <code>optional bool IsRefresh = 1;</code>
     * @param value the isRefresh to set
     * @return this
     */
    public ActivityShopPurchaseResp setIsRefresh(final boolean value) {
      bitField0_ |= 0x00000002;
      isRefresh = value;
      return this;
    }

    /**
     * <code>optional .ResidentShop Shop = 2;</code>
     * @return whether the shop field is set
     */
    public boolean hasShop() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .ResidentShop Shop = 2;</code>
     * @return this
     */
    public ActivityShopPurchaseResp clearShop() {
      bitField0_ &= ~0x00000004;
      shop.clear();
      return this;
    }

    /**
     * <code>optional .ResidentShop Shop = 2;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableShop()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.ResidentShop getShop() {
      return shop;
    }

    /**
     * <code>optional .ResidentShop Shop = 2;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public Public.ResidentShop getMutableShop() {
      bitField0_ |= 0x00000004;
      return shop;
    }

    /**
     * <code>optional .ResidentShop Shop = 2;</code>
     * @param value the shop to set
     * @return this
     */
    public ActivityShopPurchaseResp setShop(final Public.ResidentShop value) {
      bitField0_ |= 0x00000004;
      shop.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .ChangeInfo Change = 4;</code>
     * @return whether the change field is set
     */
    public boolean hasChange() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .ChangeInfo Change = 4;</code>
     * @return this
     */
    public ActivityShopPurchaseResp clearChange() {
      bitField0_ &= ~0x00000008;
      change.clear();
      return this;
    }

    /**
     * <code>optional .ChangeInfo Change = 4;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableChange()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.ChangeInfo getChange() {
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 4;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public Public.ChangeInfo getMutableChange() {
      bitField0_ |= 0x00000008;
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 4;</code>
     * @param value the change to set
     * @return this
     */
    public ActivityShopPurchaseResp setChange(final Public.ChangeInfo value) {
      bitField0_ |= 0x00000008;
      change.copyFrom(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public ActivityShopPurchaseResp clearNextPackage() {
      bitField0_ &= ~0x00000010;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000010;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public ActivityShopPurchaseResp addNextPackage(final byte value) {
      bitField0_ |= 0x00000010;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public ActivityShopPurchaseResp addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public ActivityShopPurchaseResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public ActivityShopPurchaseResp copyFrom(final ActivityShopPurchaseResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        purchasedNumber = other.purchasedNumber;
        isRefresh = other.isRefresh;
        shop.copyFrom(other.shop);
        change.copyFrom(other.change);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public ActivityShopPurchaseResp mergeFrom(final ActivityShopPurchaseResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasPurchasedNumber()) {
        setPurchasedNumber(other.purchasedNumber);
      }
      if (other.hasIsRefresh()) {
        setIsRefresh(other.isRefresh);
      }
      if (other.hasShop()) {
        getMutableShop().mergeFrom(other.shop);
      }
      if (other.hasChange()) {
        getMutableChange().mergeFrom(other.change);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public ActivityShopPurchaseResp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      purchasedNumber = 0;
      isRefresh = false;
      shop.clear();
      change.clear();
      nextPackage.clear();
      return this;
    }

    @Override
    public ActivityShopPurchaseResp clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      shop.clearQuick();
      change.clearQuick();
      nextPackage.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ActivityShopPurchaseResp)) {
        return false;
      }
      ActivityShopPurchaseResp other = (ActivityShopPurchaseResp) o;
      return bitField0_ == other.bitField0_
        && (!hasPurchasedNumber() || purchasedNumber == other.purchasedNumber)
        && (!hasIsRefresh() || isRefresh == other.isRefresh)
        && (!hasShop() || shop.equals(other.shop))
        && (!hasChange() || change.equals(other.change))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(purchasedNumber);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 8);
        output.writeBoolNoTag(isRefresh);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 18);
        output.writeMessageNoTag(shop);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 34);
        output.writeMessageNoTag(change);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(purchasedNumber);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(shop);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(change);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ActivityShopPurchaseResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // purchasedNumber
            purchasedNumber = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 8) {
              break;
            }
          }
          case 8: {
            // isRefresh
            isRefresh = input.readBool();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // shop
            input.readMessage(shop);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 34) {
              break;
            }
          }
          case 34: {
            // change
            input.readMessage(change);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000010;
            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.writeUInt32(FieldNames.purchasedNumber, purchasedNumber);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBool(FieldNames.isRefresh, isRefresh);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeMessage(FieldNames.shop, shop);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.change, change);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public ActivityShopPurchaseResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1475882124: {
            if (input.isAtField(FieldNames.purchasedNumber)) {
              if (!input.trySkipNullValue()) {
                purchasedNumber = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1785333199: {
            if (input.isAtField(FieldNames.isRefresh)) {
              if (!input.trySkipNullValue()) {
                isRefresh = input.readBool();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2576150: {
            if (input.isAtField(FieldNames.shop)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(shop);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2017198032: {
            if (input.isAtField(FieldNames.change)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(change);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ActivityShopPurchaseRespFactory implements MessageFactory<ActivityShopPurchaseResp> {
      INSTANCE;

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

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

      static final FieldName isRefresh = FieldName.forField("IsRefresh");

      static final FieldName shop = FieldName.forField("Shop");

      static final FieldName change = FieldName.forField("Change");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }
}
