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

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

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

    /**
     * <code>repeated .StorySetChapter Chapters = 1;</code>
     */
    private final RepeatedMessage<StorySetChapter> chapters = RepeatedMessage.newEmptyInstance(StorySetChapter.getFactory());

    private StorySetInfoResp() {
    }

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

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

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

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

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

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

    /**
     * <code>repeated .StorySetChapter Chapters = 1;</code>
     * @return whether the chapters field is set
     */
    public boolean hasChapters() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>repeated .StorySetChapter Chapters = 1;</code>
     * @return this
     */
    public StorySetInfoResp clearChapters() {
      bitField0_ &= ~0x00000002;
      chapters.clear();
      return this;
    }

    /**
     * <code>repeated .StorySetChapter Chapters = 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 #getMutableChapters()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<StorySetChapter> getChapters() {
      return chapters;
    }

    /**
     * <code>repeated .StorySetChapter Chapters = 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<StorySetChapter> getMutableChapters() {
      bitField0_ |= 0x00000002;
      return chapters;
    }

    /**
     * <code>repeated .StorySetChapter Chapters = 1;</code>
     * @param value the chapters to add
     * @return this
     */
    public StorySetInfoResp addChapters(final StorySetChapter value) {
      bitField0_ |= 0x00000002;
      chapters.add(value);
      return this;
    }

    /**
     * <code>repeated .StorySetChapter Chapters = 1;</code>
     * @param values the chapters to add
     * @return this
     */
    public StorySetInfoResp addAllChapters(final StorySetChapter... values) {
      bitField0_ |= 0x00000002;
      chapters.addAll(values);
      return this;
    }

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

    @Override
    public StorySetInfoResp mergeFrom(final StorySetInfoResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasChapters()) {
        getMutableChapters().addAll(other.chapters);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof StorySetInfoResp)) {
        return false;
      }
      StorySetInfoResp other = (StorySetInfoResp) o;
      return bitField0_ == other.bitField0_
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasChapters() || chapters.equals(other.chapters));
    }

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

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

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

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

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

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

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

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

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

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

    private enum StorySetInfoRespFactory implements MessageFactory<StorySetInfoResp> {
      INSTANCE;

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

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

      static final FieldName chapters = FieldName.forField("Chapters");
    }
  }

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

    /**
     * <code>optional uint32 ChapterId = 1;</code>
     */
    private int chapterId;

    /**
     * <code>optional uint32 SectionIndex = 2;</code>
     */
    private int sectionIndex;

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

    /**
     * <code>repeated uint32 RewardedIds = 3;</code>
     */
    private final RepeatedInt rewardedIds = RepeatedInt.newEmptyInstance();

    private StorySetChapter() {
    }

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

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

    /**
     * <code>optional uint32 ChapterId = 1;</code>
     * @return this
     */
    public StorySetChapter clearChapterId() {
      bitField0_ &= ~0x00000001;
      chapterId = 0;
      return this;
    }

    /**
     * <code>optional uint32 ChapterId = 1;</code>
     * @return the chapterId
     */
    public int getChapterId() {
      return chapterId;
    }

    /**
     * <code>optional uint32 ChapterId = 1;</code>
     * @param value the chapterId to set
     * @return this
     */
    public StorySetChapter setChapterId(final int value) {
      bitField0_ |= 0x00000001;
      chapterId = value;
      return this;
    }

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

    /**
     * <code>optional uint32 SectionIndex = 2;</code>
     * @return this
     */
    public StorySetChapter clearSectionIndex() {
      bitField0_ &= ~0x00000002;
      sectionIndex = 0;
      return this;
    }

    /**
     * <code>optional uint32 SectionIndex = 2;</code>
     * @return the sectionIndex
     */
    public int getSectionIndex() {
      return sectionIndex;
    }

    /**
     * <code>optional uint32 SectionIndex = 2;</code>
     * @param value the sectionIndex to set
     * @return this
     */
    public StorySetChapter setSectionIndex(final int value) {
      bitField0_ |= 0x00000002;
      sectionIndex = value;
      return this;
    }

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

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

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

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

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

    /**
     * <code>repeated uint32 RewardedIds = 3;</code>
     * @return whether the rewardedIds field is set
     */
    public boolean hasRewardedIds() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated uint32 RewardedIds = 3;</code>
     * @return this
     */
    public StorySetChapter clearRewardedIds() {
      bitField0_ &= ~0x00000008;
      rewardedIds.clear();
      return this;
    }

    /**
     * <code>repeated uint32 RewardedIds = 3;</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 #getMutableRewardedIds()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getRewardedIds() {
      return rewardedIds;
    }

    /**
     * <code>repeated uint32 RewardedIds = 3;</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 RepeatedInt getMutableRewardedIds() {
      bitField0_ |= 0x00000008;
      return rewardedIds;
    }

    /**
     * <code>repeated uint32 RewardedIds = 3;</code>
     * @param value the rewardedIds to add
     * @return this
     */
    public StorySetChapter addRewardedIds(final int value) {
      bitField0_ |= 0x00000008;
      rewardedIds.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 RewardedIds = 3;</code>
     * @param values the rewardedIds to add
     * @return this
     */
    public StorySetChapter addAllRewardedIds(final int... values) {
      bitField0_ |= 0x00000008;
      rewardedIds.addAll(values);
      return this;
    }

    @Override
    public StorySetChapter copyFrom(final StorySetChapter other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        chapterId = other.chapterId;
        sectionIndex = other.sectionIndex;
        nextPackage.copyFrom(other.nextPackage);
        rewardedIds.copyFrom(other.rewardedIds);
      }
      return this;
    }

    @Override
    public StorySetChapter mergeFrom(final StorySetChapter other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasChapterId()) {
        setChapterId(other.chapterId);
      }
      if (other.hasSectionIndex()) {
        setSectionIndex(other.sectionIndex);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasRewardedIds()) {
        getMutableRewardedIds().addAll(other.rewardedIds);
      }
      return this;
    }

    @Override
    public StorySetChapter clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      chapterId = 0;
      sectionIndex = 0;
      nextPackage.clear();
      rewardedIds.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof StorySetChapter)) {
        return false;
      }
      StorySetChapter other = (StorySetChapter) o;
      return bitField0_ == other.bitField0_
        && (!hasChapterId() || chapterId == other.chapterId)
        && (!hasSectionIndex() || sectionIndex == other.sectionIndex)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasRewardedIds() || rewardedIds.equals(other.rewardedIds));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(chapterId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(sectionIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < rewardedIds.length(); i++) {
          output.writeRawByte((byte) 24);
          output.writeUInt32NoTag(rewardedIds.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(chapterId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(sectionIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += (1 * rewardedIds.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(rewardedIds);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public StorySetChapter mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // chapterId
            chapterId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // sectionIndex
            sectionIndex = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // rewardedIds [packed=true]
            input.readPackedUInt32(rewardedIds, tag);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 24: {
            // rewardedIds [packed=false]
            tag = input.readRepeatedUInt32(rewardedIds, tag);
            bitField0_ |= 0x00000008;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.chapterId, chapterId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.sectionIndex, sectionIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedUInt32(FieldNames.rewardedIds, rewardedIds);
      }
      output.endObject();
    }

    @Override
    public StorySetChapter mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -766458328: {
            if (input.isAtField(FieldNames.chapterId)) {
              if (!input.trySkipNullValue()) {
                chapterId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 794334477: {
            if (input.isAtField(FieldNames.sectionIndex)) {
              if (!input.trySkipNullValue()) {
                sectionIndex = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1723508822: {
            if (input.isAtField(FieldNames.rewardedIds)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(rewardedIds);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum StorySetChapterFactory implements MessageFactory<StorySetChapter> {
      INSTANCE;

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

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

      static final FieldName sectionIndex = FieldName.forField("SectionIndex");

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

      static final FieldName rewardedIds = FieldName.forField("RewardedIds");
    }
  }
}
