// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.proto;

import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedByte;
import us.hebi.quickbuf.RepeatedInt;
import us.hebi.quickbuf.RepeatedMessage;

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

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

    /**
     * <code>repeated .AgentApplyInfo Apply = 1;</code>
     */
    private final RepeatedMessage<AgentApplyInfo> apply = RepeatedMessage.newEmptyInstance(AgentApplyInfo.getFactory());

    private AgentApplyReq() {
    }

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

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

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

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

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

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

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

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

    /**
     * <code>repeated .AgentApplyInfo Apply = 1;</code>
     * @return whether the apply field is set
     */
    public boolean hasApply() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>repeated .AgentApplyInfo Apply = 1;</code>
     * @return this
     */
    public AgentApplyReq clearApply() {
      bitField0_ &= ~0x00000002;
      apply.clear();
      return this;
    }

    /**
     * <code>repeated .AgentApplyInfo Apply = 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 #getMutableApply()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<AgentApplyInfo> getApply() {
      return apply;
    }

    /**
     * <code>repeated .AgentApplyInfo Apply = 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<AgentApplyInfo> getMutableApply() {
      bitField0_ |= 0x00000002;
      return apply;
    }

    /**
     * <code>repeated .AgentApplyInfo Apply = 1;</code>
     * @param value the apply to add
     * @return this
     */
    public AgentApplyReq addApply(final AgentApplyInfo value) {
      bitField0_ |= 0x00000002;
      apply.add(value);
      return this;
    }

    /**
     * <code>repeated .AgentApplyInfo Apply = 1;</code>
     * @param values the apply to add
     * @return this
     */
    public AgentApplyReq addAllApply(final AgentApplyInfo... values) {
      bitField0_ |= 0x00000002;
      apply.addAll(values);
      return this;
    }

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

    @Override
    public AgentApplyReq mergeFrom(final AgentApplyReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasApply()) {
        getMutableApply().addAll(other.apply);
      }
      return this;
    }

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

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

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

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

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

    @Override
    @SuppressWarnings("fallthrough")
    public AgentApplyReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // apply
            tag = input.readRepeatedMessage(apply, tag);
            bitField0_ |= 0x00000002;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRepeatedMessage(FieldNames.apply, apply);
      }
      output.endObject();
    }

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

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

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

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

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

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

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

    private enum AgentApplyReqFactory implements MessageFactory<AgentApplyReq> {
      INSTANCE;

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

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

      static final FieldName apply = FieldName.forField("Apply");
    }
  }

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

    /**
     * <code>optional uint64 BuildId = 4;</code>
     */
    private long buildId;

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

    /**
     * <code>optional uint32 ProcessTime = 2;</code>
     */
    private int processTime;

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

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

    private AgentApplyInfo() {
    }

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

    /**
     * <code>optional uint64 BuildId = 4;</code>
     * @return whether the buildId field is set
     */
    public boolean hasBuildId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint64 BuildId = 4;</code>
     * @return this
     */
    public AgentApplyInfo clearBuildId() {
      bitField0_ &= ~0x00000001;
      buildId = 0L;
      return this;
    }

    /**
     * <code>optional uint64 BuildId = 4;</code>
     * @return the buildId
     */
    public long getBuildId() {
      return buildId;
    }

    /**
     * <code>optional uint64 BuildId = 4;</code>
     * @param value the buildId to set
     * @return this
     */
    public AgentApplyInfo setBuildId(final long value) {
      bitField0_ |= 0x00000001;
      buildId = value;
      return this;
    }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public AgentApplyInfo clearId() {
      bitField0_ &= ~0x00000002;
      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 AgentApplyInfo setId(final int value) {
      bitField0_ |= 0x00000002;
      id = value;
      return this;
    }

    /**
     * <code>optional uint32 ProcessTime = 2;</code>
     * @return whether the processTime field is set
     */
    public boolean hasProcessTime() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 ProcessTime = 2;</code>
     * @return this
     */
    public AgentApplyInfo clearProcessTime() {
      bitField0_ &= ~0x00000004;
      processTime = 0;
      return this;
    }

    /**
     * <code>optional uint32 ProcessTime = 2;</code>
     * @return the processTime
     */
    public int getProcessTime() {
      return processTime;
    }

    /**
     * <code>optional uint32 ProcessTime = 2;</code>
     * @param value the processTime to set
     * @return this
     */
    public AgentApplyInfo setProcessTime(final int value) {
      bitField0_ |= 0x00000004;
      processTime = value;
      return this;
    }

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

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

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

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

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

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

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

    /**
     * <code>repeated uint32 CharIds = 3;</code>
     * @return whether the charIds field is set
     */
    public boolean hasCharIds() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>repeated uint32 CharIds = 3;</code>
     * @return this
     */
    public AgentApplyInfo clearCharIds() {
      bitField0_ &= ~0x00000010;
      charIds.clear();
      return this;
    }

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

    /**
     * <code>repeated uint32 CharIds = 3;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedInt getMutableCharIds() {
      bitField0_ |= 0x00000010;
      return charIds;
    }

    /**
     * <code>repeated uint32 CharIds = 3;</code>
     * @param value the charIds to add
     * @return this
     */
    public AgentApplyInfo addCharIds(final int value) {
      bitField0_ |= 0x00000010;
      charIds.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 CharIds = 3;</code>
     * @param values the charIds to add
     * @return this
     */
    public AgentApplyInfo addAllCharIds(final int... values) {
      bitField0_ |= 0x00000010;
      charIds.addAll(values);
      return this;
    }

    @Override
    public AgentApplyInfo copyFrom(final AgentApplyInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        buildId = other.buildId;
        id = other.id;
        processTime = other.processTime;
        nextPackage.copyFrom(other.nextPackage);
        charIds.copyFrom(other.charIds);
      }
      return this;
    }

    @Override
    public AgentApplyInfo mergeFrom(final AgentApplyInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasBuildId()) {
        setBuildId(other.buildId);
      }
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasProcessTime()) {
        setProcessTime(other.processTime);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasCharIds()) {
        getMutableCharIds().addAll(other.charIds);
      }
      return this;
    }

    @Override
    public AgentApplyInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      buildId = 0L;
      id = 0;
      processTime = 0;
      nextPackage.clear();
      charIds.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof AgentApplyInfo)) {
        return false;
      }
      AgentApplyInfo other = (AgentApplyInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasBuildId() || buildId == other.buildId)
        && (!hasId() || id == other.id)
        && (!hasProcessTime() || processTime == other.processTime)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasCharIds() || charIds.equals(other.charIds));
    }

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

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt64SizeNoTag(buildId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(processTime);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += (1 * charIds.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(charIds);
      }
      return size;
    }

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

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt64(FieldNames.buildId, buildId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.id, id);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.processTime, processTime);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRepeatedUInt32(FieldNames.charIds, charIds);
      }
      output.endObject();
    }

    @Override
    public AgentApplyInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1895597065: {
            if (input.isAtField(FieldNames.buildId)) {
              if (!input.trySkipNullValue()) {
                buildId = input.readUInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1870380476: {
            if (input.isAtField(FieldNames.processTime)) {
              if (!input.trySkipNullValue()) {
                processTime = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1891280030: {
            if (input.isAtField(FieldNames.charIds)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(charIds);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum AgentApplyInfoFactory implements MessageFactory<AgentApplyInfo> {
      INSTANCE;

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

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

      static final FieldName id = FieldName.forField("Id");

      static final FieldName processTime = FieldName.forField("ProcessTime");

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

      static final FieldName charIds = FieldName.forField("CharIds");
    }
  }

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

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

    /**
     * <code>repeated .AgentRespInfo Infos = 1;</code>
     */
    private final RepeatedMessage<AgentRespInfo> infos = RepeatedMessage.newEmptyInstance(AgentRespInfo.getFactory());

    private AgentApplyResp() {
    }

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

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

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

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

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

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

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

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

    /**
     * <code>repeated .AgentRespInfo Infos = 1;</code>
     * @return whether the infos field is set
     */
    public boolean hasInfos() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>repeated .AgentRespInfo Infos = 1;</code>
     * @return this
     */
    public AgentApplyResp clearInfos() {
      bitField0_ &= ~0x00000002;
      infos.clear();
      return this;
    }

    /**
     * <code>repeated .AgentRespInfo Infos = 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 #getMutableInfos()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<AgentRespInfo> getInfos() {
      return infos;
    }

    /**
     * <code>repeated .AgentRespInfo Infos = 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<AgentRespInfo> getMutableInfos() {
      bitField0_ |= 0x00000002;
      return infos;
    }

    /**
     * <code>repeated .AgentRespInfo Infos = 1;</code>
     * @param value the infos to add
     * @return this
     */
    public AgentApplyResp addInfos(final AgentRespInfo value) {
      bitField0_ |= 0x00000002;
      infos.add(value);
      return this;
    }

    /**
     * <code>repeated .AgentRespInfo Infos = 1;</code>
     * @param values the infos to add
     * @return this
     */
    public AgentApplyResp addAllInfos(final AgentRespInfo... values) {
      bitField0_ |= 0x00000002;
      infos.addAll(values);
      return this;
    }

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

    @Override
    public AgentApplyResp mergeFrom(final AgentApplyResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasInfos()) {
        getMutableInfos().addAll(other.infos);
      }
      return this;
    }

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

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

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

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

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

    @Override
    @SuppressWarnings("fallthrough")
    public AgentApplyResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // infos
            tag = input.readRepeatedMessage(infos, tag);
            bitField0_ |= 0x00000002;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRepeatedMessage(FieldNames.infos, infos);
      }
      output.endObject();
    }

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

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

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

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

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

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

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

    private enum AgentApplyRespFactory implements MessageFactory<AgentApplyResp> {
      INSTANCE;

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

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

      static final FieldName infos = FieldName.forField("Infos");
    }
  }

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

    /**
     * <code>optional int64 BeginTime = 2;</code>
     */
    private long beginTime;

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

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

    private AgentRespInfo() {
    }

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

    /**
     * <code>optional int64 BeginTime = 2;</code>
     * @return whether the beginTime field is set
     */
    public boolean hasBeginTime() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int64 BeginTime = 2;</code>
     * @return this
     */
    public AgentRespInfo clearBeginTime() {
      bitField0_ &= ~0x00000001;
      beginTime = 0L;
      return this;
    }

    /**
     * <code>optional int64 BeginTime = 2;</code>
     * @return the beginTime
     */
    public long getBeginTime() {
      return beginTime;
    }

    /**
     * <code>optional int64 BeginTime = 2;</code>
     * @param value the beginTime to set
     * @return this
     */
    public AgentRespInfo setBeginTime(final long value) {
      bitField0_ |= 0x00000001;
      beginTime = value;
      return this;
    }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public AgentRespInfo clearId() {
      bitField0_ &= ~0x00000002;
      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 AgentRespInfo setId(final int value) {
      bitField0_ |= 0x00000002;
      id = 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 AgentRespInfo 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 AgentRespInfo 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 AgentRespInfo 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 AgentRespInfo setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

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

    @Override
    public AgentRespInfo mergeFrom(final AgentRespInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasBeginTime()) {
        setBeginTime(other.beginTime);
      }
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

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

    @Override
    public AgentRespInfo 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 AgentRespInfo)) {
        return false;
      }
      AgentRespInfo other = (AgentRespInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasBeginTime() || beginTime == other.beginTime)
        && (!hasId() || id == other.id)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeInt64NoTag(beginTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      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.computeInt64SizeNoTag(beginTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

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

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

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

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

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

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

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

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

    private enum AgentRespInfoFactory implements MessageFactory<AgentRespInfo> {
      INSTANCE;

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

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

      static final FieldName id = FieldName.forField("Id");

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