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

    /**
     * <code>optional .RogueStatus status = 7;</code>
     */
    private int status;

    /**
     * <code>optional .RogueMapInfo room_map = 10;</code>
     */
    private final RogueMapInfoOuterClass.RogueMapInfo roomMap = RogueMapInfoOuterClass.RogueMapInfo.newInstance();

    private RogueCurrentInfo() {
    }

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

    /**
     * <code>optional .RogueStatus status = 7;</code>
     * @return whether the status field is set
     */
    public boolean hasStatus() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .RogueStatus status = 7;</code>
     * @return this
     */
    public RogueCurrentInfo clearStatus() {
      bitField0_ &= ~0x00000001;
      status = 0;
      return this;
    }

    /**
     * <code>optional .RogueStatus status = 7;</code>
     * @return the status
     */
    public RogueStatusOuterClass.RogueStatus getStatus() {
      return RogueStatusOuterClass.RogueStatus.forNumber(status);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link RogueCurrentInfo#getStatus()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getStatusValue() {
      return status;
    }

    /**
     * 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 RogueStatusOuterClass.RogueStatus}. Setting an invalid value
     * can cause {@link RogueCurrentInfo#getStatus()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public RogueCurrentInfo setStatusValue(final int value) {
      bitField0_ |= 0x00000001;
      status = value;
      return this;
    }

    /**
     * <code>optional .RogueStatus status = 7;</code>
     * @param value the status to set
     * @return this
     */
    public RogueCurrentInfo setStatus(final RogueStatusOuterClass.RogueStatus value) {
      bitField0_ |= 0x00000001;
      status = value.getNumber();
      return this;
    }

    /**
     * <code>optional .RogueMapInfo room_map = 10;</code>
     * @return whether the roomMap field is set
     */
    public boolean hasRoomMap() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .RogueMapInfo room_map = 10;</code>
     * @return this
     */
    public RogueCurrentInfo clearRoomMap() {
      bitField0_ &= ~0x00000002;
      roomMap.clear();
      return this;
    }

    /**
     * <code>optional .RogueMapInfo room_map = 10;</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 #getMutableRoomMap()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RogueMapInfoOuterClass.RogueMapInfo getRoomMap() {
      return roomMap;
    }

    /**
     * <code>optional .RogueMapInfo room_map = 10;</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 RogueMapInfoOuterClass.RogueMapInfo getMutableRoomMap() {
      bitField0_ |= 0x00000002;
      return roomMap;
    }

    /**
     * <code>optional .RogueMapInfo room_map = 10;</code>
     * @param value the roomMap to set
     * @return this
     */
    public RogueCurrentInfo setRoomMap(final RogueMapInfoOuterClass.RogueMapInfo value) {
      bitField0_ |= 0x00000002;
      roomMap.copyFrom(value);
      return this;
    }

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

    @Override
    public RogueCurrentInfo mergeFrom(final RogueCurrentInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasStatus()) {
        setStatusValue(other.status);
      }
      if (other.hasRoomMap()) {
        getMutableRoomMap().mergeFrom(other.roomMap);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RogueCurrentInfo)) {
        return false;
      }
      RogueCurrentInfo other = (RogueCurrentInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasStatus() || status == other.status)
        && (!hasRoomMap() || roomMap.equals(other.roomMap));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 56);
        output.writeEnumNoTag(status);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 82);
        output.writeMessageNoTag(roomMap);
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public RogueCurrentInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 56: {
            // status
            final int value = input.readInt32();
            if (RogueStatusOuterClass.RogueStatus.forNumber(value) != null) {
              status = value;
              bitField0_ |= 0x00000001;
            }
            tag = input.readTag();
            if (tag != 82) {
              break;
            }
          }
          case 82: {
            // roomMap
            input.readMessage(roomMap);
            bitField0_ |= 0x00000002;
            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.writeEnum(FieldNames.status, status, RogueStatusOuterClass.RogueStatus.converter());
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeMessage(FieldNames.roomMap, roomMap);
      }
      output.endObject();
    }

    @Override
    public RogueCurrentInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -892481550: {
            if (input.isAtField(FieldNames.status)) {
              if (!input.trySkipNullValue()) {
                final RogueStatusOuterClass.RogueStatus value = input.readEnum(RogueStatusOuterClass.RogueStatus.converter());
                if (value != null) {
                  status = value.getNumber();
                  bitField0_ |= 0x00000001;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1379875457:
          case -172986376: {
            if (input.isAtField(FieldNames.roomMap)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(roomMap);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RogueCurrentInfoFactory implements MessageFactory<RogueCurrentInfo> {
      INSTANCE;

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

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

      static final FieldName roomMap = FieldName.forField("roomMap", "room_map");
    }
  }
}
