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

    /**
     * <code>optional .ChallengeBossSingleNodeInfo first_node = 2;</code>
     */
    private final ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo firstNode = ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo.newInstance();

    /**
     * <code>optional .ChallengeBossSingleNodeInfo second_node = 11;</code>
     */
    private final ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo secondNode = ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo.newInstance();

    /**
     * <code>repeated uint32 first_half_lineup = 6;</code>
     */
    private final RepeatedInt firstHalfLineup = RepeatedInt.newEmptyInstance();

    /**
     * <code>repeated uint32 second_half_lineup = 13;</code>
     */
    private final RepeatedInt secondHalfLineup = RepeatedInt.newEmptyInstance();

    private ChallengeBossInfo() {
    }

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

    /**
     * <code>optional .ChallengeBossSingleNodeInfo first_node = 2;</code>
     * @return whether the firstNode field is set
     */
    public boolean hasFirstNode() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo first_node = 2;</code>
     * @return this
     */
    public ChallengeBossInfo clearFirstNode() {
      bitField0_ &= ~0x00000001;
      firstNode.clear();
      return this;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo first_node = 2;</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 #getMutableFirstNode()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo getFirstNode() {
      return firstNode;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo first_node = 2;</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 ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo getMutableFirstNode() {
      bitField0_ |= 0x00000001;
      return firstNode;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo first_node = 2;</code>
     * @param value the firstNode to set
     * @return this
     */
    public ChallengeBossInfo setFirstNode(
        final ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo value) {
      bitField0_ |= 0x00000001;
      firstNode.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo second_node = 11;</code>
     * @return whether the secondNode field is set
     */
    public boolean hasSecondNode() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo second_node = 11;</code>
     * @return this
     */
    public ChallengeBossInfo clearSecondNode() {
      bitField0_ &= ~0x00000002;
      secondNode.clear();
      return this;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo second_node = 11;</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 #getMutableSecondNode()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo getSecondNode() {
      return secondNode;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo second_node = 11;</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 ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo getMutableSecondNode(
        ) {
      bitField0_ |= 0x00000002;
      return secondNode;
    }

    /**
     * <code>optional .ChallengeBossSingleNodeInfo second_node = 11;</code>
     * @param value the secondNode to set
     * @return this
     */
    public ChallengeBossInfo setSecondNode(
        final ChallengeBossSingleNodeInfoOuterClass.ChallengeBossSingleNodeInfo value) {
      bitField0_ |= 0x00000002;
      secondNode.copyFrom(value);
      return this;
    }

    /**
     * <code>repeated uint32 first_half_lineup = 6;</code>
     * @return whether the firstHalfLineup field is set
     */
    public boolean hasFirstHalfLineup() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated uint32 first_half_lineup = 6;</code>
     * @return this
     */
    public ChallengeBossInfo clearFirstHalfLineup() {
      bitField0_ &= ~0x00000004;
      firstHalfLineup.clear();
      return this;
    }

    /**
     * <code>repeated uint32 first_half_lineup = 6;</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 #getMutableFirstHalfLineup()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getFirstHalfLineup() {
      return firstHalfLineup;
    }

    /**
     * <code>repeated uint32 first_half_lineup = 6;</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 getMutableFirstHalfLineup() {
      bitField0_ |= 0x00000004;
      return firstHalfLineup;
    }

    /**
     * <code>repeated uint32 first_half_lineup = 6;</code>
     * @param value the firstHalfLineup to add
     * @return this
     */
    public ChallengeBossInfo addFirstHalfLineup(final int value) {
      bitField0_ |= 0x00000004;
      firstHalfLineup.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 first_half_lineup = 6;</code>
     * @param values the firstHalfLineup to add
     * @return this
     */
    public ChallengeBossInfo addAllFirstHalfLineup(final int... values) {
      bitField0_ |= 0x00000004;
      firstHalfLineup.addAll(values);
      return this;
    }

    /**
     * <code>repeated uint32 second_half_lineup = 13;</code>
     * @return whether the secondHalfLineup field is set
     */
    public boolean hasSecondHalfLineup() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated uint32 second_half_lineup = 13;</code>
     * @return this
     */
    public ChallengeBossInfo clearSecondHalfLineup() {
      bitField0_ &= ~0x00000008;
      secondHalfLineup.clear();
      return this;
    }

    /**
     * <code>repeated uint32 second_half_lineup = 13;</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 #getMutableSecondHalfLineup()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getSecondHalfLineup() {
      return secondHalfLineup;
    }

    /**
     * <code>repeated uint32 second_half_lineup = 13;</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 getMutableSecondHalfLineup() {
      bitField0_ |= 0x00000008;
      return secondHalfLineup;
    }

    /**
     * <code>repeated uint32 second_half_lineup = 13;</code>
     * @param value the secondHalfLineup to add
     * @return this
     */
    public ChallengeBossInfo addSecondHalfLineup(final int value) {
      bitField0_ |= 0x00000008;
      secondHalfLineup.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 second_half_lineup = 13;</code>
     * @param values the secondHalfLineup to add
     * @return this
     */
    public ChallengeBossInfo addAllSecondHalfLineup(final int... values) {
      bitField0_ |= 0x00000008;
      secondHalfLineup.addAll(values);
      return this;
    }

    @Override
    public ChallengeBossInfo copyFrom(final ChallengeBossInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        firstNode.copyFrom(other.firstNode);
        secondNode.copyFrom(other.secondNode);
        firstHalfLineup.copyFrom(other.firstHalfLineup);
        secondHalfLineup.copyFrom(other.secondHalfLineup);
      }
      return this;
    }

    @Override
    public ChallengeBossInfo mergeFrom(final ChallengeBossInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasFirstNode()) {
        getMutableFirstNode().mergeFrom(other.firstNode);
      }
      if (other.hasSecondNode()) {
        getMutableSecondNode().mergeFrom(other.secondNode);
      }
      if (other.hasFirstHalfLineup()) {
        getMutableFirstHalfLineup().addAll(other.firstHalfLineup);
      }
      if (other.hasSecondHalfLineup()) {
        getMutableSecondHalfLineup().addAll(other.secondHalfLineup);
      }
      return this;
    }

    @Override
    public ChallengeBossInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      firstNode.clear();
      secondNode.clear();
      firstHalfLineup.clear();
      secondHalfLineup.clear();
      return this;
    }

    @Override
    public ChallengeBossInfo clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      firstNode.clearQuick();
      secondNode.clearQuick();
      firstHalfLineup.clear();
      secondHalfLineup.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ChallengeBossInfo)) {
        return false;
      }
      ChallengeBossInfo other = (ChallengeBossInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasFirstNode() || firstNode.equals(other.firstNode))
        && (!hasSecondNode() || secondNode.equals(other.secondNode))
        && (!hasFirstHalfLineup() || firstHalfLineup.equals(other.firstHalfLineup))
        && (!hasSecondHalfLineup() || secondHalfLineup.equals(other.secondHalfLineup));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 18);
        output.writeMessageNoTag(firstNode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 90);
        output.writeMessageNoTag(secondNode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < firstHalfLineup.length(); i++) {
          output.writeRawByte((byte) 48);
          output.writeUInt32NoTag(firstHalfLineup.array()[i]);
        }
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < secondHalfLineup.length(); i++) {
          output.writeRawByte((byte) 104);
          output.writeUInt32NoTag(secondHalfLineup.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(firstNode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(secondNode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * firstHalfLineup.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(firstHalfLineup);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += (1 * secondHalfLineup.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(secondHalfLineup);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ChallengeBossInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 18: {
            // firstNode
            input.readMessage(firstNode);
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 90) {
              break;
            }
          }
          case 90: {
            // secondNode
            input.readMessage(secondNode);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 50) {
              break;
            }
          }
          case 50: {
            // firstHalfLineup [packed=true]
            input.readPackedUInt32(firstHalfLineup, tag);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 106) {
              break;
            }
          }
          case 106: {
            // secondHalfLineup [packed=true]
            input.readPackedUInt32(secondHalfLineup, tag);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 48: {
            // firstHalfLineup [packed=false]
            tag = input.readRepeatedUInt32(firstHalfLineup, tag);
            bitField0_ |= 0x00000004;
            break;
          }
          case 104: {
            // secondHalfLineup [packed=false]
            tag = input.readRepeatedUInt32(secondHalfLineup, tag);
            bitField0_ |= 0x00000008;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeMessage(FieldNames.firstNode, firstNode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeMessage(FieldNames.secondNode, secondNode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedUInt32(FieldNames.firstHalfLineup, firstHalfLineup);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedUInt32(FieldNames.secondHalfLineup, secondHalfLineup);
      }
      output.endObject();
    }

    @Override
    public ChallengeBossInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 132848850:
          case -160972239: {
            if (input.isAtField(FieldNames.firstNode)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(firstNode);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 423693462:
          case 265276141: {
            if (input.isAtField(FieldNames.secondNode)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(secondNode);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -450421134:
          case 1848535052: {
            if (input.isAtField(FieldNames.firstHalfLineup)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(firstHalfLineup);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1414736694:
          case -1031121968: {
            if (input.isAtField(FieldNames.secondHalfLineup)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(secondHalfLineup);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ChallengeBossInfoFactory implements MessageFactory<ChallengeBossInfo> {
      INSTANCE;

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

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

      static final FieldName secondNode = FieldName.forField("secondNode", "second_node");

      static final FieldName firstHalfLineup = FieldName.forField("firstHalfLineup", "first_half_lineup");

      static final FieldName secondHalfLineup = FieldName.forField("secondHalfLineup", "second_half_lineup");
    }
  }
}
