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

    /**
     * <code>optional uint32 entry_id = 4;</code>
     */
    private int entryId;

    /**
     * <code>optional uint32 player_uid = 8;</code>
     */
    private int playerUid;

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

    /**
     * <code>optional uint32 group_state = 13;</code>
     */
    private int groupState;

    private GroupStateInfo() {
    }

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

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

    /**
     * <code>optional uint32 entry_id = 4;</code>
     * @return this
     */
    public GroupStateInfo clearEntryId() {
      bitField0_ &= ~0x00000001;
      entryId = 0;
      return this;
    }

    /**
     * <code>optional uint32 entry_id = 4;</code>
     * @return the entryId
     */
    public int getEntryId() {
      return entryId;
    }

    /**
     * <code>optional uint32 entry_id = 4;</code>
     * @param value the entryId to set
     * @return this
     */
    public GroupStateInfo setEntryId(final int value) {
      bitField0_ |= 0x00000001;
      entryId = value;
      return this;
    }

    /**
     * <code>optional uint32 player_uid = 8;</code>
     * @return whether the playerUid field is set
     */
    public boolean hasPlayerUid() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 player_uid = 8;</code>
     * @return this
     */
    public GroupStateInfo clearPlayerUid() {
      bitField0_ &= ~0x00000002;
      playerUid = 0;
      return this;
    }

    /**
     * <code>optional uint32 player_uid = 8;</code>
     * @return the playerUid
     */
    public int getPlayerUid() {
      return playerUid;
    }

    /**
     * <code>optional uint32 player_uid = 8;</code>
     * @param value the playerUid to set
     * @return this
     */
    public GroupStateInfo setPlayerUid(final int value) {
      bitField0_ |= 0x00000002;
      playerUid = value;
      return this;
    }

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

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

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

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

    /**
     * <code>optional uint32 group_state = 13;</code>
     * @return whether the groupState field is set
     */
    public boolean hasGroupState() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 group_state = 13;</code>
     * @return this
     */
    public GroupStateInfo clearGroupState() {
      bitField0_ &= ~0x00000008;
      groupState = 0;
      return this;
    }

    /**
     * <code>optional uint32 group_state = 13;</code>
     * @return the groupState
     */
    public int getGroupState() {
      return groupState;
    }

    /**
     * <code>optional uint32 group_state = 13;</code>
     * @param value the groupState to set
     * @return this
     */
    public GroupStateInfo setGroupState(final int value) {
      bitField0_ |= 0x00000008;
      groupState = value;
      return this;
    }

    @Override
    public GroupStateInfo copyFrom(final GroupStateInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        entryId = other.entryId;
        playerUid = other.playerUid;
        groupId = other.groupId;
        groupState = other.groupState;
      }
      return this;
    }

    @Override
    public GroupStateInfo mergeFrom(final GroupStateInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasEntryId()) {
        setEntryId(other.entryId);
      }
      if (other.hasPlayerUid()) {
        setPlayerUid(other.playerUid);
      }
      if (other.hasGroupId()) {
        setGroupId(other.groupId);
      }
      if (other.hasGroupState()) {
        setGroupState(other.groupState);
      }
      return this;
    }

    @Override
    public GroupStateInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      entryId = 0;
      playerUid = 0;
      groupId = 0;
      groupState = 0;
      return this;
    }

    @Override
    public GroupStateInfo 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 GroupStateInfo)) {
        return false;
      }
      GroupStateInfo other = (GroupStateInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasEntryId() || entryId == other.entryId)
        && (!hasPlayerUid() || playerUid == other.playerUid)
        && (!hasGroupId() || groupId == other.groupId)
        && (!hasGroupState() || groupState == other.groupState);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(entryId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt32NoTag(playerUid);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(groupId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 104);
        output.writeUInt32NoTag(groupState);
      }
    }

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

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

    @Override
    public GroupStateInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1591558867:
          case -2093663224: {
            if (input.isAtField(FieldNames.entryId)) {
              if (!input.trySkipNullValue()) {
                entryId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1872053841:
          case 2096182770: {
            if (input.isAtField(FieldNames.playerUid)) {
              if (!input.trySkipNullValue()) {
                playerUid = 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 1271403858:
          case 1101988561: {
            if (input.isAtField(FieldNames.groupState)) {
              if (!input.trySkipNullValue()) {
                groupState = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GroupStateInfoFactory implements MessageFactory<GroupStateInfo> {
      INSTANCE;

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

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

      static final FieldName playerUid = FieldName.forField("playerUid", "player_uid");

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

      static final FieldName groupState = FieldName.forField("groupState", "group_state");
    }
  }
}
