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

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

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

    /**
     * <code>optional .RogueMiracleSelectInfo miracle_select_info = 8;</code>
     */
    private final RogueMiracleSelectInfoOuterClass.RogueMiracleSelectInfo miracleSelectInfo = RogueMiracleSelectInfoOuterClass.RogueMiracleSelectInfo.newInstance();

    /**
     * <code>optional .RogueAchivedMiracleInfo rogue_miracle_info = 11;</code>
     */
    private final RogueAchivedMiracleInfoOuterClass.RogueAchivedMiracleInfo rogueMiracleInfo = RogueAchivedMiracleInfoOuterClass.RogueAchivedMiracleInfo.newInstance();

    private SelectRogueMiracleScRsp() {
    }

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

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

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

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

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

    /**
     * <code>optional .RogueMiracleSelectInfo miracle_select_info = 8;</code>
     * @return whether the miracleSelectInfo field is set
     */
    public boolean hasMiracleSelectInfo() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .RogueMiracleSelectInfo miracle_select_info = 8;</code>
     * @return this
     */
    public SelectRogueMiracleScRsp clearMiracleSelectInfo() {
      bitField0_ &= ~0x00000002;
      miracleSelectInfo.clear();
      return this;
    }

    /**
     * <code>optional .RogueMiracleSelectInfo miracle_select_info = 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 #getMutableMiracleSelectInfo()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RogueMiracleSelectInfoOuterClass.RogueMiracleSelectInfo getMiracleSelectInfo() {
      return miracleSelectInfo;
    }

    /**
     * <code>optional .RogueMiracleSelectInfo miracle_select_info = 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 RogueMiracleSelectInfoOuterClass.RogueMiracleSelectInfo getMutableMiracleSelectInfo() {
      bitField0_ |= 0x00000002;
      return miracleSelectInfo;
    }

    /**
     * <code>optional .RogueMiracleSelectInfo miracle_select_info = 8;</code>
     * @param value the miracleSelectInfo to set
     * @return this
     */
    public SelectRogueMiracleScRsp setMiracleSelectInfo(
        final RogueMiracleSelectInfoOuterClass.RogueMiracleSelectInfo value) {
      bitField0_ |= 0x00000002;
      miracleSelectInfo.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .RogueAchivedMiracleInfo rogue_miracle_info = 11;</code>
     * @return whether the rogueMiracleInfo field is set
     */
    public boolean hasRogueMiracleInfo() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .RogueAchivedMiracleInfo rogue_miracle_info = 11;</code>
     * @return this
     */
    public SelectRogueMiracleScRsp clearRogueMiracleInfo() {
      bitField0_ &= ~0x00000004;
      rogueMiracleInfo.clear();
      return this;
    }

    /**
     * <code>optional .RogueAchivedMiracleInfo rogue_miracle_info = 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 #getMutableRogueMiracleInfo()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RogueAchivedMiracleInfoOuterClass.RogueAchivedMiracleInfo getRogueMiracleInfo() {
      return rogueMiracleInfo;
    }

    /**
     * <code>optional .RogueAchivedMiracleInfo rogue_miracle_info = 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 RogueAchivedMiracleInfoOuterClass.RogueAchivedMiracleInfo getMutableRogueMiracleInfo() {
      bitField0_ |= 0x00000004;
      return rogueMiracleInfo;
    }

    /**
     * <code>optional .RogueAchivedMiracleInfo rogue_miracle_info = 11;</code>
     * @param value the rogueMiracleInfo to set
     * @return this
     */
    public SelectRogueMiracleScRsp setRogueMiracleInfo(
        final RogueAchivedMiracleInfoOuterClass.RogueAchivedMiracleInfo value) {
      bitField0_ |= 0x00000004;
      rogueMiracleInfo.copyFrom(value);
      return this;
    }

    @Override
    public SelectRogueMiracleScRsp copyFrom(final SelectRogueMiracleScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        miracleSelectInfo.copyFrom(other.miracleSelectInfo);
        rogueMiracleInfo.copyFrom(other.rogueMiracleInfo);
      }
      return this;
    }

    @Override
    public SelectRogueMiracleScRsp mergeFrom(final SelectRogueMiracleScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasMiracleSelectInfo()) {
        getMutableMiracleSelectInfo().mergeFrom(other.miracleSelectInfo);
      }
      if (other.hasRogueMiracleInfo()) {
        getMutableRogueMiracleInfo().mergeFrom(other.rogueMiracleInfo);
      }
      return this;
    }

    @Override
    public SelectRogueMiracleScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      miracleSelectInfo.clear();
      rogueMiracleInfo.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof SelectRogueMiracleScRsp)) {
        return false;
      }
      SelectRogueMiracleScRsp other = (SelectRogueMiracleScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasMiracleSelectInfo() || miracleSelectInfo.equals(other.miracleSelectInfo))
        && (!hasRogueMiracleInfo() || rogueMiracleInfo.equals(other.rogueMiracleInfo));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 66);
        output.writeMessageNoTag(miracleSelectInfo);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 90);
        output.writeMessageNoTag(rogueMiracleInfo);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(miracleSelectInfo);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(rogueMiracleInfo);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public SelectRogueMiracleScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 96: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 66) {
              break;
            }
          }
          case 66: {
            // miracleSelectInfo
            input.readMessage(miracleSelectInfo);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 90) {
              break;
            }
          }
          case 90: {
            // rogueMiracleInfo
            input.readMessage(rogueMiracleInfo);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            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.writeMessage(FieldNames.miracleSelectInfo, miracleSelectInfo);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeMessage(FieldNames.rogueMiracleInfo, rogueMiracleInfo);
      }
      output.endObject();
    }

    @Override
    public SelectRogueMiracleScRsp 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 -1009314021:
          case -1608054973: {
            if (input.isAtField(FieldNames.miracleSelectInfo)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(miracleSelectInfo);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -452511099:
          case 1925436929: {
            if (input.isAtField(FieldNames.rogueMiracleInfo)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(rogueMiracleInfo);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum SelectRogueMiracleScRspFactory implements MessageFactory<SelectRogueMiracleScRsp> {
      INSTANCE;

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

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

      static final FieldName miracleSelectInfo = FieldName.forField("miracleSelectInfo", "miracle_select_info");

      static final FieldName rogueMiracleInfo = FieldName.forField("rogueMiracleInfo", "rogue_miracle_info");
    }
  }
}
