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

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

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</code>
     */
    private final RepeatedInt rogueMiracleList = RepeatedInt.newEmptyInstance();

    /**
     * <code>repeated .RogueBuff buff_list = 6;</code>
     */
    private final RepeatedMessage<RogueBuffOuterClass.RogueBuff> buffList = RepeatedMessage.newEmptyInstance(RogueBuffOuterClass.RogueBuff.getFactory());

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</code>
     */
    private final RepeatedMessage<RogueRecordAvatarOuterClass.RogueRecordAvatar> avatarList = RepeatedMessage.newEmptyInstance(RogueRecordAvatarOuterClass.RogueRecordAvatar.getFactory());

    private RogueRecordInfo() {
    }

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

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</code>
     * @return whether the rogueMiracleList field is set
     */
    public boolean hasRogueMiracleList() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</code>
     * @return this
     */
    public RogueRecordInfo clearRogueMiracleList() {
      bitField0_ &= ~0x00000001;
      rogueMiracleList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</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 #getMutableRogueMiracleList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getRogueMiracleList() {
      return rogueMiracleList;
    }

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</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 getMutableRogueMiracleList() {
      bitField0_ |= 0x00000001;
      return rogueMiracleList;
    }

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</code>
     * @param value the rogueMiracleList to add
     * @return this
     */
    public RogueRecordInfo addRogueMiracleList(final int value) {
      bitField0_ |= 0x00000001;
      rogueMiracleList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 rogue_miracle_list = 8;</code>
     * @param values the rogueMiracleList to add
     * @return this
     */
    public RogueRecordInfo addAllRogueMiracleList(final int... values) {
      bitField0_ |= 0x00000001;
      rogueMiracleList.addAll(values);
      return this;
    }

    /**
     * <code>repeated .RogueBuff buff_list = 6;</code>
     * @return whether the buffList field is set
     */
    public boolean hasBuffList() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>repeated .RogueBuff buff_list = 6;</code>
     * @return this
     */
    public RogueRecordInfo clearBuffList() {
      bitField0_ &= ~0x00000002;
      buffList.clear();
      return this;
    }

    /**
     * <code>repeated .RogueBuff buff_list = 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 #getMutableBuffList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<RogueBuffOuterClass.RogueBuff> getBuffList() {
      return buffList;
    }

    /**
     * <code>repeated .RogueBuff buff_list = 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 RepeatedMessage<RogueBuffOuterClass.RogueBuff> getMutableBuffList() {
      bitField0_ |= 0x00000002;
      return buffList;
    }

    /**
     * <code>repeated .RogueBuff buff_list = 6;</code>
     * @param value the buffList to add
     * @return this
     */
    public RogueRecordInfo addBuffList(final RogueBuffOuterClass.RogueBuff value) {
      bitField0_ |= 0x00000002;
      buffList.add(value);
      return this;
    }

    /**
     * <code>repeated .RogueBuff buff_list = 6;</code>
     * @param values the buffList to add
     * @return this
     */
    public RogueRecordInfo addAllBuffList(final RogueBuffOuterClass.RogueBuff... values) {
      bitField0_ |= 0x00000002;
      buffList.addAll(values);
      return this;
    }

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</code>
     * @return whether the avatarList field is set
     */
    public boolean hasAvatarList() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</code>
     * @return this
     */
    public RogueRecordInfo clearAvatarList() {
      bitField0_ &= ~0x00000004;
      avatarList.clear();
      return this;
    }

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</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 #getMutableAvatarList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<RogueRecordAvatarOuterClass.RogueRecordAvatar> getAvatarList() {
      return avatarList;
    }

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</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 RepeatedMessage<RogueRecordAvatarOuterClass.RogueRecordAvatar> getMutableAvatarList() {
      bitField0_ |= 0x00000004;
      return avatarList;
    }

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</code>
     * @param value the avatarList to add
     * @return this
     */
    public RogueRecordInfo addAvatarList(
        final RogueRecordAvatarOuterClass.RogueRecordAvatar value) {
      bitField0_ |= 0x00000004;
      avatarList.add(value);
      return this;
    }

    /**
     * <code>repeated .RogueRecordAvatar avatar_list = 7;</code>
     * @param values the avatarList to add
     * @return this
     */
    public RogueRecordInfo addAllAvatarList(
        final RogueRecordAvatarOuterClass.RogueRecordAvatar... values) {
      bitField0_ |= 0x00000004;
      avatarList.addAll(values);
      return this;
    }

    @Override
    public RogueRecordInfo copyFrom(final RogueRecordInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        rogueMiracleList.copyFrom(other.rogueMiracleList);
        buffList.copyFrom(other.buffList);
        avatarList.copyFrom(other.avatarList);
      }
      return this;
    }

    @Override
    public RogueRecordInfo mergeFrom(final RogueRecordInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRogueMiracleList()) {
        getMutableRogueMiracleList().addAll(other.rogueMiracleList);
      }
      if (other.hasBuffList()) {
        getMutableBuffList().addAll(other.buffList);
      }
      if (other.hasAvatarList()) {
        getMutableAvatarList().addAll(other.avatarList);
      }
      return this;
    }

    @Override
    public RogueRecordInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      rogueMiracleList.clear();
      buffList.clear();
      avatarList.clear();
      return this;
    }

    @Override
    public RogueRecordInfo clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      rogueMiracleList.clear();
      buffList.clearQuick();
      avatarList.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RogueRecordInfo)) {
        return false;
      }
      RogueRecordInfo other = (RogueRecordInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasRogueMiracleList() || rogueMiracleList.equals(other.rogueMiracleList))
        && (!hasBuffList() || buffList.equals(other.buffList))
        && (!hasAvatarList() || avatarList.equals(other.avatarList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        for (int i = 0; i < rogueMiracleList.length(); i++) {
          output.writeRawByte((byte) 64);
          output.writeUInt32NoTag(rogueMiracleList.array()[i]);
        }
      }
      if ((bitField0_ & 0x00000002) != 0) {
        for (int i = 0; i < buffList.length(); i++) {
          output.writeRawByte((byte) 50);
          output.writeMessageNoTag(buffList.get(i));
        }
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < avatarList.length(); i++) {
          output.writeRawByte((byte) 58);
          output.writeMessageNoTag(avatarList.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += (1 * rogueMiracleList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(rogueMiracleList);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += (1 * buffList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(buffList);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * avatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(avatarList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RogueRecordInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 66: {
            // rogueMiracleList [packed=true]
            input.readPackedUInt32(rogueMiracleList, tag);
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 50) {
              break;
            }
          }
          case 50: {
            // buffList
            tag = input.readRepeatedMessage(buffList, tag);
            bitField0_ |= 0x00000002;
            if (tag != 58) {
              break;
            }
          }
          case 58: {
            // avatarList
            tag = input.readRepeatedMessage(avatarList, tag);
            bitField0_ |= 0x00000004;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 64: {
            // rogueMiracleList [packed=false]
            tag = input.readRepeatedUInt32(rogueMiracleList, tag);
            bitField0_ |= 0x00000001;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRepeatedUInt32(FieldNames.rogueMiracleList, rogueMiracleList);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRepeatedMessage(FieldNames.buffList, buffList);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.avatarList, avatarList);
      }
      output.endObject();
    }

    @Override
    public RogueRecordInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -452426123:
          case 1925521905: {
            if (input.isAtField(FieldNames.rogueMiracleList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(rogueMiracleList);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1522789487:
          case 55792906: {
            if (input.isAtField(FieldNames.buffList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(buffList);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -403402345:
          case 397055940: {
            if (input.isAtField(FieldNames.avatarList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(avatarList);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RogueRecordInfoFactory implements MessageFactory<RogueRecordInfo> {
      INSTANCE;

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

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

      static final FieldName buffList = FieldName.forField("buffList", "buff_list");

      static final FieldName avatarList = FieldName.forField("avatarList", "avatar_list");
    }
  }
}
