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

    /**
     * <code>optional uint32 prop_id = 9;</code>
     */
    private int propId;

    /**
     * <code>optional uint32 group_id = 14;</code>
     */
    private int groupId;

    /**
     * <code>optional uint32 quest_id = 15;</code>
     */
    private int questId;

    private FinishQuestCsReq() {
    }

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

    /**
     * <code>optional uint32 prop_id = 9;</code>
     * @return whether the propId field is set
     */
    public boolean hasPropId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 prop_id = 9;</code>
     * @return this
     */
    public FinishQuestCsReq clearPropId() {
      bitField0_ &= ~0x00000001;
      propId = 0;
      return this;
    }

    /**
     * <code>optional uint32 prop_id = 9;</code>
     * @return the propId
     */
    public int getPropId() {
      return propId;
    }

    /**
     * <code>optional uint32 prop_id = 9;</code>
     * @param value the propId to set
     * @return this
     */
    public FinishQuestCsReq setPropId(final int value) {
      bitField0_ |= 0x00000001;
      propId = value;
      return this;
    }

    /**
     * <code>optional uint32 group_id = 14;</code>
     * @return whether the groupId field is set
     */
    public boolean hasGroupId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 group_id = 14;</code>
     * @return this
     */
    public FinishQuestCsReq clearGroupId() {
      bitField0_ &= ~0x00000002;
      groupId = 0;
      return this;
    }

    /**
     * <code>optional uint32 group_id = 14;</code>
     * @return the groupId
     */
    public int getGroupId() {
      return groupId;
    }

    /**
     * <code>optional uint32 group_id = 14;</code>
     * @param value the groupId to set
     * @return this
     */
    public FinishQuestCsReq setGroupId(final int value) {
      bitField0_ |= 0x00000002;
      groupId = value;
      return this;
    }

    /**
     * <code>optional uint32 quest_id = 15;</code>
     * @return whether the questId field is set
     */
    public boolean hasQuestId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 quest_id = 15;</code>
     * @return this
     */
    public FinishQuestCsReq clearQuestId() {
      bitField0_ &= ~0x00000004;
      questId = 0;
      return this;
    }

    /**
     * <code>optional uint32 quest_id = 15;</code>
     * @return the questId
     */
    public int getQuestId() {
      return questId;
    }

    /**
     * <code>optional uint32 quest_id = 15;</code>
     * @param value the questId to set
     * @return this
     */
    public FinishQuestCsReq setQuestId(final int value) {
      bitField0_ |= 0x00000004;
      questId = value;
      return this;
    }

    @Override
    public FinishQuestCsReq copyFrom(final FinishQuestCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        propId = other.propId;
        groupId = other.groupId;
        questId = other.questId;
      }
      return this;
    }

    @Override
    public FinishQuestCsReq mergeFrom(final FinishQuestCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasPropId()) {
        setPropId(other.propId);
      }
      if (other.hasGroupId()) {
        setGroupId(other.groupId);
      }
      if (other.hasQuestId()) {
        setQuestId(other.questId);
      }
      return this;
    }

    @Override
    public FinishQuestCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      propId = 0;
      groupId = 0;
      questId = 0;
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof FinishQuestCsReq)) {
        return false;
      }
      FinishQuestCsReq other = (FinishQuestCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasPropId() || propId == other.propId)
        && (!hasGroupId() || groupId == other.groupId)
        && (!hasQuestId() || questId == other.questId);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 72);
        output.writeUInt32NoTag(propId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(groupId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(questId);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(propId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(groupId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(questId);
      }
      return size;
    }

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

    @Override
    public FinishQuestCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -979804194:
          case -309137545: {
            if (input.isAtField(FieldNames.propId)) {
              if (!input.trySkipNullValue()) {
                propId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 293428218:
          case 506361563: {
            if (input.isAtField(FieldNames.groupId)) {
              if (!input.trySkipNullValue()) {
                groupId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 655126941:
          case -1165879912: {
            if (input.isAtField(FieldNames.questId)) {
              if (!input.trySkipNullValue()) {
                questId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum FinishQuestCsReqFactory implements MessageFactory<FinishQuestCsReq> {
      INSTANCE;

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

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

      static final FieldName groupId = FieldName.forField("groupId", "group_id");

      static final FieldName questId = FieldName.forField("questId", "quest_id");
    }
  }
}
