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

    /**
     * <code>optional uint32 retcode = 1;</code>
     */
    private int retcode;

    /**
     * <code>optional uint32 mark_avatar_id = 8;</code>
     */
    private int markAvatarId;

    /**
     * <code>optional uint32 func_id = 14;</code>
     */
    private int funcId;

    /**
     * <code>repeated .MarkChestInfo chest_group_list = 6;</code>
     */
    private final RepeatedMessage<MarkChestInfoOuterClass.MarkChestInfo> chestGroupList = RepeatedMessage.newEmptyInstance(MarkChestInfoOuterClass.MarkChestInfo.getFactory());

    private UpdateMarkChestScRsp() {
    }

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

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

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

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

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

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

    /**
     * <code>optional uint32 mark_avatar_id = 8;</code>
     * @return this
     */
    public UpdateMarkChestScRsp clearMarkAvatarId() {
      bitField0_ &= ~0x00000002;
      markAvatarId = 0;
      return this;
    }

    /**
     * <code>optional uint32 mark_avatar_id = 8;</code>
     * @return the markAvatarId
     */
    public int getMarkAvatarId() {
      return markAvatarId;
    }

    /**
     * <code>optional uint32 mark_avatar_id = 8;</code>
     * @param value the markAvatarId to set
     * @return this
     */
    public UpdateMarkChestScRsp setMarkAvatarId(final int value) {
      bitField0_ |= 0x00000002;
      markAvatarId = value;
      return this;
    }

    /**
     * <code>optional uint32 func_id = 14;</code>
     * @return whether the funcId field is set
     */
    public boolean hasFuncId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 func_id = 14;</code>
     * @return this
     */
    public UpdateMarkChestScRsp clearFuncId() {
      bitField0_ &= ~0x00000004;
      funcId = 0;
      return this;
    }

    /**
     * <code>optional uint32 func_id = 14;</code>
     * @return the funcId
     */
    public int getFuncId() {
      return funcId;
    }

    /**
     * <code>optional uint32 func_id = 14;</code>
     * @param value the funcId to set
     * @return this
     */
    public UpdateMarkChestScRsp setFuncId(final int value) {
      bitField0_ |= 0x00000004;
      funcId = value;
      return this;
    }

    /**
     * <code>repeated .MarkChestInfo chest_group_list = 6;</code>
     * @return whether the chestGroupList field is set
     */
    public boolean hasChestGroupList() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated .MarkChestInfo chest_group_list = 6;</code>
     * @return this
     */
    public UpdateMarkChestScRsp clearChestGroupList() {
      bitField0_ &= ~0x00000008;
      chestGroupList.clear();
      return this;
    }

    /**
     * <code>repeated .MarkChestInfo chest_group_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 #getMutableChestGroupList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<MarkChestInfoOuterClass.MarkChestInfo> getChestGroupList() {
      return chestGroupList;
    }

    /**
     * <code>repeated .MarkChestInfo chest_group_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<MarkChestInfoOuterClass.MarkChestInfo> getMutableChestGroupList() {
      bitField0_ |= 0x00000008;
      return chestGroupList;
    }

    /**
     * <code>repeated .MarkChestInfo chest_group_list = 6;</code>
     * @param value the chestGroupList to add
     * @return this
     */
    public UpdateMarkChestScRsp addChestGroupList(
        final MarkChestInfoOuterClass.MarkChestInfo value) {
      bitField0_ |= 0x00000008;
      chestGroupList.add(value);
      return this;
    }

    /**
     * <code>repeated .MarkChestInfo chest_group_list = 6;</code>
     * @param values the chestGroupList to add
     * @return this
     */
    public UpdateMarkChestScRsp addAllChestGroupList(
        final MarkChestInfoOuterClass.MarkChestInfo... values) {
      bitField0_ |= 0x00000008;
      chestGroupList.addAll(values);
      return this;
    }

    @Override
    public UpdateMarkChestScRsp copyFrom(final UpdateMarkChestScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        markAvatarId = other.markAvatarId;
        funcId = other.funcId;
        chestGroupList.copyFrom(other.chestGroupList);
      }
      return this;
    }

    @Override
    public UpdateMarkChestScRsp mergeFrom(final UpdateMarkChestScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasMarkAvatarId()) {
        setMarkAvatarId(other.markAvatarId);
      }
      if (other.hasFuncId()) {
        setFuncId(other.funcId);
      }
      if (other.hasChestGroupList()) {
        getMutableChestGroupList().addAll(other.chestGroupList);
      }
      return this;
    }

    @Override
    public UpdateMarkChestScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      markAvatarId = 0;
      funcId = 0;
      chestGroupList.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof UpdateMarkChestScRsp)) {
        return false;
      }
      UpdateMarkChestScRsp other = (UpdateMarkChestScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasMarkAvatarId() || markAvatarId == other.markAvatarId)
        && (!hasFuncId() || funcId == other.funcId)
        && (!hasChestGroupList() || chestGroupList.equals(other.chestGroupList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt32NoTag(markAvatarId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(funcId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < chestGroupList.length(); i++) {
          output.writeRawByte((byte) 50);
          output.writeMessageNoTag(chestGroupList.get(i));
        }
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public UpdateMarkChestScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 64) {
              break;
            }
          }
          case 64: {
            // markAvatarId
            markAvatarId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // funcId
            funcId = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 50) {
              break;
            }
          }
          case 50: {
            // chestGroupList
            tag = input.readRepeatedMessage(chestGroupList, tag);
            bitField0_ |= 0x00000008;
            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.writeUInt32(FieldNames.markAvatarId, markAvatarId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.funcId, funcId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedMessage(FieldNames.chestGroupList, chestGroupList);
      }
      output.endObject();
    }

    @Override
    public UpdateMarkChestScRsp 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 -520346047:
          case -1048892721: {
            if (input.isAtField(FieldNames.markAvatarId)) {
              if (!input.trySkipNullValue()) {
                markAvatarId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1263367425:
          case -509663114: {
            if (input.isAtField(FieldNames.funcId)) {
              if (!input.trySkipNullValue()) {
                funcId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -98349636:
          case 129195612: {
            if (input.isAtField(FieldNames.chestGroupList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(chestGroupList);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum UpdateMarkChestScRspFactory implements MessageFactory<UpdateMarkChestScRsp> {
      INSTANCE;

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

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

      static final FieldName markAvatarId = FieldName.forField("markAvatarId", "mark_avatar_id");

      static final FieldName funcId = FieldName.forField("funcId", "func_id");

      static final FieldName chestGroupList = FieldName.forField("chestGroupList", "chest_group_list");
    }
  }
}
