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

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

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

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

    /**
     * <code>repeated uint64 BuildIds = 2;</code>
     */
    private final RepeatedLong buildIds = RepeatedLong.newEmptyInstance();

    private VampireSurvivorApplyReq() {
    }

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

    /**
     * <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 VampireSurvivorApplyReq 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 VampireSurvivorApplyReq setId(final int value) {
      bitField0_ |= 0x00000001;
      id = 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 VampireSurvivorApplyReq 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 VampireSurvivorApplyReq 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 VampireSurvivorApplyReq 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 VampireSurvivorApplyReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated uint64 BuildIds = 2;</code>
     * @return whether the buildIds field is set
     */
    public boolean hasBuildIds() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated uint64 BuildIds = 2;</code>
     * @return this
     */
    public VampireSurvivorApplyReq clearBuildIds() {
      bitField0_ &= ~0x00000004;
      buildIds.clear();
      return this;
    }

    /**
     * <code>repeated uint64 BuildIds = 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 #getMutableBuildIds()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedLong getBuildIds() {
      return buildIds;
    }

    /**
     * <code>repeated uint64 BuildIds = 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 RepeatedLong getMutableBuildIds() {
      bitField0_ |= 0x00000004;
      return buildIds;
    }

    /**
     * <code>repeated uint64 BuildIds = 2;</code>
     * @param value the buildIds to add
     * @return this
     */
    public VampireSurvivorApplyReq addBuildIds(final long value) {
      bitField0_ |= 0x00000004;
      buildIds.add(value);
      return this;
    }

    /**
     * <code>repeated uint64 BuildIds = 2;</code>
     * @param values the buildIds to add
     * @return this
     */
    public VampireSurvivorApplyReq addAllBuildIds(final long... values) {
      bitField0_ |= 0x00000004;
      buildIds.addAll(values);
      return this;
    }

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

    @Override
    public VampireSurvivorApplyReq mergeFrom(final VampireSurvivorApplyReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasBuildIds()) {
        getMutableBuildIds().addAll(other.buildIds);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof VampireSurvivorApplyReq)) {
        return false;
      }
      VampireSurvivorApplyReq other = (VampireSurvivorApplyReq) o;
      return bitField0_ == other.bitField0_
        && (!hasId() || id == other.id)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasBuildIds() || buildIds.equals(other.buildIds));
    }

    @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.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < buildIds.length(); i++) {
          output.writeRawByte((byte) 16);
          output.writeUInt64NoTag(buildIds.array()[i]);
        }
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public VampireSurvivorApplyReq 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 != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // buildIds [packed=true]
            input.readPackedUInt64(buildIds, tag);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 16: {
            // buildIds [packed=false]
            tag = input.readRepeatedUInt64(buildIds, tag);
            bitField0_ |= 0x00000004;
            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.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedUInt64(FieldNames.buildIds, buildIds);
      }
      output.endObject();
    }

    @Override
    public VampireSurvivorApplyReq 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 -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1366033014: {
            if (input.isAtField(FieldNames.buildIds)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt64(buildIds);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum VampireSurvivorApplyReqFactory implements MessageFactory<VampireSurvivorApplyReq> {
      INSTANCE;

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

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

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

      static final FieldName buildIds = FieldName.forField("BuildIds");
    }
  }

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

    /**
     * <code>optional .VampireSurvivorFateCardSelect Select = 2;</code>
     */
    private final Public.VampireSurvivorFateCardSelect select = Public.VampireSurvivorFateCardSelect.newInstance();

    /**
     * <code>optional .VampireSurvivorLevelReward Reward = 3;</code>
     */
    private final Public.VampireSurvivorLevelReward reward = Public.VampireSurvivorLevelReward.newInstance();

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

    /**
     * <code>repeated .VampireSurvivorEvent Events = 1;</code>
     */
    private final RepeatedMessage<Public.VampireSurvivorEvent> events = RepeatedMessage.newEmptyInstance(Public.VampireSurvivorEvent.getFactory());

    private VampireSurvivorApplyResp() {
    }

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

    /**
     * <code>optional .VampireSurvivorFateCardSelect Select = 2;</code>
     * @return whether the select field is set
     */
    public boolean hasSelect() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .VampireSurvivorFateCardSelect Select = 2;</code>
     * @return this
     */
    public VampireSurvivorApplyResp clearSelect() {
      bitField0_ &= ~0x00000001;
      select.clear();
      return this;
    }

    /**
     * <code>optional .VampireSurvivorFateCardSelect Select = 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 #getMutableSelect()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.VampireSurvivorFateCardSelect getSelect() {
      return select;
    }

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

    /**
     * <code>optional .VampireSurvivorFateCardSelect Select = 2;</code>
     * @param value the select to set
     * @return this
     */
    public VampireSurvivorApplyResp setSelect(final Public.VampireSurvivorFateCardSelect value) {
      bitField0_ |= 0x00000001;
      select.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .VampireSurvivorLevelReward Reward = 3;</code>
     * @return whether the reward field is set
     */
    public boolean hasReward() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .VampireSurvivorLevelReward Reward = 3;</code>
     * @return this
     */
    public VampireSurvivorApplyResp clearReward() {
      bitField0_ &= ~0x00000002;
      reward.clear();
      return this;
    }

    /**
     * <code>optional .VampireSurvivorLevelReward Reward = 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 #getMutableReward()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.VampireSurvivorLevelReward getReward() {
      return reward;
    }

    /**
     * <code>optional .VampireSurvivorLevelReward Reward = 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 Public.VampireSurvivorLevelReward getMutableReward() {
      bitField0_ |= 0x00000002;
      return reward;
    }

    /**
     * <code>optional .VampireSurvivorLevelReward Reward = 3;</code>
     * @param value the reward to set
     * @return this
     */
    public VampireSurvivorApplyResp setReward(final Public.VampireSurvivorLevelReward value) {
      bitField0_ |= 0x00000002;
      reward.copyFrom(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 VampireSurvivorApplyResp 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 VampireSurvivorApplyResp 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 VampireSurvivorApplyResp 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 VampireSurvivorApplyResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

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

    /**
     * <code>repeated .VampireSurvivorEvent Events = 1;</code>
     * @return this
     */
    public VampireSurvivorApplyResp clearEvents() {
      bitField0_ &= ~0x00000008;
      events.clear();
      return this;
    }

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

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

    /**
     * <code>repeated .VampireSurvivorEvent Events = 1;</code>
     * @param value the events to add
     * @return this
     */
    public VampireSurvivorApplyResp addEvents(final Public.VampireSurvivorEvent value) {
      bitField0_ |= 0x00000008;
      events.add(value);
      return this;
    }

    /**
     * <code>repeated .VampireSurvivorEvent Events = 1;</code>
     * @param values the events to add
     * @return this
     */
    public VampireSurvivorApplyResp addAllEvents(final Public.VampireSurvivorEvent... values) {
      bitField0_ |= 0x00000008;
      events.addAll(values);
      return this;
    }

    @Override
    public VampireSurvivorApplyResp copyFrom(final VampireSurvivorApplyResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        select.copyFrom(other.select);
        reward.copyFrom(other.reward);
        nextPackage.copyFrom(other.nextPackage);
        events.copyFrom(other.events);
      }
      return this;
    }

    @Override
    public VampireSurvivorApplyResp mergeFrom(final VampireSurvivorApplyResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasSelect()) {
        getMutableSelect().mergeFrom(other.select);
      }
      if (other.hasReward()) {
        getMutableReward().mergeFrom(other.reward);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasEvents()) {
        getMutableEvents().addAll(other.events);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof VampireSurvivorApplyResp)) {
        return false;
      }
      VampireSurvivorApplyResp other = (VampireSurvivorApplyResp) o;
      return bitField0_ == other.bitField0_
        && (!hasSelect() || select.equals(other.select))
        && (!hasReward() || reward.equals(other.reward))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasEvents() || events.equals(other.events));
    }

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

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

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

    @Override
    public VampireSurvivorApplyResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1822154468: {
            if (input.isAtField(FieldNames.select)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(select);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1850459313: {
            if (input.isAtField(FieldNames.reward)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(reward);
                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 2087505209: {
            if (input.isAtField(FieldNames.events)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(events);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum VampireSurvivorApplyRespFactory implements MessageFactory<VampireSurvivorApplyResp> {
      INSTANCE;

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

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

      static final FieldName reward = FieldName.forField("Reward");

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

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