// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.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.Utf8String;

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

    /**
     * <code>optional uint64 secret_key_seed = 8;</code>
     */
    private long secretKeySeed;

    /**
     * <code>optional uint32 retcode = 7;</code>
     */
    private int retcode;

    /**
     * <code>optional uint32 uid = 11;</code>
     */
    private int uid;

    /**
     * <code>optional .BlackInfo black_info = 14;</code>
     */
    private final BlackInfoOuterClass.BlackInfo blackInfo = BlackInfoOuterClass.BlackInfo.newInstance();

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

    private PlayerGetTokenScRsp() {
    }

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

    /**
     * <code>optional uint64 secret_key_seed = 8;</code>
     * @return whether the secretKeySeed field is set
     */
    public boolean hasSecretKeySeed() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint64 secret_key_seed = 8;</code>
     * @return this
     */
    public PlayerGetTokenScRsp clearSecretKeySeed() {
      bitField0_ &= ~0x00000001;
      secretKeySeed = 0L;
      return this;
    }

    /**
     * <code>optional uint64 secret_key_seed = 8;</code>
     * @return the secretKeySeed
     */
    public long getSecretKeySeed() {
      return secretKeySeed;
    }

    /**
     * <code>optional uint64 secret_key_seed = 8;</code>
     * @param value the secretKeySeed to set
     * @return this
     */
    public PlayerGetTokenScRsp setSecretKeySeed(final long value) {
      bitField0_ |= 0x00000001;
      secretKeySeed = value;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @return whether the retcode field is set
     */
    public boolean hasRetcode() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @return this
     */
    public PlayerGetTokenScRsp clearRetcode() {
      bitField0_ &= ~0x00000002;
      retcode = 0;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @return the retcode
     */
    public int getRetcode() {
      return retcode;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @param value the retcode to set
     * @return this
     */
    public PlayerGetTokenScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000002;
      retcode = value;
      return this;
    }

    /**
     * <code>optional uint32 uid = 11;</code>
     * @return whether the uid field is set
     */
    public boolean hasUid() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 uid = 11;</code>
     * @return this
     */
    public PlayerGetTokenScRsp clearUid() {
      bitField0_ &= ~0x00000004;
      uid = 0;
      return this;
    }

    /**
     * <code>optional uint32 uid = 11;</code>
     * @return the uid
     */
    public int getUid() {
      return uid;
    }

    /**
     * <code>optional uint32 uid = 11;</code>
     * @param value the uid to set
     * @return this
     */
    public PlayerGetTokenScRsp setUid(final int value) {
      bitField0_ |= 0x00000004;
      uid = value;
      return this;
    }

    /**
     * <code>optional .BlackInfo black_info = 14;</code>
     * @return whether the blackInfo field is set
     */
    public boolean hasBlackInfo() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .BlackInfo black_info = 14;</code>
     * @return this
     */
    public PlayerGetTokenScRsp clearBlackInfo() {
      bitField0_ &= ~0x00000008;
      blackInfo.clear();
      return this;
    }

    /**
     * <code>optional .BlackInfo black_info = 14;</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 #getMutableBlackInfo()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public BlackInfoOuterClass.BlackInfo getBlackInfo() {
      return blackInfo;
    }

    /**
     * <code>optional .BlackInfo black_info = 14;</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 BlackInfoOuterClass.BlackInfo getMutableBlackInfo() {
      bitField0_ |= 0x00000008;
      return blackInfo;
    }

    /**
     * <code>optional .BlackInfo black_info = 14;</code>
     * @param value the blackInfo to set
     * @return this
     */
    public PlayerGetTokenScRsp setBlackInfo(final BlackInfoOuterClass.BlackInfo value) {
      bitField0_ |= 0x00000008;
      blackInfo.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string msg = 1;</code>
     * @return whether the msg field is set
     */
    public boolean hasMsg() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional string msg = 1;</code>
     * @return this
     */
    public PlayerGetTokenScRsp clearMsg() {
      bitField0_ &= ~0x00000010;
      msg.clear();
      return this;
    }

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

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

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

    /**
     * <code>optional string msg = 1;</code>
     * @param value the msg to set
     * @return this
     */
    public PlayerGetTokenScRsp setMsg(final CharSequence value) {
      bitField0_ |= 0x00000010;
      msg.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string msg = 1;</code>
     * @param value the msg to set
     * @return this
     */
    public PlayerGetTokenScRsp setMsg(final Utf8String value) {
      bitField0_ |= 0x00000010;
      msg.copyFrom(value);
      return this;
    }

    @Override
    public PlayerGetTokenScRsp copyFrom(final PlayerGetTokenScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        secretKeySeed = other.secretKeySeed;
        retcode = other.retcode;
        uid = other.uid;
        blackInfo.copyFrom(other.blackInfo);
        msg.copyFrom(other.msg);
      }
      return this;
    }

    @Override
    public PlayerGetTokenScRsp mergeFrom(final PlayerGetTokenScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasSecretKeySeed()) {
        setSecretKeySeed(other.secretKeySeed);
      }
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasUid()) {
        setUid(other.uid);
      }
      if (other.hasBlackInfo()) {
        getMutableBlackInfo().mergeFrom(other.blackInfo);
      }
      if (other.hasMsg()) {
        getMutableMsgBytes().copyFrom(other.msg);
      }
      return this;
    }

    @Override
    public PlayerGetTokenScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      secretKeySeed = 0L;
      retcode = 0;
      uid = 0;
      blackInfo.clear();
      msg.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof PlayerGetTokenScRsp)) {
        return false;
      }
      PlayerGetTokenScRsp other = (PlayerGetTokenScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasSecretKeySeed() || secretKeySeed == other.secretKeySeed)
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasUid() || uid == other.uid)
        && (!hasBlackInfo() || blackInfo.equals(other.blackInfo))
        && (!hasMsg() || msg.equals(other.msg));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt64NoTag(secretKeySeed);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(uid);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 114);
        output.writeMessageNoTag(blackInfo);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 10);
        output.writeStringNoTag(msg);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt64SizeNoTag(secretKeySeed);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(uid);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(blackInfo);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeStringSizeNoTag(msg);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public PlayerGetTokenScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 64: {
            // secretKeySeed
            secretKeySeed = input.readUInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // uid
            uid = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 114) {
              break;
            }
          }
          case 114: {
            // blackInfo
            input.readMessage(blackInfo);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // msg
            input.readString(msg);
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt64(FieldNames.secretKeySeed, secretKeySeed);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.retcode, retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.uid, uid);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.blackInfo, blackInfo);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeString(FieldNames.msg, msg);
      }
      output.endObject();
    }

    @Override
    public PlayerGetTokenScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1321008288:
          case -1231194880: {
            if (input.isAtField(FieldNames.secretKeySeed)) {
              if (!input.trySkipNullValue()) {
                secretKeySeed = input.readUInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1097936398: {
            if (input.isAtField(FieldNames.retcode)) {
              if (!input.trySkipNullValue()) {
                retcode = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 115792: {
            if (input.isAtField(FieldNames.uid)) {
              if (!input.trySkipNullValue()) {
                uid = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1331974477:
          case -1638288146: {
            if (input.isAtField(FieldNames.blackInfo)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(blackInfo);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 108417: {
            if (input.isAtField(FieldNames.msg)) {
              if (!input.trySkipNullValue()) {
                input.readString(msg);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum PlayerGetTokenScRspFactory implements MessageFactory<PlayerGetTokenScRsp> {
      INSTANCE;

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

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

      static final FieldName retcode = FieldName.forField("retcode");

      static final FieldName uid = FieldName.forField("uid");

      static final FieldName blackInfo = FieldName.forField("blackInfo", "black_info");

      static final FieldName msg = FieldName.forField("msg");
    }
  }
}
