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

    /**
     * <pre>
     *  LJJNGIINDIB
     * </pre>
     *
     * <code>optional .SwitchHandData hand_data = 10;</code>
     */
    private final SwitchHandDataOuterClass.SwitchHandData handData = SwitchHandDataOuterClass.SwitchHandData.newInstance();

    /**
     * <pre>
     *  ALOHEJACLLN
     * </pre>
     *
     * <code>optional .SwitchHandOpData op_data = 14;</code>
     */
    private final SwitchHandOpDataOuterClass.SwitchHandOpData opData = SwitchHandOpDataOuterClass.SwitchHandOpData.newInstance();

    private SwitchHandUpdateCsReq() {
    }

    /**
     * <pre>
     *  DDPACOEBGOC
     * </pre>
     *
     * @return a new empty instance of {@code SwitchHandUpdateCsReq}
     */
    public static SwitchHandUpdateCsReq newInstance() {
      return new SwitchHandUpdateCsReq();
    }

    /**
     * <pre>
     *  LJJNGIINDIB
     * </pre>
     *
     * <code>optional .SwitchHandData hand_data = 10;</code>
     * @return whether the handData field is set
     */
    public boolean hasHandData() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <pre>
     *  LJJNGIINDIB
     * </pre>
     *
     * <code>optional .SwitchHandData hand_data = 10;</code>
     * @return this
     */
    public SwitchHandUpdateCsReq clearHandData() {
      bitField0_ &= ~0x00000001;
      handData.clear();
      return this;
    }

    /**
     * <pre>
     *  LJJNGIINDIB
     * </pre>
     *
     * <code>optional .SwitchHandData hand_data = 10;</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 #getMutableHandData()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public SwitchHandDataOuterClass.SwitchHandData getHandData() {
      return handData;
    }

    /**
     * <pre>
     *  LJJNGIINDIB
     * </pre>
     *
     * <code>optional .SwitchHandData hand_data = 10;</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 SwitchHandDataOuterClass.SwitchHandData getMutableHandData() {
      bitField0_ |= 0x00000001;
      return handData;
    }

    /**
     * <pre>
     *  LJJNGIINDIB
     * </pre>
     *
     * <code>optional .SwitchHandData hand_data = 10;</code>
     * @param value the handData to set
     * @return this
     */
    public SwitchHandUpdateCsReq setHandData(final SwitchHandDataOuterClass.SwitchHandData value) {
      bitField0_ |= 0x00000001;
      handData.copyFrom(value);
      return this;
    }

    /**
     * <pre>
     *  ALOHEJACLLN
     * </pre>
     *
     * <code>optional .SwitchHandOpData op_data = 14;</code>
     * @return whether the opData field is set
     */
    public boolean hasOpData() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <pre>
     *  ALOHEJACLLN
     * </pre>
     *
     * <code>optional .SwitchHandOpData op_data = 14;</code>
     * @return this
     */
    public SwitchHandUpdateCsReq clearOpData() {
      bitField0_ &= ~0x00000002;
      opData.clear();
      return this;
    }

    /**
     * <pre>
     *  ALOHEJACLLN
     * </pre>
     *
     * <code>optional .SwitchHandOpData op_data = 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 #getMutableOpData()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public SwitchHandOpDataOuterClass.SwitchHandOpData getOpData() {
      return opData;
    }

    /**
     * <pre>
     *  ALOHEJACLLN
     * </pre>
     *
     * <code>optional .SwitchHandOpData op_data = 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 SwitchHandOpDataOuterClass.SwitchHandOpData getMutableOpData() {
      bitField0_ |= 0x00000002;
      return opData;
    }

    /**
     * <pre>
     *  ALOHEJACLLN
     * </pre>
     *
     * <code>optional .SwitchHandOpData op_data = 14;</code>
     * @param value the opData to set
     * @return this
     */
    public SwitchHandUpdateCsReq setOpData(
        final SwitchHandOpDataOuterClass.SwitchHandOpData value) {
      bitField0_ |= 0x00000002;
      opData.copyFrom(value);
      return this;
    }

    @Override
    public SwitchHandUpdateCsReq copyFrom(final SwitchHandUpdateCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        handData.copyFrom(other.handData);
        opData.copyFrom(other.opData);
      }
      return this;
    }

    @Override
    public SwitchHandUpdateCsReq mergeFrom(final SwitchHandUpdateCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasHandData()) {
        getMutableHandData().mergeFrom(other.handData);
      }
      if (other.hasOpData()) {
        getMutableOpData().mergeFrom(other.opData);
      }
      return this;
    }

    @Override
    public SwitchHandUpdateCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      handData.clear();
      opData.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof SwitchHandUpdateCsReq)) {
        return false;
      }
      SwitchHandUpdateCsReq other = (SwitchHandUpdateCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasHandData() || handData.equals(other.handData))
        && (!hasOpData() || opData.equals(other.opData));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 82);
        output.writeMessageNoTag(handData);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 114);
        output.writeMessageNoTag(opData);
      }
    }

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

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

    @Override
    public SwitchHandUpdateCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 873657:
          case 52090234: {
            if (input.isAtField(FieldNames.handData)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(handData);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1011574485:
          case -1269031096: {
            if (input.isAtField(FieldNames.opData)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(opData);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum SwitchHandUpdateCsReqFactory implements MessageFactory<SwitchHandUpdateCsReq> {
      INSTANCE;

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

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

      static final FieldName opData = FieldName.forField("opData", "op_data");
    }
  }
}
