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

    /**
     * <code>optional uint32 Index = 1;</code>
     */
    private int index;

    /**
     * <code>optional bool ReRoll = 2;</code>
     */
    private boolean reRoll;

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

    private VampireSurvivorRewardSelectReq() {
    }

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

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

    /**
     * <code>optional uint32 Index = 1;</code>
     * @return this
     */
    public VampireSurvivorRewardSelectReq clearIndex() {
      bitField0_ &= ~0x00000001;
      index = 0;
      return this;
    }

    /**
     * <code>optional uint32 Index = 1;</code>
     * @return the index
     */
    public int getIndex() {
      return index;
    }

    /**
     * <code>optional uint32 Index = 1;</code>
     * @param value the index to set
     * @return this
     */
    public VampireSurvivorRewardSelectReq setIndex(final int value) {
      bitField0_ |= 0x00000001;
      index = value;
      return this;
    }

    /**
     * <code>optional bool ReRoll = 2;</code>
     * @return whether the reRoll field is set
     */
    public boolean hasReRoll() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bool ReRoll = 2;</code>
     * @return this
     */
    public VampireSurvivorRewardSelectReq clearReRoll() {
      bitField0_ &= ~0x00000002;
      reRoll = false;
      return this;
    }

    /**
     * <code>optional bool ReRoll = 2;</code>
     * @return the reRoll
     */
    public boolean getReRoll() {
      return reRoll;
    }

    /**
     * <code>optional bool ReRoll = 2;</code>
     * @param value the reRoll to set
     * @return this
     */
    public VampireSurvivorRewardSelectReq setReRoll(final boolean value) {
      bitField0_ |= 0x00000002;
      reRoll = 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 VampireSurvivorRewardSelectReq 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 VampireSurvivorRewardSelectReq 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 VampireSurvivorRewardSelectReq 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 VampireSurvivorRewardSelectReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

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

    @Override
    public VampireSurvivorRewardSelectReq mergeFrom(final VampireSurvivorRewardSelectReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasIndex()) {
        setIndex(other.index);
      }
      if (other.hasReRoll()) {
        setReRoll(other.reRoll);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public VampireSurvivorRewardSelectReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      index = 0;
      reRoll = false;
      nextPackage.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof VampireSurvivorRewardSelectReq)) {
        return false;
      }
      VampireSurvivorRewardSelectReq other = (VampireSurvivorRewardSelectReq) o;
      return bitField0_ == other.bitField0_
        && (!hasIndex() || index == other.index)
        && (!hasReRoll() || reRoll == other.reRoll)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(index);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeBoolNoTag(reRoll);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

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

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

    @Override
    public VampireSurvivorRewardSelectReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 70793394: {
            if (input.isAtField(FieldNames.index)) {
              if (!input.trySkipNullValue()) {
                index = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1851548304: {
            if (input.isAtField(FieldNames.reRoll)) {
              if (!input.trySkipNullValue()) {
                reRoll = input.readBool();
                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;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum VampireSurvivorRewardSelectReqFactory implements MessageFactory<VampireSurvivorRewardSelectReq> {
      INSTANCE;

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

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

      static final FieldName reRoll = FieldName.forField("ReRoll");

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

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

    /**
     * <code>optional .VampireSurvivorRewardSelectResp.Success Resp = 1;</code>
     */
    private final Success resp = Success.newInstance();

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

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

    private VampireSurvivorRewardSelectResp() {
    }

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

    /**
     * <code>optional .VampireSurvivorRewardSelectResp.Success Resp = 1;</code>
     * @return whether the resp field is set
     */
    public boolean hasResp() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .VampireSurvivorRewardSelectResp.Success Resp = 1;</code>
     * @return this
     */
    public VampireSurvivorRewardSelectResp clearResp() {
      bitField0_ &= ~0x00000001;
      resp.clear();
      return this;
    }

    /**
     * <code>optional .VampireSurvivorRewardSelectResp.Success Resp = 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 #getMutableResp()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Success getResp() {
      return resp;
    }

    /**
     * <code>optional .VampireSurvivorRewardSelectResp.Success Resp = 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 Success getMutableResp() {
      bitField0_ |= 0x00000001;
      return resp;
    }

    /**
     * <code>optional .VampireSurvivorRewardSelectResp.Success Resp = 1;</code>
     * @param value the resp to set
     * @return this
     */
    public VampireSurvivorRewardSelectResp setResp(final Success value) {
      bitField0_ |= 0x00000001;
      resp.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .VampireSurvivorFateCardSelect Pkg = 2;</code>
     * @return whether the pkg field is set
     */
    public boolean hasPkg() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .VampireSurvivorFateCardSelect Pkg = 2;</code>
     * @return this
     */
    public VampireSurvivorRewardSelectResp clearPkg() {
      bitField0_ &= ~0x00000002;
      pkg.clear();
      return this;
    }

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

    /**
     * <code>optional .VampireSurvivorFateCardSelect Pkg = 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 getMutablePkg() {
      bitField0_ |= 0x00000002;
      return pkg;
    }

    /**
     * <code>optional .VampireSurvivorFateCardSelect Pkg = 2;</code>
     * @param value the pkg to set
     * @return this
     */
    public VampireSurvivorRewardSelectResp setPkg(
        final Public.VampireSurvivorFateCardSelect value) {
      bitField0_ |= 0x00000002;
      pkg.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 VampireSurvivorRewardSelectResp 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 VampireSurvivorRewardSelectResp 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 VampireSurvivorRewardSelectResp 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 VampireSurvivorRewardSelectResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

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

    @Override
    public VampireSurvivorRewardSelectResp mergeFrom(final VampireSurvivorRewardSelectResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasResp()) {
        getMutableResp().mergeFrom(other.resp);
      }
      if (other.hasPkg()) {
        getMutablePkg().mergeFrom(other.pkg);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof VampireSurvivorRewardSelectResp)) {
        return false;
      }
      VampireSurvivorRewardSelectResp other = (VampireSurvivorRewardSelectResp) o;
      return bitField0_ == other.bitField0_
        && (!hasResp() || resp.equals(other.resp))
        && (!hasPkg() || pkg.equals(other.pkg))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 10);
        output.writeMessageNoTag(resp);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 18);
        output.writeMessageNoTag(pkg);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

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

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

    @Override
    public VampireSurvivorRewardSelectResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2543600: {
            if (input.isAtField(FieldNames.resp)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(resp);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 80300: {
            if (input.isAtField(FieldNames.pkg)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(pkg);
                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;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

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

      /**
       * <code>optional uint32 FateCardId = 1;</code>
       */
      private int fateCardId;

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

      /**
       * <code>repeated .CardInfo ExtraCards = 3;</code>
       */
      private final RepeatedMessage<Public.CardInfo> extraCards = RepeatedMessage.newEmptyInstance(Public.CardInfo.getFactory());

      private Success() {
      }

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

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

      /**
       * <code>optional uint32 FateCardId = 1;</code>
       * @return this
       */
      public Success clearFateCardId() {
        bitField0_ &= ~0x00000001;
        fateCardId = 0;
        return this;
      }

      /**
       * <code>optional uint32 FateCardId = 1;</code>
       * @return the fateCardId
       */
      public int getFateCardId() {
        return fateCardId;
      }

      /**
       * <code>optional uint32 FateCardId = 1;</code>
       * @param value the fateCardId to set
       * @return this
       */
      public Success setFateCardId(final int value) {
        bitField0_ |= 0x00000001;
        fateCardId = value;
        return this;
      }

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

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

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

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

      /**
       * <code>optional .VampireSurvivorLevelReward Reward = 2;</code>
       * @param value the reward to set
       * @return this
       */
      public Success setReward(final Public.VampireSurvivorLevelReward value) {
        bitField0_ |= 0x00000002;
        reward.copyFrom(value);
        return this;
      }

      /**
       * <code>repeated .CardInfo ExtraCards = 3;</code>
       * @return whether the extraCards field is set
       */
      public boolean hasExtraCards() {
        return (bitField0_ & 0x00000004) != 0;
      }

      /**
       * <code>repeated .CardInfo ExtraCards = 3;</code>
       * @return this
       */
      public Success clearExtraCards() {
        bitField0_ &= ~0x00000004;
        extraCards.clear();
        return this;
      }

      /**
       * <code>repeated .CardInfo ExtraCards = 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 #getMutableExtraCards()} if you want to modify it.
       *
       * @return internal storage object for reading
       */
      public RepeatedMessage<Public.CardInfo> getExtraCards() {
        return extraCards;
      }

      /**
       * <code>repeated .CardInfo ExtraCards = 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 RepeatedMessage<Public.CardInfo> getMutableExtraCards() {
        bitField0_ |= 0x00000004;
        return extraCards;
      }

      /**
       * <code>repeated .CardInfo ExtraCards = 3;</code>
       * @param value the extraCards to add
       * @return this
       */
      public Success addExtraCards(final Public.CardInfo value) {
        bitField0_ |= 0x00000004;
        extraCards.add(value);
        return this;
      }

      /**
       * <code>repeated .CardInfo ExtraCards = 3;</code>
       * @param values the extraCards to add
       * @return this
       */
      public Success addAllExtraCards(final Public.CardInfo... values) {
        bitField0_ |= 0x00000004;
        extraCards.addAll(values);
        return this;
      }

      @Override
      public Success copyFrom(final Success other) {
        cachedSize = other.cachedSize;
        if ((bitField0_ | other.bitField0_) != 0) {
          bitField0_ = other.bitField0_;
          fateCardId = other.fateCardId;
          reward.copyFrom(other.reward);
          extraCards.copyFrom(other.extraCards);
        }
        return this;
      }

      @Override
      public Success mergeFrom(final Success other) {
        if (other.isEmpty()) {
          return this;
        }
        cachedSize = -1;
        if (other.hasFateCardId()) {
          setFateCardId(other.fateCardId);
        }
        if (other.hasReward()) {
          getMutableReward().mergeFrom(other.reward);
        }
        if (other.hasExtraCards()) {
          getMutableExtraCards().addAll(other.extraCards);
        }
        return this;
      }

      @Override
      public Success clear() {
        if (isEmpty()) {
          return this;
        }
        cachedSize = -1;
        bitField0_ = 0;
        fateCardId = 0;
        reward.clear();
        extraCards.clear();
        return this;
      }

      @Override
      public Success clearQuick() {
        if (isEmpty()) {
          return this;
        }
        cachedSize = -1;
        bitField0_ = 0;
        reward.clearQuick();
        extraCards.clearQuick();
        return this;
      }

      @Override
      public boolean equals(Object o) {
        if (o == this) {
          return true;
        }
        if (!(o instanceof Success)) {
          return false;
        }
        Success other = (Success) o;
        return bitField0_ == other.bitField0_
          && (!hasFateCardId() || fateCardId == other.fateCardId)
          && (!hasReward() || reward.equals(other.reward))
          && (!hasExtraCards() || extraCards.equals(other.extraCards));
      }

      @Override
      public void writeTo(final ProtoSink output) throws IOException {
        if ((bitField0_ & 0x00000001) != 0) {
          output.writeRawByte((byte) 8);
          output.writeUInt32NoTag(fateCardId);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(reward);
        }
        if ((bitField0_ & 0x00000004) != 0) {
          for (int i = 0; i < extraCards.length(); i++) {
            output.writeRawByte((byte) 26);
            output.writeMessageNoTag(extraCards.get(i));
          }
        }
      }

      @Override
      protected int computeSerializedSize() {
        int size = 0;
        if ((bitField0_ & 0x00000001) != 0) {
          size += 1 + ProtoSink.computeUInt32SizeNoTag(fateCardId);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          size += 1 + ProtoSink.computeMessageSizeNoTag(reward);
        }
        if ((bitField0_ & 0x00000004) != 0) {
          size += (1 * extraCards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(extraCards);
        }
        return size;
      }

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

      @Override
      public Success mergeFrom(final JsonSource input) throws IOException {
        if (!input.beginObject()) {
          return this;
        }
        while (!input.isAtEnd()) {
          switch (input.readFieldHash()) {
            case 1656856567: {
              if (input.isAtField(FieldNames.fateCardId)) {
                if (!input.trySkipNullValue()) {
                  fateCardId = input.readUInt32();
                  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 -1580054189: {
              if (input.isAtField(FieldNames.extraCards)) {
                if (!input.trySkipNullValue()) {
                  input.readRepeatedMessage(extraCards);
                  bitField0_ |= 0x00000004;
                }
              } else {
                input.skipUnknownField();
              }
              break;
            }
            default: {
              input.skipUnknownField();
              break;
            }
          }
        }
        input.endObject();
        return this;
      }

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

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

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

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

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

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

      private enum SuccessFactory implements MessageFactory<Success> {
        INSTANCE;

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

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

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

        static final FieldName extraCards = FieldName.forField("ExtraCards");
      }
    }

    private enum VampireSurvivorRewardSelectRespFactory implements MessageFactory<VampireSurvivorRewardSelectResp> {
      INSTANCE;

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

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

      static final FieldName pkg = FieldName.forField("Pkg");

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