// 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;
import us.hebi.quickbuf.RepeatedInt;

public final class RogueScoreRewardInfoOuterClass {
  /**
   * Protobuf type {@code RogueScoreRewardInfo}
   */
  public static final class RogueScoreRewardInfo extends ProtoMessage<RogueScoreRewardInfo> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional uint32 rogue_immersifier = 3;</code>
     */
    private int rogueImmersifier;

    /**
     * <code>optional uint32 pool_id = 7;</code>
     */
    private int poolId;

    /**
     * <code>optional uint32 score = 9;</code>
     */
    private int score;

    /**
     * <code>optional bool has_taken_initial_score = 1;</code>
     */
    private boolean hasTakenInitialScore;

    /**
     * <code>optional bool pool_refreshed = 6;</code>
     */
    private boolean poolRefreshed;

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</code>
     */
    private final RepeatedInt takenScoreRewardList = RepeatedInt.newEmptyInstance();

    private RogueScoreRewardInfo() {
    }

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

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

    /**
     * <code>optional uint32 rogue_immersifier = 3;</code>
     * @return this
     */
    public RogueScoreRewardInfo clearRogueImmersifier() {
      bitField0_ &= ~0x00000001;
      rogueImmersifier = 0;
      return this;
    }

    /**
     * <code>optional uint32 rogue_immersifier = 3;</code>
     * @return the rogueImmersifier
     */
    public int getRogueImmersifier() {
      return rogueImmersifier;
    }

    /**
     * <code>optional uint32 rogue_immersifier = 3;</code>
     * @param value the rogueImmersifier to set
     * @return this
     */
    public RogueScoreRewardInfo setRogueImmersifier(final int value) {
      bitField0_ |= 0x00000001;
      rogueImmersifier = value;
      return this;
    }

    /**
     * <code>optional uint32 pool_id = 7;</code>
     * @return whether the poolId field is set
     */
    public boolean hasPoolId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 pool_id = 7;</code>
     * @return this
     */
    public RogueScoreRewardInfo clearPoolId() {
      bitField0_ &= ~0x00000002;
      poolId = 0;
      return this;
    }

    /**
     * <code>optional uint32 pool_id = 7;</code>
     * @return the poolId
     */
    public int getPoolId() {
      return poolId;
    }

    /**
     * <code>optional uint32 pool_id = 7;</code>
     * @param value the poolId to set
     * @return this
     */
    public RogueScoreRewardInfo setPoolId(final int value) {
      bitField0_ |= 0x00000002;
      poolId = value;
      return this;
    }

    /**
     * <code>optional uint32 score = 9;</code>
     * @return whether the score field is set
     */
    public boolean hasScore() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 score = 9;</code>
     * @return this
     */
    public RogueScoreRewardInfo clearScore() {
      bitField0_ &= ~0x00000004;
      score = 0;
      return this;
    }

    /**
     * <code>optional uint32 score = 9;</code>
     * @return the score
     */
    public int getScore() {
      return score;
    }

    /**
     * <code>optional uint32 score = 9;</code>
     * @param value the score to set
     * @return this
     */
    public RogueScoreRewardInfo setScore(final int value) {
      bitField0_ |= 0x00000004;
      score = value;
      return this;
    }

    /**
     * <code>optional bool has_taken_initial_score = 1;</code>
     * @return whether the hasTakenInitialScore field is set
     */
    public boolean hasHasTakenInitialScore() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bool has_taken_initial_score = 1;</code>
     * @return this
     */
    public RogueScoreRewardInfo clearHasTakenInitialScore() {
      bitField0_ &= ~0x00000008;
      hasTakenInitialScore = false;
      return this;
    }

    /**
     * <code>optional bool has_taken_initial_score = 1;</code>
     * @return the hasTakenInitialScore
     */
    public boolean getHasTakenInitialScore() {
      return hasTakenInitialScore;
    }

    /**
     * <code>optional bool has_taken_initial_score = 1;</code>
     * @param value the hasTakenInitialScore to set
     * @return this
     */
    public RogueScoreRewardInfo setHasTakenInitialScore(final boolean value) {
      bitField0_ |= 0x00000008;
      hasTakenInitialScore = value;
      return this;
    }

    /**
     * <code>optional bool pool_refreshed = 6;</code>
     * @return whether the poolRefreshed field is set
     */
    public boolean hasPoolRefreshed() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional bool pool_refreshed = 6;</code>
     * @return this
     */
    public RogueScoreRewardInfo clearPoolRefreshed() {
      bitField0_ &= ~0x00000010;
      poolRefreshed = false;
      return this;
    }

    /**
     * <code>optional bool pool_refreshed = 6;</code>
     * @return the poolRefreshed
     */
    public boolean getPoolRefreshed() {
      return poolRefreshed;
    }

    /**
     * <code>optional bool pool_refreshed = 6;</code>
     * @param value the poolRefreshed to set
     * @return this
     */
    public RogueScoreRewardInfo setPoolRefreshed(final boolean value) {
      bitField0_ |= 0x00000010;
      poolRefreshed = value;
      return this;
    }

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</code>
     * @return whether the takenScoreRewardList field is set
     */
    public boolean hasTakenScoreRewardList() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</code>
     * @return this
     */
    public RogueScoreRewardInfo clearTakenScoreRewardList() {
      bitField0_ &= ~0x00000020;
      takenScoreRewardList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</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 #getMutableTakenScoreRewardList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getTakenScoreRewardList() {
      return takenScoreRewardList;
    }

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</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 RepeatedInt getMutableTakenScoreRewardList() {
      bitField0_ |= 0x00000020;
      return takenScoreRewardList;
    }

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</code>
     * @param value the takenScoreRewardList to add
     * @return this
     */
    public RogueScoreRewardInfo addTakenScoreRewardList(final int value) {
      bitField0_ |= 0x00000020;
      takenScoreRewardList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 taken_score_reward_list = 4;</code>
     * @param values the takenScoreRewardList to add
     * @return this
     */
    public RogueScoreRewardInfo addAllTakenScoreRewardList(final int... values) {
      bitField0_ |= 0x00000020;
      takenScoreRewardList.addAll(values);
      return this;
    }

    @Override
    public RogueScoreRewardInfo copyFrom(final RogueScoreRewardInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        rogueImmersifier = other.rogueImmersifier;
        poolId = other.poolId;
        score = other.score;
        hasTakenInitialScore = other.hasTakenInitialScore;
        poolRefreshed = other.poolRefreshed;
        takenScoreRewardList.copyFrom(other.takenScoreRewardList);
      }
      return this;
    }

