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

    /**
     * <code>optional uint32 world_level = 2;</code>
     */
    private int worldLevel;

    /**
     * <code>optional uint32 wave = 4;</code>
     */
    private int wave;

    /**
     * <code>optional uint32 wave_count = 5;</code>
     */
    private int waveCount;

    /**
     * <code>optional uint32 cocoon_id = 12;</code>
     */
    private int cocoonId;

    private QuickStartCocoonStageCsReq() {
    }

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

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

    /**
     * <code>optional uint32 world_level = 2;</code>
     * @return this
     */
    public QuickStartCocoonStageCsReq clearWorldLevel() {
      bitField0_ &= ~0x00000001;
      worldLevel = 0;
      return this;
    }

    /**
     * <code>optional uint32 world_level = 2;</code>
     * @return the worldLevel
     */
    public int getWorldLevel() {
      return worldLevel;
    }

    /**
     * <code>optional uint32 world_level = 2;</code>
     * @param value the worldLevel to set
     * @return this
     */
    public QuickStartCocoonStageCsReq setWorldLevel(final int value) {
      bitField0_ |= 0x00000001;
      worldLevel = value;
      return this;
    }

    /**
     * <code>optional uint32 wave = 4;</code>
     * @return whether the wave field is set
     */
    public boolean hasWave() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 wave = 4;</code>
     * @return this
     */
    public QuickStartCocoonStageCsReq clearWave() {
      bitField0_ &= ~0x00000002;
      wave = 0;
      return this;
    }

    /**
     * <code>optional uint32 wave = 4;</code>
     * @return the wave
     */
    public int getWave() {
      return wave;
    }

    /**
     * <code>optional uint32 wave = 4;</code>
     * @param value the wave to set
     * @return this
     */
    public QuickStartCocoonStageCsReq setWave(final int value) {
      bitField0_ |= 0x00000002;
      wave = value;
      return this;
    }

    /**
     * <code>optional uint32 wave_count = 5;</code>
     * @return whether the waveCount field is set
     */
    public boolean hasWaveCount() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 wave_count = 5;</code>
     * @return this
     */
    public QuickStartCocoonStageCsReq clearWaveCount() {
      bitField0_ &= ~0x00000004;
      waveCount = 0;
      return this;
    }

    /**
     * <code>optional uint32 wave_count = 5;</code>
     * @return the waveCount
     */
    public int getWaveCount() {
      return waveCount;
    }

    /**
     * <code>optional uint32 wave_count = 5;</code>
     * @param value the waveCount to set
     * @return this
     */
    public QuickStartCocoonStageCsReq setWaveCount(final int value) {
      bitField0_ |= 0x00000004;
      waveCount = value;
      return this;
    }

    /**
     * <code>optional uint32 cocoon_id = 12;</code>
     * @return whether the cocoonId field is set
     */
    public boolean hasCocoonId() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 cocoon_id = 12;</code>
     * @return this
     */
    public QuickStartCocoonStageCsReq clearCocoonId() {
      bitField0_ &= ~0x00000008;
      cocoonId = 0;
      return this;
    }

    /**
     * <code>optional uint32 cocoon_id = 12;</code>
     * @return the cocoonId
     */
    public int getCocoonId() {
      return cocoonId;
    }

    /**
     * <code>optional uint32 cocoon_id = 12;</code>
     * @param value the cocoonId to set
     * @return this
     */
    public QuickStartCocoonStageCsReq setCocoonId(final int value) {
      bitField0_ |= 0x00000008;
      cocoonId = value;
      return this;
    }

    @Override
    public QuickStartCocoonStageCsReq copyFrom(final QuickStartCocoonStageCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        worldLevel = other.worldLevel;
        wave = other.wave;
        waveCount = other.waveCount;
        cocoonId = other.cocoonId;
      }
      return this;
    }

    @Override
    public QuickStartCocoonStageCsReq mergeFrom(final QuickStartCocoonStageCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasWorldLevel()) {
        setWorldLevel(other.worldLevel);
      }
      if (other.hasWave()) {
        setWave(other.wave);
      }
      if (other.hasWaveCount()) {
        setWaveCount(other.waveCount);
      }
      if (other.hasCocoonId()) {
        setCocoonId(other.cocoonId);
      }
      return this;
    }

    @Override
    public QuickStartCocoonStageCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      worldLevel = 0;
      wave = 0;
      waveCount = 0;
      cocoonId = 0;
      return this;
    }

    @Override
    public QuickStartCocoonStageCsReq 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 QuickStartCocoonStageCsReq)) {
        return false;
      }
      QuickStartCocoonStageCsReq other = (QuickStartCocoonStageCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasWorldLevel() || worldLevel == other.worldLevel)
        && (!hasWave() || wave == other.wave)
        && (!hasWaveCount() || waveCount == other.waveCount)
        && (!hasCocoonId() || cocoonId == other.cocoonId);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(worldLevel);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(wave);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(waveCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(cocoonId);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(worldLevel);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(wave);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(waveCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(cocoonId);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public QuickStartCocoonStageCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // worldLevel
            worldLevel = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // wave
            wave = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // waveCount
            waveCount = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 96) {
              break;
            }
          }
          case 96: {
            // cocoonId
            cocoonId = input.readUInt32();
            bitField0_ |= 0x00000008;
            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.worldLevel, worldLevel);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.wave, wave);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.waveCount, waveCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.cocoonId, cocoonId);
      }
      output.endObject();
    }

    @Override
    public QuickStartCocoonStageCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 440007442:
          case 1305257111: {
            if (input.isAtField(FieldNames.worldLevel)) {
              if (!input.trySkipNullValue()) {
                worldLevel = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 3642105: {
            if (input.isAtField(FieldNames.wave)) {
              if (!input.trySkipNullValue()) {
                wave = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1518256534:
          case 611674185: {
            if (input.isAtField(FieldNames.waveCount)) {
              if (!input.trySkipNullValue()) {
                waveCount = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -886563534:
          case -1713644381: {
            if (input.isAtField(FieldNames.cocoonId)) {
              if (!input.trySkipNullValue()) {
                cocoonId = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum QuickStartCocoonStageCsReqFactory implements MessageFactory<QuickStartCocoonStageCsReq> {
      INSTANCE;

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

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

      static final FieldName wave = FieldName.forField("wave");

      static final FieldName waveCount = FieldName.forField("waveCount", "wave_count");

      static final FieldName cocoonId = FieldName.forField("cocoonId", "cocoon_id");
    }
  }
}
