// 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;

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

    /**
     * <code>optional int64 ResetTime = 3;</code>
     */
    private long resetTime;

    /**
     * <code>optional uint32 ActiveCount = 9;</code>
     */
    private int activeCount;

    /**
     * <code>optional uint32 ObtainCount = 10;</code>
     */
    private int obtainCount;

    /**
     * <code>optional bytes Nodes = 1;</code>
     */
    private final RepeatedByte nodes = RepeatedByte.newEmptyInstance();

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

    private VampireTalentDetailResp() {
    }

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

    /**
     * <code>optional int64 ResetTime = 3;</code>
     * @return whether the resetTime field is set
     */
    public boolean hasResetTime() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int64 ResetTime = 3;</code>
     * @return this
     */
    public VampireTalentDetailResp clearResetTime() {
      bitField0_ &= ~0x00000001;
      resetTime = 0L;
      return this;
    }

    /**
     * <code>optional int64 ResetTime = 3;</code>
     * @return the resetTime
     */
    public long getResetTime() {
      return resetTime;
    }

    /**
     * <code>optional int64 ResetTime = 3;</code>
     * @param value the resetTime to set
     * @return this
     */
    public VampireTalentDetailResp setResetTime(final long value) {
      bitField0_ |= 0x00000001;
      resetTime = value;
      return this;
    }

    /**
     * <code>optional uint32 ActiveCount = 9;</code>
     * @return whether the activeCount field is set
     */
    public boolean hasActiveCount() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 ActiveCount = 9;</code>
     * @return this
     */
    public VampireTalentDetailResp clearActiveCount() {
      bitField0_ &= ~0x00000002;
      activeCount = 0;
      return this;
    }

    /**
     * <code>optional uint32 ActiveCount = 9;</code>
     * @return the activeCount
     */
    public int getActiveCount() {
      return activeCount;
    }

    /**
     * <code>optional uint32 ActiveCount = 9;</code>
     * @param value the activeCount to set
     * @return this
     */
    public VampireTalentDetailResp setActiveCount(final int value) {
      bitField0_ |= 0x00000002;
      activeCount = value;
      return this;
    }

    /**
     * <code>optional uint32 ObtainCount = 10;</code>
     * @return whether the obtainCount field is set
     */
    public boolean hasObtainCount() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 ObtainCount = 10;</code>
     * @return this
     */
    public VampireTalentDetailResp clearObtainCount() {
      bitField0_ &= ~0x00000004;
      obtainCount = 0;
      return this;
    }

    /**
     * <code>optional uint32 ObtainCount = 10;</code>
     * @return the obtainCount
     */
    public int getObtainCount() {
      return obtainCount;
    }

    /**
     * <code>optional uint32 ObtainCount = 10;</code>
     * @param value the obtainCount to set
     * @return this
     */
    public VampireTalentDetailResp setObtainCount(final int value) {
      bitField0_ |= 0x00000004;
      obtainCount = value;
      return this;
    }

    /**
     * <code>optional bytes Nodes = 1;</code>
     * @return whether the nodes field is set
     */
    public boolean hasNodes() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bytes Nodes = 1;</code>
     * @return this
     */
    public VampireTalentDetailResp clearNodes() {
      bitField0_ &= ~0x00000008;
      nodes.clear();
      return this;
    }

    /**
     * <code>optional bytes Nodes = 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 #getMutableNodes()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNodes() {
      return nodes;
    }

    /**
     * <code>optional bytes Nodes = 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 RepeatedByte getMutableNodes() {
      bitField0_ |= 0x00000008;
      return nodes;
    }

    /**
     * <code>optional bytes Nodes = 1;</code>
     * @param value the nodes to add
     * @return this
     */
    public VampireTalentDetailResp addNodes(final byte value) {
      bitField0_ |= 0x00000008;
      nodes.add(value);
      return this;
    }

    /**
     * <code>optional bytes Nodes = 1;</code>
     * @param values the nodes to add
     * @return this
     */
    public VampireTalentDetailResp addAllNodes(final byte... values) {
      bitField0_ |= 0x00000008;
      nodes.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes Nodes = 1;</code>
     * @param values the nodes to set
     * @return this
     */
    public VampireTalentDetailResp setNodes(final byte... values) {
      bitField0_ |= 0x00000008;
      nodes.copyFrom(values);
      return this;
    }

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

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public VampireTalentDetailResp clearNextPackage() {
      bitField0_ &= ~0x00000010;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000010;
      return nextPackage;
    }

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

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

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

    @Override
    public VampireTalentDetailResp copyFrom(final VampireTalentDetailResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        resetTime = other.resetTime;
        activeCount = other.activeCount;
        obtainCount = other.obtainCount;
        nodes.copyFrom(other.nodes);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public VampireTalentDetailResp mergeFrom(final VampireTalentDetailResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasResetTime()) {
        setResetTime(other.resetTime);
      }
      if (other.hasActiveCount()) {
        setActiveCount(other.activeCount);
      }
      if (other.hasObtainCount()) {
        setObtainCount(other.obtainCount);
      }
      if (other.hasNodes()) {
        getMutableNodes().copyFrom(other.nodes);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public VampireTalentDetailResp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      resetTime = 0L;
      activeCount = 0;
      obtainCount = 0;
      nodes.clear();
      nextPackage.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof VampireTalentDetailResp)) {
        return false;
      }
      VampireTalentDetailResp other = (VampireTalentDetailResp) o;
      return bitField0_ == other.bitField0_
        && (!hasResetTime() || resetTime == other.resetTime)
        && (!hasActiveCount() || activeCount == other.activeCount)
        && (!hasObtainCount() || obtainCount == other.obtainCount)
        && (!hasNodes() || nodes.equals(other.nodes))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeInt64NoTag(resetTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 72);
        output.writeUInt32NoTag(activeCount);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 80);
        output.writeUInt32NoTag(obtainCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 10);
        output.writeBytesNoTag(nodes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt64SizeNoTag(resetTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(activeCount);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(obtainCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeBytesSizeNoTag(nodes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public VampireTalentDetailResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // resetTime
            resetTime = input.readInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 72) {
              break;
            }
          }
          case 72: {
            // activeCount
            activeCount = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 80) {
              break;
            }
          }
          case 80: {
            // obtainCount
            obtainCount = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // nodes
            input.readBytes(nodes);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeInt64(FieldNames.resetTime, resetTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.activeCount, activeCount);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.obtainCount, obtainCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBytes(FieldNames.nodes, nodes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public VampireTalentDetailResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -267205476: {
            if (input.isAtField(FieldNames.resetTime)) {
              if (!input.trySkipNullValue()) {
                resetTime = input.readInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 590544265: {
            if (input.isAtField(FieldNames.activeCount)) {
              if (!input.trySkipNullValue()) {
                activeCount = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1946978122: {
            if (input.isAtField(FieldNames.obtainCount)) {
              if (!input.trySkipNullValue()) {
                obtainCount = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 75440785: {
            if (input.isAtField(FieldNames.nodes)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nodes);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum VampireTalentDetailRespFactory implements MessageFactory<VampireTalentDetailResp> {
      INSTANCE;

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

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

      static final FieldName activeCount = FieldName.forField("ActiveCount");

      static final FieldName obtainCount = FieldName.forField("ObtainCount");

      static final FieldName nodes = FieldName.forField("Nodes");

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