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

    /**
     * <code>optional uint32 max_score = 3;</code>
     */
    private int maxScore;

    /**
     * <code>optional uint32 buff_id = 8;</code>
     */
    private int buffId;

    /**
     * <code>optional bool is_win = 4;</code>
     */
    private boolean isWin;

    /**
     * <code>optional bool has_been_challenged = 7;</code>
     */
    private boolean hasBeenChallenged;

    private ChallengeBossSingleNodeInfo() {
    }

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

    /**
     * <code>optional uint32 max_score = 3;</code>
     * @return whether the maxScore field is set
     */
    public boolean hasMaxScore() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 max_score = 3;</code>
     * @return this
     */
    public ChallengeBossSingleNodeInfo clearMaxScore() {
      bitField0_ &= ~0x00000001;
      maxScore = 0;
      return this;
    }

    /**
     * <code>optional uint32 max_score = 3;</code>
     * @return the maxScore
     */
    public int getMaxScore() {
      return maxScore;
    }

    /**
     * <code>optional uint32 max_score = 3;</code>
     * @param value the maxScore to set
     * @return this
     */
    public ChallengeBossSingleNodeInfo setMaxScore(final int value) {
      bitField0_ |= 0x00000001;
      maxScore = value;
      return this;
    }

    /**
     * <code>optional uint32 buff_id = 8;</code>
     * @return whether the buffId field is set
     */
    public boolean hasBuffId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 buff_id = 8;</code>
     * @return this
     */
    public ChallengeBossSingleNodeInfo clearBuffId() {
      bitField0_ &= ~0x00000002;
      buffId = 0;
      return this;
    }

    /**
     * <code>optional uint32 buff_id = 8;</code>
     * @return the buffId
     */
    public int getBuffId() {
      return buffId;
    }

    /**
     * <code>optional uint32 buff_id = 8;</code>
     * @param value the buffId to set
     * @return this
     */
    public ChallengeBossSingleNodeInfo setBuffId(final int value) {
      bitField0_ |= 0x00000002;
      buffId = value;
      return this;
    }

    /**
     * <code>optional bool is_win = 4;</code>
     * @return whether the isWin field is set
     */
    public boolean hasIsWin() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional bool is_win = 4;</code>
     * @return this
     */
    public ChallengeBossSingleNodeInfo clearIsWin() {
      bitField0_ &= ~0x00000004;
      isWin = false;
      return this;
    }

    /**
     * <code>optional bool is_win = 4;</code>
     * @return the isWin
     */
    public boolean getIsWin() {
      return isWin;
    }

    /**
     * <code>optional bool is_win = 4;</code>
     * @param value the isWin to set
     * @return this
     */
    public ChallengeBossSingleNodeInfo setIsWin(final boolean value) {
      bitField0_ |= 0x00000004;
      isWin = value;
      return this;
    }

    /**
     * <code>optional bool has_been_challenged = 7;</code>
     * @return whether the hasBeenChallenged field is set
     */
    public boolean hasHasBeenChallenged() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bool has_been_challenged = 7;</code>
     * @return this
     */
    public ChallengeBossSingleNodeInfo clearHasBeenChallenged() {
      bitField0_ &= ~0x00000008;
      hasBeenChallenged = false;
      return this;
    }

    /**
     * <code>optional bool has_been_challenged = 7;</code>
     * @return the hasBeenChallenged
     */
    public boolean getHasBeenChallenged() {
      return hasBeenChallenged;
    }

    /**
     * <code>optional bool has_been_challenged = 7;</code>
     * @param value the hasBeenChallenged to set
     * @return this
     */
    public ChallengeBossSingleNodeInfo setHasBeenChallenged(final boolean value) {
      bitField0_ |= 0x00000008;
      hasBeenChallenged = value;
      return this;
    }

    @Override
    public ChallengeBossSingleNodeInfo copyFrom(final ChallengeBossSingleNodeInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        maxScore = other.maxScore;
        buffId = other.buffId;
        isWin = other.isWin;
        hasBeenChallenged = other.hasBeenChallenged;
      }
      return this;
    }

    @Override
    public ChallengeBossSingleNodeInfo mergeFrom(final ChallengeBossSingleNodeInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasMaxScore()) {
        setMaxScore(other.maxScore);
      }
      if (other.hasBuffId()) {
        setBuffId(other.buffId);
      }
      if (other.hasIsWin()) {
        setIsWin(other.isWin);
      }
      if (other.hasHasBeenChallenged()) {
        setHasBeenChallenged(other.hasBeenChallenged);
      }
      return this;
    }

    @Override
    public ChallengeBossSingleNodeInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      maxScore = 0;
      buffId = 0;
      isWin = false;
      hasBeenChallenged = false;
      return this;
    }

    @Override
    public ChallengeBossSingleNodeInfo 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 ChallengeBossSingleNodeInfo)) {
        return false;
      }
      ChallengeBossSingleNodeInfo other = (ChallengeBossSingleNodeInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasMaxScore() || maxScore == other.maxScore)
        && (!hasBuffId() || buffId == other.buffId)
        && (!hasIsWin() || isWin == other.isWin)
        && (!hasHasBeenChallenged() || hasBeenChallenged == other.hasBeenChallenged);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(maxScore);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt32NoTag(buffId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 32);
        output.writeBoolNoTag(isWin);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 56);
        output.writeBoolNoTag(hasBeenChallenged);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(maxScore);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(buffId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2;
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ChallengeBossSingleNodeInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // maxScore
            maxScore = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 64) {
              break;
            }
          }
          case 64: {
            // buffId
            buffId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // isWin
            isWin = input.readBool();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // hasBeenChallenged
            hasBeenChallenged = input.readBool();
            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.maxScore, maxScore);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.buffId, buffId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBool(FieldNames.isWin, isWin);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBool(FieldNames.hasBeenChallenged, hasBeenChallenged);
      }
      output.endObject();
    }

    @Override
    public ChallengeBossSingleNodeInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 396519310:
          case -234837001: {
            if (input.isAtField(FieldNames.maxScore)) {
              if (!input.trySkipNullValue()) {
                maxScore = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1378119474:
          case 227990663: {
            if (input.isAtField(FieldNames.buffId)) {
              if (!input.trySkipNullValue()) {
                buffId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 100482642:
          case -1179753657: {
            if (input.isAtField(FieldNames.isWin)) {
              if (!input.trySkipNullValue()) {
                isWin = input.readBool();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1986428185:
          case 1158132399: {
            if (input.isAtField(FieldNames.hasBeenChallenged)) {
              if (!input.trySkipNullValue()) {
                hasBeenChallenged = input.readBool();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ChallengeBossSingleNodeInfoFactory implements MessageFactory<ChallengeBossSingleNodeInfo> {
      INSTANCE;

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

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

      static final FieldName buffId = FieldName.forField("buffId", "buff_id");

      static final FieldName isWin = FieldName.forField("isWin", "is_win");

      static final FieldName hasBeenChallenged = FieldName.forField("hasBeenChallenged", "has_been_challenged");
    }
  }
}
