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

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

    /**
     * <code>optional uint32 cur_site_id = 2;</code>
     */
    private int curSiteId;

    /**
     * <code>optional uint32 cur_room_id = 5;</code>
     */
    private int curRoomId;

    /**
     * <code>optional uint32 map_id = 6;</code>
     */
    private int mapId;

    /**
     * <code>optional uint32 area_id = 10;</code>
     */
    private int areaId;

    /**
     * <code>repeated .RogueRoom room_list = 9;</code>
     */
    private final RepeatedMessage<RogueRoomOuterClass.RogueRoom> roomList = RepeatedMessage.newEmptyInstance(RogueRoomOuterClass.RogueRoom.getFactory());

    private RogueMapInfo() {
    }

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

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

    /**
     * <code>optional uint32 cur_site_id = 2;</code>
     * @return this
     */
    public RogueMapInfo clearCurSiteId() {
      bitField0_ &= ~0x00000001;
      curSiteId = 0;
      return this;
    }

    /**
     * <code>optional uint32 cur_site_id = 2;</code>
     * @return the curSiteId
     */
    public int getCurSiteId() {
      return curSiteId;
    }

    /**
     * <code>optional uint32 cur_site_id = 2;</code>
     * @param value the curSiteId to set
     * @return this
     */
    public RogueMapInfo setCurSiteId(final int value) {
      bitField0_ |= 0x00000001;
      curSiteId = value;
      return this;
    }

    /**
     * <code>optional uint32 cur_room_id = 5;</code>
     * @return whether the curRoomId field is set
     */
    public boolean hasCurRoomId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 cur_room_id = 5;</code>
     * @return this
     */
    public RogueMapInfo clearCurRoomId() {
      bitField0_ &= ~0x00000002;
      curRoomId = 0;
      return this;
    }

    /**
     * <code>optional uint32 cur_room_id = 5;</code>
     * @return the curRoomId
     */
    public int getCurRoomId() {
      return curRoomId;
    }

    /**
     * <code>optional uint32 cur_room_id = 5;</code>
     * @param value the curRoomId to set
     * @return this
     */
    public RogueMapInfo setCurRoomId(final int value) {
      bitField0_ |= 0x00000002;
      curRoomId = value;
      return this;
    }

    /**
     * <code>optional uint32 map_id = 6;</code>
     * @return whether the mapId field is set
     */
    public boolean hasMapId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 map_id = 6;</code>
     * @return this
     */
    public RogueMapInfo clearMapId() {
      bitField0_ &= ~0x00000004;
      mapId = 0;
      return this;
    }

    /**
     * <code>optional uint32 map_id = 6;</code>
     * @return the mapId
     */
    public int getMapId() {
      return mapId;
    }

    /**
     * <code>optional uint32 map_id = 6;</code>
     * @param value the mapId to set
     * @return this
     */
    public RogueMapInfo setMapId(final int value) {
      bitField0_ |= 0x00000004;
      mapId = value;
      return this;
    }

    /**
     * <code>optional uint32 area_id = 10;</code>
     * @return whether the areaId field is set
     */
    public boolean hasAreaId() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 area_id = 10;</code>
     * @return this
     */
    public RogueMapInfo clearAreaId() {
      bitField0_ &= ~0x00000008;
      areaId = 0;
      return this;
    }

    /**
     * <code>optional uint32 area_id = 10;</code>
     * @return the areaId
     */
    public int getAreaId() {
      return areaId;
    }

    /**
     * <code>optional uint32 area_id = 10;</code>
     * @param value the areaId to set
     * @return this
     */
    public RogueMapInfo setAreaId(final int value) {
      bitField0_ |= 0x00000008;
      areaId = value;
      return this;
    }

    /**
     * <code>repeated .RogueRoom room_list = 9;</code>
     * @return whether the roomList field is set
     */
    public boolean hasRoomList() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>repeated .RogueRoom room_list = 9;</code>
     * @return this
     */
    public RogueMapInfo clearRoomList() {
      bitField0_ &= ~0x00000010;
      roomList.clear();
      return this;
    }

    /**
     * <code>repeated .RogueRoom room_list = 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 #getMutableRoomList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<RogueRoomOuterClass.RogueRoom> getRoomList() {
      return roomList;
    }

    /**
     * <code>repeated .RogueRoom room_list = 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 RepeatedMessage<RogueRoomOuterClass.RogueRoom> getMutableRoomList() {
      bitField0_ |= 0x00000010;
      return roomList;
    }

    /**
     * <code>repeated .RogueRoom room_list = 9;</code>
     * @param value the roomList to add
     * @return this
     */
    public RogueMapInfo addRoomList(final RogueRoomOuterClass.RogueRoom value) {
      bitField0_ |= 0x00000010;
      roomList.add(value);
      return this;
    }

    /**
     * <code>repeated .RogueRoom room_list = 9;</code>
     * @param values the roomList to add
     * @return this
     */
    public RogueMapInfo addAllRoomList(final RogueRoomOuterClass.RogueRoom... values) {
      bitField0_ |= 0x00000010;
      roomList.addAll(values);
      return this;
    }

    @Override
    public RogueMapInfo copyFrom(final RogueMapInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        curSiteId = other.curSiteId;
        curRoomId = other.curRoomId;
        mapId = other.mapId;
        areaId = other.areaId;
        roomList.copyFrom(other.roomList);
      }
      return this;
    }

    @Override
    public RogueMapInfo mergeFrom(final RogueMapInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasCurSiteId()) {
        setCurSiteId(other.curSiteId);
      }
      if (other.hasCurRoomId()) {
        setCurRoomId(other.curRoomId);
      }
      if (other.hasMapId()) {
        setMapId(other.mapId);
      }
      if (other.hasAreaId()) {
        setAreaId(other.areaId);
      }
      if (other.hasRoomList()) {
        getMutableRoomList().addAll(other.roomList);
      }
      return this;
    }

    @Override
    public RogueMapInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      curSiteId = 0;
      curRoomId = 0;
      mapId = 0;
      areaId = 0;
      roomList.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RogueMapInfo)) {
        return false;
      }
      RogueMapInfo other = (RogueMapInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasCurSiteId() || curSiteId == other.curSiteId)
        && (!hasCurRoomId() || curRoomId == other.curRoomId)
        && (!hasMapId() || mapId == other.mapId)
        && (!hasAreaId() || areaId == other.areaId)
        && (!hasRoomList() || roomList.equals(other.roomList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(curSiteId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(curRoomId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(mapId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 80);
        output.writeUInt32NoTag(areaId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        for (int i = 0; i < roomList.length(); i++) {
          output.writeRawByte((byte) 74);
          output.writeMessageNoTag(roomList.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(curSiteId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(curRoomId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(mapId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(areaId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += (1 * roomList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(roomList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RogueMapInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // curSiteId
            curSiteId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // curRoomId
            curRoomId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // mapId
            mapId = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 80) {
              break;
            }
          }
          case 80: {
            // areaId
            areaId = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 74) {
              break;
            }
          }
          case 74: {
            // roomList
            tag = input.readRepeatedMessage(roomList, tag);
            bitField0_ |= 0x00000010;
            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.curSiteId, curSiteId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.curRoomId, curRoomId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.mapId, mapId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.areaId, areaId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRepeatedMessage(FieldNames.roomList, roomList);
      }
      output.endObject();
    }

    @Override
    public RogueMapInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -226037470:
          case 1245078036: {
            if (input.isAtField(FieldNames.curSiteId)) {
              if (!input.trySkipNullValue()) {
                curSiteId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -249266762:
          case 524969984: {
            if (input.isAtField(FieldNames.curRoomId)) {
              if (!input.trySkipNullValue()) {
                curRoomId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 103663511:
          case -1081377058: {
            if (input.isAtField(FieldNames.mapId)) {
              if (!input.trySkipNullValue()) {
                mapId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1409553784:
          case -746472947: {
            if (input.isAtField(FieldNames.areaId)) {
              if (!input.trySkipNullValue()) {
                areaId = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -173555687:
          case -1067632254: {
            if (input.isAtField(FieldNames.roomList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(roomList);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RogueMapInfoFactory implements MessageFactory<RogueMapInfo> {
      INSTANCE;

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

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

      static final FieldName curRoomId = FieldName.forField("curRoomId", "cur_room_id");

      static final FieldName mapId = FieldName.forField("mapId", "map_id");

      static final FieldName areaId = FieldName.forField("areaId", "area_id");

      static final FieldName roomList = FieldName.forField("roomList", "room_list");
    }
  }
}
