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

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

    /**
     * <code>optional uint32 HFHKBMGBJAN = 2;</code>
     */
    private int hFHKBMGBJAN;

    /**
     * <code>optional .ItemList item_result = 13;</code>
     */
    private final ItemListOuterClass.ItemList itemResult = ItemListOuterClass.ItemList.newInstance();

    /**
     * <code>repeated uint32 event_ids = 10;</code>
     */
    private final RepeatedInt eventIds = RepeatedInt.newEmptyInstance();

    private DialogueResult() {
    }

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

    /**
     * <code>optional uint32 HFHKBMGBJAN = 2;</code>
     * @return whether the hFHKBMGBJAN field is set
     */
    public boolean hasHFHKBMGBJAN() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 HFHKBMGBJAN = 2;</code>
     * @return this
     */
    public DialogueResult clearHFHKBMGBJAN() {
      bitField0_ &= ~0x00000001;
      hFHKBMGBJAN = 0;
      return this;
    }

    /**
     * <code>optional uint32 HFHKBMGBJAN = 2;</code>
     * @return the hFHKBMGBJAN
     */
    public int getHFHKBMGBJAN() {
      return hFHKBMGBJAN;
    }

    /**
     * <code>optional uint32 HFHKBMGBJAN = 2;</code>
     * @param value the hFHKBMGBJAN to set
     * @return this
     */
    public DialogueResult setHFHKBMGBJAN(final int value) {
      bitField0_ |= 0x00000001;
      hFHKBMGBJAN = value;
      return this;
    }

    /**
     * <code>optional .ItemList item_result = 13;</code>
     * @return whether the itemResult field is set
     */
    public boolean hasItemResult() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .ItemList item_result = 13;</code>
     * @return this
     */
    public DialogueResult clearItemResult() {
      bitField0_ &= ~0x00000002;
      itemResult.clear();
      return this;
    }

    /**
     * <code>optional .ItemList item_result = 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 #getMutableItemResult()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public ItemListOuterClass.ItemList getItemResult() {
      return itemResult;
    }

    /**
     * <code>optional .ItemList item_result = 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 ItemListOuterClass.ItemList getMutableItemResult() {
      bitField0_ |= 0x00000002;
      return itemResult;
    }

    /**
     * <code>optional .ItemList item_result = 13;</code>
     * @param value the itemResult to set
     * @return this
     */
    public DialogueResult setItemResult(final ItemListOuterClass.ItemList value) {
      bitField0_ |= 0x00000002;
      itemResult.copyFrom(value);
      return this;
    }

    /**
     * <code>repeated uint32 event_ids = 10;</code>
     * @return whether the eventIds field is set
     */
    public boolean hasEventIds() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated uint32 event_ids = 10;</code>
     * @return this
     */
    public DialogueResult clearEventIds() {
      bitField0_ &= ~0x00000004;
      eventIds.clear();
      return this;
    }

    /**
     * <code>repeated uint32 event_ids = 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 #getMutableEventIds()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getEventIds() {
      return eventIds;
    }

    /**
     * <code>repeated uint32 event_ids = 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 RepeatedInt getMutableEventIds() {
      bitField0_ |= 0x00000004;
      return eventIds;
    }

    /**
     * <code>repeated uint32 event_ids = 10;</code>
     * @param value the eventIds to add
     * @return this
     */
    public DialogueResult addEventIds(final int value) {
      bitField0_ |= 0x00000004;
      eventIds.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 event_ids = 10;</code>
     * @param values the eventIds to add
     * @return this
     */
    public DialogueResult addAllEventIds(final int... values) {
      bitField0_ |= 0x00000004;
      eventIds.addAll(values);
      return this;
    }

    @Override
    public DialogueResult copyFrom(final DialogueResult other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        hFHKBMGBJAN = other.hFHKBMGBJAN;
        itemResult.copyFrom(other.itemResult);
        eventIds.copyFrom(other.eventIds);
      }
      return this;
    }

    @Override
    public DialogueResult mergeFrom(final DialogueResult other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasHFHKBMGBJAN()) {
        setHFHKBMGBJAN(other.hFHKBMGBJAN);
      }
      if (other.hasItemResult()) {
        getMutableItemResult().mergeFrom(other.itemResult);
      }
      if (other.hasEventIds()) {
        getMutableEventIds().addAll(other.eventIds);
      }
      return this;
    }

    @Override
    public DialogueResult clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      hFHKBMGBJAN = 0;
      itemResult.clear();
      eventIds.clear();
      return this;
    }

    @Override
    public DialogueResult clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      itemResult.clearQuick();
      eventIds.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof DialogueResult)) {
        return false;
      }
      DialogueResult other = (DialogueResult) o;
      return bitField0_ == other.bitField0_
        && (!hasHFHKBMGBJAN() || hFHKBMGBJAN == other.hFHKBMGBJAN)
        && (!hasItemResult() || itemResult.equals(other.itemResult))
        && (!hasEventIds() || eventIds.equals(other.eventIds));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(hFHKBMGBJAN);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 106);
        output.writeMessageNoTag(itemResult);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < eventIds.length(); i++) {
          output.writeRawByte((byte) 80);
          output.writeUInt32NoTag(eventIds.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(hFHKBMGBJAN);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(itemResult);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * eventIds.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(eventIds);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public DialogueResult mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // hFHKBMGBJAN
            hFHKBMGBJAN = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 106) {
              break;
            }
          }
          case 106: {
            // itemResult
            input.readMessage(itemResult);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 82) {
              break;
            }
          }
          case 82: {
            // eventIds [packed=true]
            input.readPackedUInt32(eventIds, tag);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 80: {
            // eventIds [packed=false]
            tag = input.readRepeatedUInt32(eventIds, tag);
            bitField0_ |= 0x00000004;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.hFHKBMGBJAN, hFHKBMGBJAN);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeMessage(FieldNames.itemResult, itemResult);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedUInt32(FieldNames.eventIds, eventIds);
      }
      output.endObject();
    }

    @Override
    public DialogueResult mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -110713808: {
            if (input.isAtField(FieldNames.hFHKBMGBJAN)) {
              if (!input.trySkipNullValue()) {
                hFHKBMGBJAN = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1957844240:
          case -424526135: {
            if (input.isAtField(FieldNames.itemResult)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(itemResult);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 278097342:
          case 31742867: {
            if (input.isAtField(FieldNames.eventIds)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(eventIds);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum DialogueResultFactory implements MessageFactory<DialogueResult> {
      INSTANCE;

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

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

      static final FieldName itemResult = FieldName.forField("itemResult", "item_result");

      static final FieldName eventIds = FieldName.forField("eventIds", "event_ids");
    }
  }
}
