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

    /**
     * <pre>
     *  ItemList get_item_list = 2;
     * </pre>
     *
     * <code>optional .ItemList get_item_list = 5;</code>
     */
    private final ItemListOuterClass.ItemList getItemList = ItemListOuterClass.ItemList.newInstance();

    private ScenePlaneEventScNotify() {
    }

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

    /**
     * <pre>
     *  ItemList get_item_list = 2;
     * </pre>
     *
     * <code>optional .ItemList get_item_list = 5;</code>
     * @return whether the getItemList field is set
     */
    public boolean hasGetItemList() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <pre>
     *  ItemList get_item_list = 2;
     * </pre>
     *
     * <code>optional .ItemList get_item_list = 5;</code>
     * @return this
     */
    public ScenePlaneEventScNotify clearGetItemList() {
      bitField0_ &= ~0x00000001;
      getItemList.clear();
      return this;
    }

    /**
     * <pre>
     *  ItemList get_item_list = 2;
     * </pre>
     *
     * <code>optional .ItemList get_item_list = 5;</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 #getMutableGetItemList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public ItemListOuterClass.ItemList getGetItemList() {
      return getItemList;
    }

    /**
     * <pre>
     *  ItemList get_item_list = 2;
     * </pre>
     *
     * <code>optional .ItemList get_item_list = 5;</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 getMutableGetItemList() {
      bitField0_ |= 0x00000001;
      return getItemList;
    }

    /**
     * <pre>
     *  ItemList get_item_list = 2;
     * </pre>
     *
     * <code>optional .ItemList get_item_list = 5;</code>
     * @param value the getItemList to set
     * @return this
     */
    public ScenePlaneEventScNotify setGetItemList(final ItemListOuterClass.ItemList value) {
      bitField0_ |= 0x00000001;
      getItemList.copyFrom(value);
      return this;
    }

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

    @Override
    public ScenePlaneEventScNotify mergeFrom(final ScenePlaneEventScNotify other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasGetItemList()) {
        getMutableGetItemList().mergeFrom(other.getItemList);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ScenePlaneEventScNotify)) {
        return false;
      }
      ScenePlaneEventScNotify other = (ScenePlaneEventScNotify) o;
      return bitField0_ == other.bitField0_
        && (!hasGetItemList() || getItemList.equals(other.getItemList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 42);
        output.writeMessageNoTag(getItemList);
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public ScenePlaneEventScNotify mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 42: {
            // getItemList
            input.readMessage(getItemList);
            bitField0_ |= 0x00000001;
            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.getItemList, getItemList);
      }
      output.endObject();
    }

    @Override
    public ScenePlaneEventScNotify mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1039787065:
          case -1626556255: {
            if (input.isAtField(FieldNames.getItemList)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(getItemList);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ScenePlaneEventScNotifyFactory implements MessageFactory<ScenePlaneEventScNotify> {
      INSTANCE;

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

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