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

    /**
     * <code>optional uint32 rogue_npc_id = 4;</code>
     */
    private int rogueNpcId;

    /**
     * <code>optional uint32 dialogue_group_id = 12;</code>
     */
    private int dialogueGroupId;

    private NpcRogueInfo() {
    }

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

    /**
     * <code>optional uint32 rogue_npc_id = 4;</code>
     * @return whether the rogueNpcId field is set
     */
    public boolean hasRogueNpcId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 rogue_npc_id = 4;</code>
     * @return this
     */
    public NpcRogueInfo clearRogueNpcId() {
      bitField0_ &= ~0x00000001;
      rogueNpcId = 0;
      return this;
    }

    /**
     * <code>optional uint32 rogue_npc_id = 4;</code>
     * @return the rogueNpcId
     */
    public int getRogueNpcId() {
      return rogueNpcId;
    }

    /**
     * <code>optional uint32 rogue_npc_id = 4;</code>
     * @param value the rogueNpcId to set
     * @return this
     */
    public NpcRogueInfo setRogueNpcId(final int value) {
      bitField0_ |= 0x00000001;
      rogueNpcId = value;
      return this;
    }

    /**
     * <code>optional uint32 dialogue_group_id = 12;</code>
     * @return whether the dialogueGroupId field is set
     */
    public boolean hasDialogueGroupId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 dialogue_group_id = 12;</code>
     * @return this
     */
    public NpcRogueInfo clearDialogueGroupId() {
      bitField0_ &= ~0x00000002;
      dialogueGroupId = 0;
      return this;
    }

    /**
     * <code>optional uint32 dialogue_group_id = 12;</code>
     * @return the dialogueGroupId
     */
    public int getDialogueGroupId() {
      return dialogueGroupId;
    }

    /**
     * <code>optional uint32 dialogue_group_id = 12;</code>
     * @param value the dialogueGroupId to set
     * @return this
     */
    public NpcRogueInfo setDialogueGroupId(final int value) {
      bitField0_ |= 0x00000002;
      dialogueGroupId = value;
      return this;
    }

    @Override
    public NpcRogueInfo copyFrom(final NpcRogueInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        rogueNpcId = other.rogueNpcId;
        dialogueGroupId = other.dialogueGroupId;
      }
      return this;
    }

    @Override
    public NpcRogueInfo mergeFrom(final NpcRogueInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRogueNpcId()) {
        setRogueNpcId(other.rogueNpcId);
      }
      if (other.hasDialogueGroupId()) {
        setDialogueGroupId(other.dialogueGroupId);
      }
      return this;
    }

    @Override
    public NpcRogueInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      rogueNpcId = 0;
      dialogueGroupId = 0;
      return this;
    }

    @Override
    public NpcRogueInfo 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 NpcRogueInfo)) {
        return false;
      }
      NpcRogueInfo other = (NpcRogueInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasRogueNpcId() || rogueNpcId == other.rogueNpcId)
        && (!hasDialogueGroupId() || dialogueGroupId == other.dialogueGroupId);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(rogueNpcId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(dialogueGroupId);
      }
    }

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

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

    @Override
    public NpcRogueInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1140086238:
          case 1751967038: {
            if (input.isAtField(FieldNames.rogueNpcId)) {
              if (!input.trySkipNullValue()) {
                rogueNpcId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1758320386:
          case 1899979106: {
            if (input.isAtField(FieldNames.dialogueGroupId)) {
              if (!input.trySkipNullValue()) {
                dialogueGroupId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum NpcRogueInfoFactory implements MessageFactory<NpcRogueInfo> {
      INSTANCE;

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

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

      static final FieldName dialogueGroupId = FieldName.forField("dialogueGroupId", "dialogue_group_id");
    }
  }
}
