// 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;
import us.hebi.quickbuf.RepeatedMessage;

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

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

    /**
     * <code>optional uint32 LevelId = 2;</code>
     */
    private int levelId;

    /**
     * <code>optional uint32 Times = 3;</code>
     */
    private int times;

    /**
     * <code>optional .Events Events = 15;</code>
     */
    private final Public.Events events = Public.Events.newInstance();

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

    private ActivityLevelsSweepReq() {
    }

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

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

    /**
     * <code>optional uint32 ActivityId = 1;</code>
     * @return this
     */
    public ActivityLevelsSweepReq clearActivityId() {
      bitField0_ &= ~0x00000001;
      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 ActivityLevelsSweepReq setActivityId(final int value) {
      bitField0_ |= 0x00000001;
      activityId = value;
      return this;
    }

    /**
     * <code>optional uint32 LevelId = 2;</code>
     * @return whether the levelId field is set
     */
    public boolean hasLevelId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 LevelId = 2;</code>
     * @return this
     */
    public ActivityLevelsSweepReq clearLevelId() {
      bitField0_ &= ~0x00000002;
      levelId = 0;
      return this;
    }

    /**
     * <code>optional uint32 LevelId = 2;</code>
     * @return the levelId
     */
    public int getLevelId() {
      return levelId;
    }

    /**
     * <code>optional uint32 LevelId = 2;</code>
     * @param value the levelId to set
     * @return this
     */
    public ActivityLevelsSweepReq setLevelId(final int value) {
      bitField0_ |= 0x00000002;
      levelId = value;
      return this;
    }

    /**
     * <code>optional uint32 Times = 3;</code>
     * @return whether the times field is set
     */
    public boolean hasTimes() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 Times = 3;</code>
     * @return this
     */
    public ActivityLevelsSweepReq clearTimes() {
      bitField0_ &= ~0x00000004;
      times = 0;
      return this;
    }

    /**
     * <code>optional uint32 Times = 3;</code>
     * @return the times
     */
    public int getTimes() {
      return times;
    }

    /**
     * <code>optional uint32 Times = 3;</code>
     * @param value the times to set
     * @return this
     */
    public ActivityLevelsSweepReq setTimes(final int value) {
      bitField0_ |= 0x00000004;
      times = value;
      return this;
    }

    /**
     * <code>optional .Events Events = 15;</code>
     * @return whether the events field is set
     */
    public boolean hasEvents() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .Events Events = 15;</code>
     * @return this
     */
    public ActivityLevelsSweepReq clearEvents() {
      bitField0_ &= ~0x00000008;
      events.clear();
      return this;
    }

    /**
     * <code>optional .Events Events = 15;</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 #getMutableEvents()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.Events getEvents() {
      return events;
    }

    /**
     * <code>optional .Events Events = 15;</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.Events getMutableEvents() {
      bitField0_ |= 0x00000008;
      return events;
    }

    /**
     * <code>optional .Events Events = 15;</code>
     * @param value the events to set
     * @return this
     */
    public ActivityLevelsSweepReq setEvents(final Public.Events value) {
      bitField0_ |= 0x00000008;
      events.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 ActivityLevelsSweepReq 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 ActivityLevelsSweepReq 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 ActivityLevelsSweepReq 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 ActivityLevelsSweepReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public ActivityLevelsSweepReq copyFrom(final ActivityLevelsSweepReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        activityId = other.activityId;
        levelId = other.levelId;
        times = other.times;
        events.copyFrom(other.events);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public ActivityLevelsSweepReq mergeFrom(final ActivityLevelsSweepReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasActivityId()) {
        setActivityId(other.activityId);
      }
      if (other.hasLevelId()) {
        setLevelId(other.levelId);
      }
      if (other.hasTimes()) {
        setTimes(other.times);
      }
      if (other.hasEvents()) {
        getMutableEvents().mergeFrom(other.events);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public ActivityLevelsSweepReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      activityId = 0;
      levelId = 0;
      times = 0;
      events.clear();
      nextPackage.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ActivityLevelsSweepReq)) {
        return false;
      }
      ActivityLevelsSweepReq other = (ActivityLevelsSweepReq) o;
      return bitField0_ == other.bitField0_
        && (!hasActivityId() || activityId == other.activityId)
        && (!hasLevelId() || levelId == other.levelId)
        && (!hasTimes() || times == other.times)
        && (!hasEvents() || events.equals(other.events))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(activityId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(levelId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(times);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 122);
        output.writeMessageNoTag(events);
      }
      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(activityId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(levelId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(times);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(events);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ActivityLevelsSweepReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // activityId
            activityId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // levelId
            levelId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // times
            times = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 122) {
              break;
            }
          }
          case 122: {
            // events
            input.readMessage(events);
            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.activityId, activityId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.levelId, levelId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.times, times);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.events, events);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public ActivityLevelsSweepReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -252882774: {
            if (input.isAtField(FieldNames.activityId)) {
              if (!input.trySkipNullValue()) {
                activityId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1734437791: {
            if (input.isAtField(FieldNames.levelId)) {
              if (!input.trySkipNullValue()) {
                levelId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 80811814: {
            if (input.isAtField(FieldNames.times)) {
              if (!input.trySkipNullValue()) {
                times = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2087505209: {
            if (input.isAtField(FieldNames.events)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(events);
                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 ActivityLevelsSweepReq clone() {
      return new ActivityLevelsSweepReq().copyFrom(this);
    }

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

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

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

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

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

    private enum ActivityLevelsSweepReqFactory implements MessageFactory<ActivityLevelsSweepReq> {
      INSTANCE;

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

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

      static final FieldName levelId = FieldName.forField("LevelId");

      static final FieldName times = FieldName.forField("Times");

      static final FieldName events = FieldName.forField("Events");

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

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

    /**
     * <code>optional uint32 Exp = 2;</code>
     */
    private int exp;

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

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</code>
     */
    private final RepeatedMessage<Public.ItemTpl> awardItems = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());

    private ActivityLevelsSweepReward() {
    }

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

    /**
     * <code>optional uint32 Exp = 2;</code>
     * @return whether the exp field is set
     */
    public boolean hasExp() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Exp = 2;</code>
     * @return this
     */
    public ActivityLevelsSweepReward clearExp() {
      bitField0_ &= ~0x00000001;
      exp = 0;
      return this;
    }

    /**
     * <code>optional uint32 Exp = 2;</code>
     * @return the exp
     */
    public int getExp() {
      return exp;
    }

    /**
     * <code>optional uint32 Exp = 2;</code>
     * @param value the exp to set
     * @return this
     */
    public ActivityLevelsSweepReward setExp(final int value) {
      bitField0_ |= 0x00000001;
      exp = value;
      return this;
    }

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

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public ActivityLevelsSweepReward clearNextPackage() {
      bitField0_ &= ~0x00000002;
      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_ |= 0x00000002;
      return nextPackage;
    }

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

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

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

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</code>
     * @return whether the awardItems field is set
     */
    public boolean hasAwardItems() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</code>
     * @return this
     */
    public ActivityLevelsSweepReward clearAwardItems() {
      bitField0_ &= ~0x00000004;
      awardItems.clear();
      return this;
    }

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</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 #getMutableAwardItems()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<Public.ItemTpl> getAwardItems() {
      return awardItems;
    }

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</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 RepeatedMessage<Public.ItemTpl> getMutableAwardItems() {
      bitField0_ |= 0x00000004;
      return awardItems;
    }

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</code>
     * @param value the awardItems to add
     * @return this
     */
    public ActivityLevelsSweepReward addAwardItems(final Public.ItemTpl value) {
      bitField0_ |= 0x00000004;
      awardItems.add(value);
      return this;
    }

    /**
     * <code>repeated .ItemTpl AwardItems = 1;</code>
     * @param values the awardItems to add
     * @return this
     */
    public ActivityLevelsSweepReward addAllAwardItems(final Public.ItemTpl... values) {
      bitField0_ |= 0x00000004;
      awardItems.addAll(values);
      return this;
    }

    @Override
    public ActivityLevelsSweepReward copyFrom(final ActivityLevelsSweepReward other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        exp = other.exp;
        nextPackage.copyFrom(other.nextPackage);
        awardItems.copyFrom(other.awardItems);
      }
      return this;
    }

    @Override
    public ActivityLevelsSweepReward mergeFrom(final ActivityLevelsSweepReward other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasExp()) {
        setExp(other.exp);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasAwardItems()) {
        getMutableAwardItems().addAll(other.awardItems);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ActivityLevelsSweepReward)) {
        return false;
      }
      ActivityLevelsSweepReward other = (ActivityLevelsSweepReward) o;
      return bitField0_ == other.bitField0_
        && (!hasExp() || exp == other.exp)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasAwardItems() || awardItems.equals(other.awardItems));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(exp);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < awardItems.length(); i++) {
          output.writeRawByte((byte) 10);
          output.writeMessageNoTag(awardItems.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(exp);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * awardItems.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(awardItems);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ActivityLevelsSweepReward mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // exp
            exp = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // awardItems
            tag = input.readRepeatedMessage(awardItems, tag);
            bitField0_ |= 0x00000004;
            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.exp, exp);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.awardItems, awardItems);
      }
      output.endObject();
    }

    @Override
    public ActivityLevelsSweepReward mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 70141: {
            if (input.isAtField(FieldNames.exp)) {
              if (!input.trySkipNullValue()) {
                exp = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1943188605: {
            if (input.isAtField(FieldNames.awardItems)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(awardItems);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ActivityLevelsSweepRewardFactory implements MessageFactory<ActivityLevelsSweepReward> {
      INSTANCE;

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

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

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

      static final FieldName awardItems = FieldName.forField("AwardItems");
    }
  }

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

    /**
     * <code>optional .ChangeInfo ChangeInfo = 1;</code>
     */
    private final Public.ChangeInfo changeInfo = Public.ChangeInfo.newInstance();

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

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 2;</code>
     */
    private final RepeatedMessage<ActivityLevelsSweepReward> rewards = RepeatedMessage.newEmptyInstance(ActivityLevelsSweepReward.getFactory());

    private ActivityLevelsSweepResp() {
    }

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

    /**
     * <code>optional .ChangeInfo ChangeInfo = 1;</code>
     * @return whether the changeInfo field is set
     */
    public boolean hasChangeInfo() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .ChangeInfo ChangeInfo = 1;</code>
     * @return this
     */
    public ActivityLevelsSweepResp clearChangeInfo() {
      bitField0_ &= ~0x00000001;
      changeInfo.clear();
      return this;
    }

    /**
     * <code>optional .ChangeInfo ChangeInfo = 1;</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 #getMutableChangeInfo()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.ChangeInfo getChangeInfo() {
      return changeInfo;
    }

    /**
     * <code>optional .ChangeInfo ChangeInfo = 1;</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 getMutableChangeInfo() {
      bitField0_ |= 0x00000001;
      return changeInfo;
    }

    /**
     * <code>optional .ChangeInfo ChangeInfo = 1;</code>
     * @param value the changeInfo to set
     * @return this
     */
    public ActivityLevelsSweepResp setChangeInfo(final Public.ChangeInfo value) {
      bitField0_ |= 0x00000001;
      changeInfo.copyFrom(value);
      return this;
    }

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

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public ActivityLevelsSweepResp clearNextPackage() {
      bitField0_ &= ~0x00000002;
      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_ |= 0x00000002;
      return nextPackage;
    }

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

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

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

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 2;</code>
     * @return whether the rewards field is set
     */
    public boolean hasRewards() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 2;</code>
     * @return this
     */
    public ActivityLevelsSweepResp clearRewards() {
      bitField0_ &= ~0x00000004;
      rewards.clear();
      return this;
    }

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 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 #getMutableRewards()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<ActivityLevelsSweepReward> getRewards() {
      return rewards;
    }

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 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 RepeatedMessage<ActivityLevelsSweepReward> getMutableRewards() {
      bitField0_ |= 0x00000004;
      return rewards;
    }

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 2;</code>
     * @param value the rewards to add
     * @return this
     */
    public ActivityLevelsSweepResp addRewards(final ActivityLevelsSweepReward value) {
      bitField0_ |= 0x00000004;
      rewards.add(value);
      return this;
    }

    /**
     * <code>repeated .ActivityLevelsSweepReward Rewards = 2;</code>
     * @param values the rewards to add
     * @return this
     */
    public ActivityLevelsSweepResp addAllRewards(final ActivityLevelsSweepReward... values) {
      bitField0_ |= 0x00000004;
      rewards.addAll(values);
      return this;
    }

    @Override
    public ActivityLevelsSweepResp copyFrom(final ActivityLevelsSweepResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        changeInfo.copyFrom(other.changeInfo);
        nextPackage.copyFrom(other.nextPackage);
        rewards.copyFrom(other.rewards);
      }
      return this;
    }

    @Override
    public ActivityLevelsSweepResp mergeFrom(final ActivityLevelsSweepResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasChangeInfo()) {
        getMutableChangeInfo().mergeFrom(other.changeInfo);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasRewards()) {
        getMutableRewards().addAll(other.rewards);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ActivityLevelsSweepResp)) {
        return false;
      }
      ActivityLevelsSweepResp other = (ActivityLevelsSweepResp) o;
      return bitField0_ == other.bitField0_
        && (!hasChangeInfo() || changeInfo.equals(other.changeInfo))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasRewards() || rewards.equals(other.rewards));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 10);
        output.writeMessageNoTag(changeInfo);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < rewards.length(); i++) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(rewards.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(changeInfo);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * rewards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(rewards);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ActivityLevelsSweepResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 10: {
            // changeInfo
            input.readMessage(changeInfo);
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // rewards
            tag = input.readRepeatedMessage(rewards, tag);
            bitField0_ |= 0x00000004;
            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.writeMessage(FieldNames.changeInfo, changeInfo);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.rewards, rewards);
      }
      output.endObject();
    }

    @Override
    public ActivityLevelsSweepResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -138776418: {
            if (input.isAtField(FieldNames.changeInfo)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(changeInfo);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1529663740: {
            if (input.isAtField(FieldNames.rewards)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(rewards);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ActivityLevelsSweepRespFactory implements MessageFactory<ActivityLevelsSweepResp> {
      INSTANCE;

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

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

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

      static final FieldName rewards = FieldName.forField("Rewards");
    }
  }
}
