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

    /**
     * <code>optional uint64 Id = 1;</code>
     */
    private long id;

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

    private FriendUIdSearchReq() {
    }

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

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

    /**
     * <code>optional uint64 Id = 1;</code>
     * @return this
     */
    public FriendUIdSearchReq clearId() {
      bitField0_ &= ~0x00000001;
      id = 0L;
      return this;
    }

    /**
     * <code>optional uint64 Id = 1;</code>
     * @return the id
     */
    public long getId() {
      return id;
    }

    /**
     * <code>optional uint64 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public FriendUIdSearchReq setId(final long value) {
      bitField0_ |= 0x00000001;
      id = value;
      return this;
    }

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

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

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

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

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

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

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

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

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

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

    @Override
    public FriendUIdSearchReq 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 FriendUIdSearchReq)) {
        return false;
      }
      FriendUIdSearchReq other = (FriendUIdSearchReq) o;
      return bitField0_ == other.bitField0_
        && (!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) 8);
        output.writeUInt64NoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

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

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

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

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

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

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

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

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

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

    private enum FriendUIdSearchReqFactory implements MessageFactory<FriendUIdSearchReq> {
      INSTANCE;

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

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

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

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

    /**
     * <code>optional .Friend Friend = 1;</code>
     */
    private final Public.Friend friend = Public.Friend.newInstance();

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

    private FriendUIdSearchResp() {
    }

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

    /**
     * <code>optional .Friend Friend = 1;</code>
     * @return whether the friend field is set
     */
    public boolean hasFriend() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .Friend Friend = 1;</code>
     * @return this
     */
    public FriendUIdSearchResp clearFriend() {
      bitField0_ &= ~0x00000001;
      friend.clear();
      return this;
    }

    /**
     * <code>optional .Friend Friend = 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 #getMutableFriend()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.Friend getFriend() {
      return friend;
    }

    /**
     * <code>optional .Friend Friend = 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 Public.Friend getMutableFriend() {
      bitField0_ |= 0x00000001;
      return friend;
    }

    /**
     * <code>optional .Friend Friend = 1;</code>
     * @param value the friend to set
     * @return this
     */
    public FriendUIdSearchResp setFriend(final Public.Friend value) {
      bitField0_ |= 0x00000001;
      friend.copyFrom(value);
      return this;
    }

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

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

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

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

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

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

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

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

    @Override
    public FriendUIdSearchResp mergeFrom(final FriendUIdSearchResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasFriend()) {
        getMutableFriend().mergeFrom(other.friend);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    private enum FriendUIdSearchRespFactory implements MessageFactory<FriendUIdSearchResp> {
      INSTANCE;

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

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

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