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

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

    /**
     * <code>optional uint64 client_time_ms = 3;</code>
     */
    private long clientTimeMs;

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

    /**
     * <code>optional .ClientUploadData upload_data = 13;</code>
     */
    private final ClientUploadDataOuterClass.ClientUploadData uploadData = ClientUploadDataOuterClass.ClientUploadData.newInstance();

    private PlayerHeartbeatCsReq() {
    }

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

    /**
     * <code>optional uint64 client_time_ms = 3;</code>
     * @return whether the clientTimeMs field is set
     */
    public boolean hasClientTimeMs() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint64 client_time_ms = 3;</code>
     * @return this
     */
    public PlayerHeartbeatCsReq clearClientTimeMs() {
      bitField0_ &= ~0x00000001;
      clientTimeMs = 0L;
      return this;
    }

    /**
     * <code>optional uint64 client_time_ms = 3;</code>
     * @return the clientTimeMs
     */
    public long getClientTimeMs() {
      return clientTimeMs;
    }

    /**
     * <code>optional uint64 client_time_ms = 3;</code>
     * @param value the clientTimeMs to set
     * @return this
     */
    public PlayerHeartbeatCsReq setClientTimeMs(final long value) {
      bitField0_ |= 0x00000001;
      clientTimeMs = value;
      return this;
    }

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

    /**
     * <code>optional uint32 DIMAFIDFCOD = 7;</code>
     * @return this
     */
    public PlayerHeartbeatCsReq clearDIMAFIDFCOD() {
      bitField0_ &= ~0x00000002;
      dIMAFIDFCOD = 0;
      return this;
    }

    /**
     * <code>optional uint32 DIMAFIDFCOD = 7;</code>
     * @return the dIMAFIDFCOD
     */
    public int getDIMAFIDFCOD() {
      return dIMAFIDFCOD;
    }

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

    /**
     * <code>optional .ClientUploadData upload_data = 13;</code>
     * @return whether the uploadData field is set
     */
    public boolean hasUploadData() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .ClientUploadData upload_data = 13;</code>
     * @return this
     */
    public PlayerHeartbeatCsReq clearUploadData() {
      bitField0_ &= ~0x00000004;
      uploadData.clear();
      return this;
    }

    /**
     * <code>optional .ClientUploadData upload_data = 13;</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 #getMutableUploadData()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public ClientUploadDataOuterClass.ClientUploadData getUploadData() {
      return uploadData;
    }

    /**
     * <code>optional .ClientUploadData upload_data = 13;</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 ClientUploadDataOuterClass.ClientUploadData getMutableUploadData() {
      bitField0_ |= 0x00000004;
      return uploadData;
    }

    /**
     * <code>optional .ClientUploadData upload_data = 13;</code>
     * @param value the uploadData to set
     * @return this
     */
    public PlayerHeartbeatCsReq setUploadData(
        final ClientUploadDataOuterClass.ClientUploadData value) {
      bitField0_ |= 0x00000004;
      uploadData.copyFrom(value);
      return this;
    }

    @Override
    public PlayerHeartbeatCsReq copyFrom(final PlayerHeartbeatCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        clientTimeMs = other.clientTimeMs;
        dIMAFIDFCOD = other.dIMAFIDFCOD;
        uploadData.copyFrom(other.uploadData);
      }
      return this;
    }

    @Override
    public PlayerHeartbeatCsReq mergeFrom(final PlayerHeartbeatCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasClientTimeMs()) {
        setClientTimeMs(other.clientTimeMs);
      }
      if (other.hasDIMAFIDFCOD()) {
        setDIMAFIDFCOD(other.dIMAFIDFCOD);
      }
      if (other.hasUploadData()) {
        getMutableUploadData().mergeFrom(other.uploadData);
      }
      return this;
    }

    @Override
    public PlayerHeartbeatCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      clientTimeMs = 0L;
      dIMAFIDFCOD = 0;
      uploadData.clear();
      return this;
    }

    @Override
    public PlayerHeartbeatCsReq clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      uploadData.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof PlayerHeartbeatCsReq)) {
        return false;
      }
      PlayerHeartbeatCsReq other = (PlayerHeartbeatCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasClientTimeMs() || clientTimeMs == other.clientTimeMs)
        && (!hasDIMAFIDFCOD() || dIMAFIDFCOD == other.dIMAFIDFCOD)
        && (!hasUploadData() || uploadData.equals(other.uploadData));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt64NoTag(clientTimeMs);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(dIMAFIDFCOD);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 106);
        output.writeMessageNoTag(uploadData);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt64SizeNoTag(clientTimeMs);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(dIMAFIDFCOD);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(uploadData);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public PlayerHeartbeatCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // clientTimeMs
            clientTimeMs = input.readUInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // dIMAFIDFCOD
            dIMAFIDFCOD = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 106) {
              break;
            }
          }
          case 106: {
            // uploadData
            input.readMessage(uploadData);
            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.writeUInt64(FieldNames.clientTimeMs, clientTimeMs);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.dIMAFIDFCOD, dIMAFIDFCOD);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeMessage(FieldNames.uploadData, uploadData);
      }
      output.endObject();
    }

    @Override
    public PlayerHeartbeatCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1414301442:
          case 1123200996: {
            if (input.isAtField(FieldNames.clientTimeMs)) {
              if (!input.trySkipNullValue()) {
                clientTimeMs = input.readUInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 634885050: {
            if (input.isAtField(FieldNames.dIMAFIDFCOD)) {
              if (!input.trySkipNullValue()) {
                dIMAFIDFCOD = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -243562165:
          case 1064514344: {
            if (input.isAtField(FieldNames.uploadData)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(uploadData);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum PlayerHeartbeatCsReqFactory implements MessageFactory<PlayerHeartbeatCsReq> {
      INSTANCE;

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

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

      static final FieldName dIMAFIDFCOD = FieldName.forField("DIMAFIDFCOD");

      static final FieldName uploadData = FieldName.forField("uploadData", "upload_data");
    }
  }
}
