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

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

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

    /**
     * <code>optional string Name = 1;</code>
     */
    private final Utf8String name = Utf8String.newEmptyInstance();

    private PlayerNameEditReq() {
    }

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

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

    /**
     * <code>optional string Name = 1;</code>
     * @return whether the name field is set
     */
    public boolean hasName() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional string Name = 1;</code>
     * @return this
     */
    public PlayerNameEditReq clearName() {
      bitField0_ &= ~0x00000002;
      name.clear();
      return this;
    }

    /**
     * <code>optional string Name = 1;</code>
     * @return the name
     */
    public String getName() {
      return name.getString();
    }

    /**
     * <code>optional string Name = 1;</code>
     * @return internal {@code Utf8String} representation of name for reading
     */
    public Utf8String getNameBytes() {
      return this.name;
    }

    /**
     * <code>optional string Name = 1;</code>
     * @return internal {@code Utf8String} representation of name for modifications
     */
    public Utf8String getMutableNameBytes() {
      bitField0_ |= 0x00000002;
      return this.name;
    }

    /**
     * <code>optional string Name = 1;</code>
     * @param value the name to set
     * @return this
     */
    public PlayerNameEditReq setName(final CharSequence value) {
      bitField0_ |= 0x00000002;
      name.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string Name = 1;</code>
     * @param value the name to set
     * @return this
     */
    public PlayerNameEditReq setName(final Utf8String value) {
      bitField0_ |= 0x00000002;
      name.copyFrom(value);
      return this;
    }

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

    @Override
    public PlayerNameEditReq mergeFrom(final PlayerNameEditReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasName()) {
        getMutableNameBytes().copyFrom(other.name);
      }
      return this;
    }

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

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

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

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

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

    @Override
    @SuppressWarnings("fallthrough")
    public PlayerNameEditReq 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: {
            // name
            input.readString(name);
            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.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeString(FieldNames.name, name);
      }
      output.endObject();
    }

    @Override
    public PlayerNameEditReq 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 2420395: {
            if (input.isAtField(FieldNames.name)) {
              if (!input.trySkipNullValue()) {
                input.readString(name);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum PlayerNameEditReqFactory implements MessageFactory<PlayerNameEditReq> {
      INSTANCE;

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

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

      static final FieldName name = FieldName.forField("Name");
    }
  }

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

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

    /**
     * <code>optional uint32 Hashtag = 1;</code>
     */
    private int hashtag;

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

    private PlayerNameEditResp() {
    }

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

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

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

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

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

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

    /**
     * <code>optional uint32 Hashtag = 1;</code>
     * @return this
     */
    public PlayerNameEditResp clearHashtag() {
      bitField0_ &= ~0x00000002;
      hashtag = 0;
      return this;
    }

    /**
     * <code>optional uint32 Hashtag = 1;</code>
     * @return the hashtag
     */
    public int getHashtag() {
      return hashtag;
    }

    /**
     * <code>optional uint32 Hashtag = 1;</code>
     * @param value the hashtag to set
     * @return this
     */
    public PlayerNameEditResp setHashtag(final int value) {
      bitField0_ |= 0x00000002;
      hashtag = 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 PlayerNameEditResp 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 PlayerNameEditResp 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 PlayerNameEditResp 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 PlayerNameEditResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

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

    @Override
    public PlayerNameEditResp mergeFrom(final PlayerNameEditResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasResetTime()) {
        setResetTime(other.resetTime);
      }
      if (other.hasHashtag()) {
        setHashtag(other.hashtag);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

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

    @Override
    public PlayerNameEditResp 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 PlayerNameEditResp)) {
        return false;
      }
      PlayerNameEditResp other = (PlayerNameEditResp) o;
      return bitField0_ == other.bitField0_
        && (!hasResetTime() || resetTime == other.resetTime)
        && (!hasHashtag() || hashtag == other.hashtag)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

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

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

    @Override
    public PlayerNameEditResp 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 -1932766292: {
            if (input.isAtField(FieldNames.hashtag)) {
              if (!input.trySkipNullValue()) {
                hashtag = 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 PlayerNameEditResp clone() {
      return new PlayerNameEditResp().copyFrom(this);
    }

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

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

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

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

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

    private enum PlayerNameEditRespFactory implements MessageFactory<PlayerNameEditResp> {
      INSTANCE;

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

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

      static final FieldName hashtag = FieldName.forField("Hashtag");

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