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

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

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

    private EnterRogueMapRoomCsReq() {
    }

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

    /**
     * <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 EnterRogueMapRoomCsReq 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 EnterRogueMapRoomCsReq setRoomId(final int value) {
      bitField0_ |= 0x00000001;
      roomId = value;
      return this;
    }

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

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

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

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

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

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

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

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

    @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) 80);
        output.writeUInt32NoTag(siteId);
      }
    }

    @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);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public EnterRogueMapRoomCsReq 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 != 80) {
              break;
            }
          }
          case 80: {
            // siteId
            siteId = input.readUInt32();
            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.writeUInt32(FieldNames.roomId, roomId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.siteId, siteId);
      }
      output.endObject();
    }

    @Override
    public EnterRogueMapRoomCsReq 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;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum EnterRogueMapRoomCsReqFactory implements MessageFactory<EnterRogueMapRoomCsReq> {
      INSTANCE;

      @Override
      public EnterRogueMapRoomCsReq create() {
        return EnterRogueMapRoomCsReq.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");
    }
  }
}
