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

    /**
     * <code>optional uint32 room_id = 7;</code>
     */
    private int roomId;

    /**
     * <code>optional uint32 site_id = 14;</code>
     */
    private int siteId;

    /**
     * <code>optional .RogueRoomStatus room_status = 2;</code>
     */
    private int roomStatus;

    private RogueRoom() {
    }

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

    /**
     * <code>optional uint32 room_id = 7;</code>
     * @return whether the roomId field is set
     */
    public boolean hasRoomId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 room_id = 7;</code>
     * @return this
     */
    public RogueRoom clearRoomId() {
      bitField0_ &= ~0x00000001;
      roomId = 0;
      return this;
    }

    /**
     * <code>optional uint32 room_id = 7;</code>
     * @return the roomId
     */
    public int getRoomId() {
      return roomId;
    }

    /**
     * <code>optional uint32 room_id = 7;</code>
     * @param value the roomId to set
     * @return this
     */
    public RogueRoom setRoomId(final int value) {
      bitField0_ |= 0x00000001;
      roomId = value;
      return this;
    }

    /**
     * <code>optional uint32 site_id = 14;</code>
     * @return whether the siteId field is set
     */
    public boolean hasSiteId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 site_id = 14;</code>
     * @return this
     */
    public RogueRoom clearSiteId() {
      bitField0_ &= ~0x00000002;
      siteId = 0;
      return this;
    }

    /**
     * <code>optional uint32 site_id = 14;</code>
     * @return the siteId
     */
    public int getSiteId() {
      return siteId;
    }

    /**
     * <code>optional uint32 site_id = 14;</code>
     * @param value the siteId to set
     * @return this
     */
    public RogueRoom setSiteId(final int value) {
      bitField0_ |= 0x00000002;
      siteId = value;
      return this;
    }

    /**
     * <code>optional .RogueRoomStatus room_status = 2;</code>
     * @return whether the roomStatus field is set
     */
    public boolean hasRoomStatus() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .RogueRoomStatus room_status = 2;</code>
     * @return this
     */
    public RogueRoom clearRoomStatus() {
      bitField0_ &= ~0x00000004;
      roomStatus = 0;
      return this;
    }

    /**
     * <code>optional .RogueRoomStatus room_status = 2;</code>
     * @return the roomStatus
     */
    public RogueRoomStatusOuterClass.RogueRoomStatus getRoomStatus() {
      return RogueRoomStatusOuterClass.RogueRoomStatus.forNumber(roomStatus);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link RogueRoom#getRoomStatus()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getRoomStatusValue() {
      return roomStatus;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link RogueRoomStatusOuterClass.RogueRoomStatus}. Setting an invalid value
     * can cause {@link RogueRoom#getRoomStatus()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public RogueRoom setRoomStatusValue(final int value) {
      bitField0_ |= 0x00000004;
      roomStatus = value;
      return this;
    }

    /**
     * <code>optional .RogueRoomStatus room_status = 2;</code>
     * @param value the roomStatus to set
     * @return this
     */
    public RogueRoom setRoomStatus(final RogueRoomStatusOuterClass.RogueRoomStatus value) {
      bitField0_ |= 0x00000004;
      roomStatus = value.getNumber();
      return this;
    }

    @Override
    public RogueRoom copyFrom(final RogueRoom other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        roomId = other.roomId;
        siteId = other.siteId;
        roomStatus = other.roomStatus;
      }
      return this;
    }

    @Override
    public RogueRoom mergeFrom(final RogueRoom other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRoomId()) {
        setRoomId(other.roomId);
      }
      if (other.hasSiteId()) {
        setSiteId(other.siteId);
      }
      if (other.hasRoomStatus()) {
        setRoomStatusValue(other.roomStatus);
      }
      return this;
    }

    @Override
    public RogueRoom clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      roomId = 0;
      siteId = 0;
      roomStatus = 0;
      return this;
    }

    @Override
    public RogueRoom 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 RogueRoom)) {
        return false;
      }
      RogueRoom other = (RogueRoom) o;
      return bitField0_ == other.bitField0_
        && (!hasRoomId() || roomId == other.roomId)
        && (!hasSiteId() || siteId == other.siteId)
        && (!hasRoomStatus() || roomStatus == other.roomStatus);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(roomId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(siteId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 16);
        output.writeEnumNoTag(roomStatus);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(roomId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(siteId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(roomStatus);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RogueRoom mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 56: {
            // roomId
            roomId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // siteId
            siteId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // roomStatus
            final int value = input.readInt32();
            if (RogueRoomStatusOuterClass.RogueRoomStatus.forNumber(value) != null) {
              roomStatus = value;
              bitField0_ |= 0x00000004;
            }
            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.roomId, roomId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.siteId, siteId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeEnum(FieldNames.roomStatus, roomStatus, RogueRoomStatusOuterClass.RogueRoomStatus.converter());
      }
      output.endObject();
    }

    @Override
    public RogueRoom mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -925319338:
          case 1379892991: {
            if (input.isAtField(FieldNames.roomId)) {
              if (!input.trySkipNullValue()) {
                roomId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -902090046:
          case 2100001043: {
            if (input.isAtField(FieldNames.siteId)) {
              if (!input.trySkipNullValue()) {
                siteId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 926739629:
          case 712617942: {
            if (input.isAtField(FieldNames.roomStatus)) {
              if (!input.trySkipNullValue()) {
                final RogueRoomStatusOuterClass.RogueRoomStatus value = input.readEnum(RogueRoomStatusOuterClass.RogueRoomStatus.converter());
                if (value != null) {
                  roomStatus = value.getNumber();
                  bitField0_ |= 0x00000004;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RogueRoomFactory implements MessageFactory<RogueRoom> {
      INSTANCE;

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

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

      static final FieldName siteId = FieldName.forField("siteId", "site_id");

      static final FieldName roomStatus = FieldName.forField("roomStatus", "room_status");
    }
  }
}