    @Override
    public RogueScoreRewardInfo mergeFrom(final RogueScoreRewardInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRogueImmersifier()) {
        setRogueImmersifier(other.rogueImmersifier);
      }
      if (other.hasPoolId()) {
        setPoolId(other.poolId);
      }
      if (other.hasScore()) {
        setScore(other.score);
      }
      if (other.hasHasTakenInitialScore()) {
        setHasTakenInitialScore(other.hasTakenInitialScore);
      }
      if (other.hasPoolRefreshed()) {
        setPoolRefreshed(other.poolRefreshed);
      }
      if (other.hasTakenScoreRewardList()) {
        getMutableTakenScoreRewardList().addAll(other.takenScoreRewardList);
      }
      return this;
    }

    @Override
    public RogueScoreRewardInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      rogueImmersifier = 0;
      poolId = 0;
      score = 0;
      hasTakenInitialScore = false;
      poolRefreshed = false;
      takenScoreRewardList.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RogueScoreRewardInfo)) {
        return false;
      }
      RogueScoreRewardInfo other = (RogueScoreRewardInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasRogueImmersifier() || rogueImmersifier == other.rogueImmersifier)
        && (!hasPoolId() || poolId == other.poolId)
        && (!hasScore() || score == other.score)
        && (!hasHasTakenInitialScore() || hasTakenInitialScore == other.hasTakenInitialScore)
        && (!hasPoolRefreshed() || poolRefreshed == other.poolRefreshed)
        && (!hasTakenScoreRewardList() || takenScoreRewardList.equals(other.takenScoreRewardList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(rogueImmersifier);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(poolId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 72);
        output.writeUInt32NoTag(score);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 8);
        output.writeBoolNoTag(hasTakenInitialScore);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 48);
        output.writeBoolNoTag(poolRefreshed);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        for (int i = 0; i < takenScoreRewardList.length(); i++) {
          output.writeRawByte((byte) 32);
          output.writeUInt32NoTag(takenScoreRewardList.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(rogueImmersifier);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(poolId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(score);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += (1 * takenScoreRewardList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(takenScoreRewardList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RogueScoreRewardInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // rogueImmersifier
            rogueImmersifier = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // poolId
            poolId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 72) {
              break;
            }
          }
          case 72: {
            // score
            score = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 8) {
              break;
            }
          }
          case 8: {
            // hasTakenInitialScore
            hasTakenInitialScore = input.readBool();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // poolRefreshed
            poolRefreshed = input.readBool();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 34) {
              break;
            }
          }
          case 34: {
            // takenScoreRewardList [packed=true]
            input.readPackedUInt32(takenScoreRewardList, tag);
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 32: {
            // takenScoreRewardList [packed=false]
            tag = input.readRepeatedUInt32(takenScoreRewardList, tag);
            bitField0_ |= 0x00000020;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.rogueImmersifier, rogueImmersifier);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.poolId, poolId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.score, score);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBool(FieldNames.hasTakenInitialScore, hasTakenInitialScore);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBool(FieldNames.poolRefreshed, poolRefreshed);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRepeatedUInt32(FieldNames.takenScoreRewardList, takenScoreRewardList);
      }
      output.endObject();
    }

    @Override
    public RogueScoreRewardInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1115528066:
          case -1695636777: {
            if (input.isAtField(FieldNames.rogueImmersifier)) {
              if (!input.trySkipNullValue()) {
                rogueImmersifier = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -982578601:
          case -395144162: {
            if (input.isAtField(FieldNames.poolId)) {
              if (!input.trySkipNullValue()) {
                poolId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 109264530: {
            if (input.isAtField(FieldNames.score)) {
              if (!input.trySkipNullValue()) {
                score = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1561171099:
          case -1786836166: {
            if (input.isAtField(FieldNames.hasTakenInitialScore)) {
              if (!input.trySkipNullValue()) {
                hasTakenInitialScore = input.readBool();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1555416066:
          case -403409833: {
            if (input.isAtField(FieldNames.poolRefreshed)) {
              if (!input.trySkipNullValue()) {
                poolRefreshed = input.readBool();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1204149032:
          case -1139944439: {
            if (input.isAtField(FieldNames.takenScoreRewardList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(takenScoreRewardList);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RogueScoreRewardInfoFactory implements MessageFactory<RogueScoreRewardInfo> {
      INSTANCE;

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

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

      static final FieldName poolId = FieldName.forField("poolId", "pool_id");

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

      static final FieldName hasTakenInitialScore = FieldName.forField("hasTakenInitialScore", "has_taken_initial_score");

      static final FieldName poolRefreshed = FieldName.forField("poolRefreshed", "pool_refreshed");

      static final FieldName takenScoreRewardList = FieldName.forField("takenScoreRewardList", "taken_score_reward_list");
    }
  }
}
