// 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 RegionBossLevelSweep {
  /**
   * Protobuf type {@code RegionBossLevelSweepReq}
   */
  public static final class RegionBossLevelSweepReq extends ProtoMessage<RegionBossLevelSweepReq> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional uint32 Id = 1;</code>
     */
    private int id;

    /**
     * <code>optional uint32 Times = 2;</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 RegionBossLevelSweepReq() {
    }

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

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public RegionBossLevelSweepReq clearId() {
      bitField0_ &= ~0x00000001;
      id = 0;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return the id
     */
    public int getId() {
      return id;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public RegionBossLevelSweepReq setId(final int value) {
      bitField0_ |= 0x00000001;
      id = value;
      return this;
    }

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

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

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

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

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

    /**
     * <code>optional .Events Events = 15;</code>
     * @return this
     */
    public RegionBossLevelSweepReq clearEvents() {
      bitField0_ &= ~0x00000004;
      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_ |= 0x00000004;
      return events;
    }

    /**
     * <code>optional .Events Events = 15;</code>
     * @param value the events to set
     * @return this
     */
    public RegionBossLevelSweepReq setEvents(final Public.Events value) {
      bitField0_ |= 0x00000004;
      events.copyFrom(value);
      return this;
    }

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

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

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

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

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

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

    @Override
    public RegionBossLevelSweepReq mergeFrom(final RegionBossLevelSweepReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasTimes()) {
        setTimes(other.times);
      }
      if (other.hasEvents()) {
        getMutableEvents().mergeFrom(other.events);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

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

    @Override
    public RegionBossLevelSweepReq 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 RegionBossLevelSweepReq)) {
        return false;
      }
      RegionBossLevelSweepReq other = (RegionBossLevelSweepReq) o;
      return bitField0_ == other.bitField0_
        && (!hasId() || id == other.id)
        && (!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(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(times);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 122);
        output.writeMessageNoTag(events);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

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

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

    @Override
    public RegionBossLevelSweepReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 80811814: {
            if (input.isAtField(FieldNames.times)) {
              if (!input.trySkipNullValue()) {
                times = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2087505209: {
            if (input.isAtField(FieldNames.events)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(events);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RegionBossLevelSweepReqFactory implements MessageFactory<RegionBossLevelSweepReq> {
      INSTANCE;

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

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

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

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

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

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

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

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

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

    private RegionBossLevelSweepResp() {
    }

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

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

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

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

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

    /**
     * <code>optional .ChangeInfo Change = 1;</code>
     * @param value the change to set
     * @return this
     */
    public RegionBossLevelSweepResp setChange(final Public.ChangeInfo value) {
      bitField0_ |= 0x00000001;
      change.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 RegionBossLevelSweepResp 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 RegionBossLevelSweepResp 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 RegionBossLevelSweepResp 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 RegionBossLevelSweepResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.copyFrom(values);
      return this;
    }

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

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

    /**
     * <code>repeated .RegionBossLevelSweepRewards 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<RegionBossLevelSweepRewards> getRewards() {
      return rewards;
    }

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

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

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

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

    @Override
    public RegionBossLevelSweepResp mergeFrom(final RegionBossLevelSweepResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasChange()) {
        getMutableChange().mergeFrom(other.change);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasRewards()) {
        getMutableRewards().addAll(other.rewards);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RegionBossLevelSweepResp)) {
        return false;
      }
      RegionBossLevelSweepResp other = (RegionBossLevelSweepResp) o;
      return bitField0_ == other.bitField0_
        && (!hasChange() || change.equals(other.change))
        && (!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(change);
      }
      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(change);
      }
      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 RegionBossLevelSweepResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 10: {
            // change
            input.readMessage(change);
            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.change, change);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.rewards, rewards);
      }
      output.endObject();
    }

    @Override
    public RegionBossLevelSweepResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2017198032: {
            if (input.isAtField(FieldNames.change)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(change);
                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 RegionBossLevelSweepResp clone() {
      return new RegionBossLevelSweepResp().copyFrom(this);
    }

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

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

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

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

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

    private enum RegionBossLevelSweepRespFactory implements MessageFactory<RegionBossLevelSweepResp> {
      INSTANCE;

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

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

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

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

  /**
   * Protobuf type {@code RegionBossLevelSweepRewards}
   */
  public static final class RegionBossLevelSweepRewards extends ProtoMessage<RegionBossLevelSweepRewards> 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 RegionBossLevelSweepRewards() {
    }

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

    /**
     * <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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards addAllAwardItems(final Public.ItemTpl... values) {
      bitField0_ |= 0x00000004;
      awardItems.addAll(values);
      return this;
    }

    @Override
    public RegionBossLevelSweepRewards copyFrom(final RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards mergeFrom(final RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      exp = 0;
      nextPackage.clear();
      awardItems.clear();
      return this;
    }

    @Override
    public RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards)) {
        return false;
      }
      RegionBossLevelSweepRewards other = (RegionBossLevelSweepRewards) 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards 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 RegionBossLevelSweepRewards clone() {
      return new RegionBossLevelSweepRewards().copyFrom(this);
    }

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

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

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

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

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

    private enum RegionBossLevelSweepRewardsFactory implements MessageFactory<RegionBossLevelSweepRewards> {
      INSTANCE;

      @Override
      public RegionBossLevelSweepRewards create() {
        return RegionBossLevelSweepRewards.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");
    }
  }
}
