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

    /**
     * <code>optional uint32 floor_id = 2;</code>
     */
    private int floorId;

    /**
     * <code>optional uint32 game_id = 6;</code>
     */
    private int gameId;

    /**
     * <code>optional uint32 content_id = 14;</code>
     */
    private int contentId;

    private SceneIdentifierInfo() {
    }

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

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

    /**
     * <code>optional uint32 floor_id = 2;</code>
     * @return this
     */
    public SceneIdentifierInfo clearFloorId() {
      bitField0_ &= ~0x00000001;
      floorId = 0;
      return this;
    }

    /**
     * <code>optional uint32 floor_id = 2;</code>
     * @return the floorId
     */
    public int getFloorId() {
      return floorId;
    }

    /**
     * <code>optional uint32 floor_id = 2;</code>
     * @param value the floorId to set
     * @return this
     */
    public SceneIdentifierInfo setFloorId(final int value) {
      bitField0_ |= 0x00000001;
      floorId = value;
      return this;
    }

    /**
     * <code>optional uint32 game_id = 6;</code>
     * @return whether the gameId field is set
     */
    public boolean hasGameId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 game_id = 6;</code>
     * @return this
     */
    public SceneIdentifierInfo clearGameId() {
      bitField0_ &= ~0x00000002;
      gameId = 0;
      return this;
    }

    /**
     * <code>optional uint32 game_id = 6;</code>
     * @return the gameId
     */
    public int getGameId() {
      return gameId;
    }

    /**
     * <code>optional uint32 game_id = 6;</code>
     * @param value the gameId to set
     * @return this
     */
    public SceneIdentifierInfo setGameId(final int value) {
      bitField0_ |= 0x00000002;
      gameId = value;
      return this;
    }

    /**
     * <code>optional uint32 content_id = 14;</code>
     * @return whether the contentId field is set
     */
    public boolean hasContentId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 content_id = 14;</code>
     * @return this
     */
    public SceneIdentifierInfo clearContentId() {
      bitField0_ &= ~0x00000004;
      contentId = 0;
      return this;
    }

    /**
     * <code>optional uint32 content_id = 14;</code>
     * @return the contentId
     */
    public int getContentId() {
      return contentId;
    }

    /**
     * <code>optional uint32 content_id = 14;</code>
     * @param value the contentId to set
     * @return this
     */
    public SceneIdentifierInfo setContentId(final int value) {
      bitField0_ |= 0x00000004;
      contentId = value;
      return this;
    }

    @Override
    public SceneIdentifierInfo copyFrom(final SceneIdentifierInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        floorId = other.floorId;
        gameId = other.gameId;
        contentId = other.contentId;
      }
      return this;
    }

    @Override
    public SceneIdentifierInfo mergeFrom(final SceneIdentifierInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasFloorId()) {
        setFloorId(other.floorId);
      }
      if (other.hasGameId()) {
        setGameId(other.gameId);
      }
      if (other.hasContentId()) {
        setContentId(other.contentId);
      }
      return this;
    }

    @Override
    public SceneIdentifierInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      floorId = 0;
      gameId = 0;
      contentId = 0;
      return this;
    }

    @Override
    public SceneIdentifierInfo 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 SceneIdentifierInfo)) {
        return false;
      }
      SceneIdentifierInfo other = (SceneIdentifierInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasFloorId() || floorId == other.floorId)
        && (!hasGameId() || gameId == other.gameId)
        && (!hasContentId() || contentId == other.contentId);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(floorId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(gameId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(contentId);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(floorId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(gameId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(contentId);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public SceneIdentifierInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // floorId
            floorId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // gameId
            gameId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // contentId
            contentId = input.readUInt32();
            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.floorId, floorId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.gameId, gameId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.contentId, contentId);
      }
      output.endObject();
    }

    @Override
    public SceneIdentifierInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -766027193:
          case 2022982190: {
            if (input.isAtField(FieldNames.floorId)) {
              if (!input.trySkipNullValue()) {
                floorId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1253236563:
          case -195606392: {
            if (input.isAtField(FieldNames.gameId)) {
              if (!input.trySkipNullValue()) {
                gameId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -407108748:
          case 264552097: {
            if (input.isAtField(FieldNames.contentId)) {
              if (!input.trySkipNullValue()) {
                contentId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum SceneIdentifierInfoFactory implements MessageFactory<SceneIdentifierInfo> {
      INSTANCE;

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

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

      static final FieldName gameId = FieldName.forField("gameId", "game_id");

      static final FieldName contentId = FieldName.forField("contentId", "content_id");
    }
  }
}
