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

    /**
     * <code>optional uint32 config_id = 8;</code>
     */
    private int configId;

    /**
     * <code>optional uint32 state = 11;</code>
     */
    private int state;

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

    /**
     * <code>optional .PropExtraInfo extra_info = 9;</code>
     */
    private final PropExtraInfoOuterClass.PropExtraInfo extraInfo = PropExtraInfoOuterClass.PropExtraInfo.newInstance();

    private MapPropInfo() {
    }

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

    /**
     * <code>optional uint32 config_id = 8;</code>
     * @return whether the configId field is set
     */
    public boolean hasConfigId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 config_id = 8;</code>
     * @return this
     */
    public MapPropInfo clearConfigId() {
      bitField0_ &= ~0x00000001;
      configId = 0;
      return this;
    }

    /**
     * <code>optional uint32 config_id = 8;</code>
     * @return the configId
     */
    public int getConfigId() {
      return configId;
    }

    /**
     * <code>optional uint32 config_id = 8;</code>
     * @param value the configId to set
     * @return this
     */
    public MapPropInfo setConfigId(final int value) {
      bitField0_ |= 0x00000001;
      configId = value;
      return this;
    }

    /**
     * <code>optional uint32 state = 11;</code>
     * @return whether the state field is set
     */
    public boolean hasState() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 state = 11;</code>
     * @return this
     */
    public MapPropInfo clearState() {
      bitField0_ &= ~0x00000002;
      state = 0;
      return this;
    }

    /**
     * <code>optional uint32 state = 11;</code>
     * @return the state
     */
    public int getState() {
      return state;
    }

    /**
     * <code>optional uint32 state = 11;</code>
     * @param value the state to set
     * @return this
     */
    public MapPropInfo setState(final int value) {
      bitField0_ |= 0x00000002;
      state = value;
      return this;
    }

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

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

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

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

    /**
     * <code>optional .PropExtraInfo extra_info = 9;</code>
     * @return whether the extraInfo field is set
     */
    public boolean hasExtraInfo() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .PropExtraInfo extra_info = 9;</code>
     * @return this
     */
    public MapPropInfo clearExtraInfo() {
      bitField0_ &= ~0x00000008;
      extraInfo.clear();
      return this;
    }

    /**
     * <code>optional .PropExtraInfo extra_info = 9;</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 #getMutableExtraInfo()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public PropExtraInfoOuterClass.PropExtraInfo getExtraInfo() {
      return extraInfo;
    }

    /**
     * <code>optional .PropExtraInfo extra_info = 9;</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 PropExtraInfoOuterClass.PropExtraInfo getMutableExtraInfo() {
      bitField0_ |= 0x00000008;
      return extraInfo;
    }

    /**
     * <code>optional .PropExtraInfo extra_info = 9;</code>
     * @param value the extraInfo to set
     * @return this
     */
    public MapPropInfo setExtraInfo(final PropExtraInfoOuterClass.PropExtraInfo value) {
      bitField0_ |= 0x00000008;
      extraInfo.copyFrom(value);
      return this;
    }

    @Override
    public MapPropInfo copyFrom(final MapPropInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        configId = other.configId;
        state = other.state;
        groupId = other.groupId;
        extraInfo.copyFrom(other.extraInfo);
      }
      return this;
    }

    @Override
    public MapPropInfo mergeFrom(final MapPropInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasConfigId()) {
        setConfigId(other.configId);
      }
      if (other.hasState()) {
        setState(other.state);
      }
      if (other.hasGroupId()) {
        setGroupId(other.groupId);
      }
      if (other.hasExtraInfo()) {
        getMutableExtraInfo().mergeFrom(other.extraInfo);
      }
      return this;
    }

    @Override
    public MapPropInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      configId = 0;
      state = 0;
      groupId = 0;
      extraInfo.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MapPropInfo)) {
        return false;
      }
      MapPropInfo other = (MapPropInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasConfigId() || configId == other.configId)
        && (!hasState() || state == other.state)
        && (!hasGroupId() || groupId == other.groupId)
        && (!hasExtraInfo() || extraInfo.equals(other.extraInfo));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt32NoTag(configId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(state);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 104);
        output.writeUInt32NoTag(groupId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 74);
        output.writeMessageNoTag(extraInfo);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(configId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(state);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(groupId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(extraInfo);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MapPropInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 64: {
            // configId
            configId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // state
            state = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 104) {
              break;
            }
          }
          case 104: {
            // groupId
            groupId = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 74) {
              break;
            }
          }
          case 74: {
            // extraInfo
            input.readMessage(extraInfo);
            bitField0_ |= 0x00000008;
            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.configId, configId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.state, state);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.groupId, groupId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.extraInfo, extraInfo);
      }
      output.endObject();
    }

    @Override
    public MapPropInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -580140035:
          case -804450504: {
            if (input.isAtField(FieldNames.configId)) {
              if (!input.trySkipNullValue()) {
                configId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 109757585: {
            if (input.isAtField(FieldNames.state)) {
              if (!input.trySkipNullValue()) {
                state = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 293428218:
          case 506361563: {
            if (input.isAtField(FieldNames.groupId)) {
              if (!input.trySkipNullValue()) {
                groupId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -253631266:
          case 747541373: {
            if (input.isAtField(FieldNames.extraInfo)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(extraInfo);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MapPropInfoFactory implements MessageFactory<MapPropInfo> {
      INSTANCE;

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

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

      static final FieldName state = FieldName.forField("state");

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

      static final FieldName extraInfo = FieldName.forField("extraInfo", "extra_info");
    }
  }
}
