// 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.RepeatedMessage;

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

    /**
     * <pre>
     *  JDLHKMNFDBD
     * </pre>
     *
     * <code>optional uint32 retcode = 13;</code>
     */
    private int retcode;

    /**
     * <pre>
     *  always set to true
     * </pre>
     *
     * <code>optional bool b11 = 10;</code>
     */
    private boolean b11;

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 8;</code>
     */
    private final RepeatedMessage<FriendChallengeInfoOuterClass.FriendChallengeInfo> friendChallengeInfos = RepeatedMessage.newEmptyInstance(FriendChallengeInfoOuterClass.FriendChallengeInfo.getFactory());

    private GetFriendChallengeLineupScRsp() {
    }

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

    /**
     * <pre>
     *  JDLHKMNFDBD
     * </pre>
     *
     * <code>optional uint32 retcode = 13;</code>
     * @return whether the retcode field is set
     */
    public boolean hasRetcode() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <pre>
     *  JDLHKMNFDBD
     * </pre>
     *
     * <code>optional uint32 retcode = 13;</code>
     * @return this
     */
    public GetFriendChallengeLineupScRsp clearRetcode() {
      bitField0_ &= ~0x00000001;
      retcode = 0;
      return this;
    }

    /**
     * <pre>
     *  JDLHKMNFDBD
     * </pre>
     *
     * <code>optional uint32 retcode = 13;</code>
     * @return the retcode
     */
    public int getRetcode() {
      return retcode;
    }

    /**
     * <pre>
     *  JDLHKMNFDBD
     * </pre>
     *
     * <code>optional uint32 retcode = 13;</code>
     * @param value the retcode to set
     * @return this
     */
    public GetFriendChallengeLineupScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000001;
      retcode = value;
      return this;
    }

    /**
     * <pre>
     *  always set to true
     * </pre>
     *
     * <code>optional bool b11 = 10;</code>
     * @return whether the b11 field is set
     */
    public boolean hasB11() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <pre>
     *  always set to true
     * </pre>
     *
     * <code>optional bool b11 = 10;</code>
     * @return this
     */
    public GetFriendChallengeLineupScRsp clearB11() {
      bitField0_ &= ~0x00000002;
      b11 = false;
      return this;
    }

    /**
     * <pre>
     *  always set to true
     * </pre>
     *
     * <code>optional bool b11 = 10;</code>
     * @return the b11
     */
    public boolean getB11() {
      return b11;
    }

    /**
     * <pre>
     *  always set to true
     * </pre>
     *
     * <code>optional bool b11 = 10;</code>
     * @param value the b11 to set
     * @return this
     */
    public GetFriendChallengeLineupScRsp setB11(final boolean value) {
      bitField0_ |= 0x00000002;
      b11 = value;
      return this;
    }

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 8;</code>
     * @return whether the friendChallengeInfos field is set
     */
    public boolean hasFriendChallengeInfos() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 8;</code>
     * @return this
     */
    public GetFriendChallengeLineupScRsp clearFriendChallengeInfos() {
      bitField0_ &= ~0x00000004;
      friendChallengeInfos.clear();
      return this;
    }

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 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 #getMutableFriendChallengeInfos()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<FriendChallengeInfoOuterClass.FriendChallengeInfo> getFriendChallengeInfos(
        ) {
      return friendChallengeInfos;
    }

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 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 RepeatedMessage<FriendChallengeInfoOuterClass.FriendChallengeInfo> getMutableFriendChallengeInfos(
        ) {
      bitField0_ |= 0x00000004;
      return friendChallengeInfos;
    }

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 8;</code>
     * @param value the friendChallengeInfos to add
     * @return this
     */
    public GetFriendChallengeLineupScRsp addFriendChallengeInfos(
        final FriendChallengeInfoOuterClass.FriendChallengeInfo value) {
      bitField0_ |= 0x00000004;
      friendChallengeInfos.add(value);
      return this;
    }

    /**
     * <code>repeated .FriendChallengeInfo friend_challenge_infos = 8;</code>
     * @param values the friendChallengeInfos to add
     * @return this
     */
    public GetFriendChallengeLineupScRsp addAllFriendChallengeInfos(
        final FriendChallengeInfoOuterClass.FriendChallengeInfo... values) {
      bitField0_ |= 0x00000004;
      friendChallengeInfos.addAll(values);
      return this;
    }

    @Override
    public GetFriendChallengeLineupScRsp copyFrom(final GetFriendChallengeLineupScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        b11 = other.b11;
        friendChallengeInfos.copyFrom(other.friendChallengeInfos);
      }
      return this;
    }

    @Override
    public GetFriendChallengeLineupScRsp mergeFrom(final GetFriendChallengeLineupScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasB11()) {
        setB11(other.b11);
      }
      if (other.hasFriendChallengeInfos()) {
        getMutableFriendChallengeInfos().addAll(other.friendChallengeInfos);
      }
      return this;
    }

    @Override
    public GetFriendChallengeLineupScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      b11 = false;
      friendChallengeInfos.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GetFriendChallengeLineupScRsp)) {
        return false;
      }
      GetFriendChallengeLineupScRsp other = (GetFriendChallengeLineupScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasB11() || b11 == other.b11)
        && (!hasFriendChallengeInfos() || friendChallengeInfos.equals(other.friendChallengeInfos));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 104);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 80);
        output.writeBoolNoTag(b11);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < friendChallengeInfos.length(); i++) {
          output.writeRawByte((byte) 66);
          output.writeMessageNoTag(friendChallengeInfos.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * friendChallengeInfos.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(friendChallengeInfos);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public GetFriendChallengeLineupScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 104: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 80) {
              break;
            }
          }
          case 80: {
            // b11
            b11 = input.readBool();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 66) {
              break;
            }
          }
          case 66: {
            // friendChallengeInfos
            tag = input.readRepeatedMessage(friendChallengeInfos, tag);
            bitField0_ |= 0x00000004;
            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.retcode, retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBool(FieldNames.b11, b11);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.friendChallengeInfos, friendChallengeInfos);
      }
      output.endObject();
    }

    @Override
    public GetFriendChallengeLineupScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1097936398: {
            if (input.isAtField(FieldNames.retcode)) {
              if (!input.trySkipNullValue()) {
                retcode = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 95746: {
            if (input.isAtField(FieldNames.b11)) {
              if (!input.trySkipNullValue()) {
                b11 = input.readBool();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1083831584:
          case 1662541576: {
            if (input.isAtField(FieldNames.friendChallengeInfos)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(friendChallengeInfos);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetFriendChallengeLineupScRspFactory implements MessageFactory<GetFriendChallengeLineupScRsp> {
      INSTANCE;

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

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

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

      static final FieldName friendChallengeInfos = FieldName.forField("friendChallengeInfos", "friend_challenge_infos");
    }
  }
}
