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

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

    /**
     * <code>optional uint32 count = 2;</code>
     */
    private int count;

    /**
     * <code>optional uint32 compose_id = 3;</code>
     */
    private int composeId;

    /**
     * <code>optional uint32 main_affix_id = 11;</code>
     */
    private int mainAffixId;

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</code>
     */
    private final RepeatedInt composeSubAffixList = RepeatedInt.newEmptyInstance();

    private ComposeSelectedRelicCsReq() {
    }

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

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

    /**
     * <code>optional uint32 compose_relic_id = 1;</code>
     * @return this
     */
    public ComposeSelectedRelicCsReq clearComposeRelicId() {
      bitField0_ &= ~0x00000001;
      composeRelicId = 0;
      return this;
    }

    /**
     * <code>optional uint32 compose_relic_id = 1;</code>
     * @return the composeRelicId
     */
    public int getComposeRelicId() {
      return composeRelicId;
    }

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

    /**
     * <code>optional uint32 count = 2;</code>
     * @return whether the count field is set
     */
    public boolean hasCount() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 count = 2;</code>
     * @return this
     */
    public ComposeSelectedRelicCsReq clearCount() {
      bitField0_ &= ~0x00000002;
      count = 0;
      return this;
    }

    /**
     * <code>optional uint32 count = 2;</code>
     * @return the count
     */
    public int getCount() {
      return count;
    }

    /**
     * <code>optional uint32 count = 2;</code>
     * @param value the count to set
     * @return this
     */
    public ComposeSelectedRelicCsReq setCount(final int value) {
      bitField0_ |= 0x00000002;
      count = value;
      return this;
    }

    /**
     * <code>optional uint32 compose_id = 3;</code>
     * @return whether the composeId field is set
     */
    public boolean hasComposeId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 compose_id = 3;</code>
     * @return this
     */
    public ComposeSelectedRelicCsReq clearComposeId() {
      bitField0_ &= ~0x00000004;
      composeId = 0;
      return this;
    }

    /**
     * <code>optional uint32 compose_id = 3;</code>
     * @return the composeId
     */
    public int getComposeId() {
      return composeId;
    }

    /**
     * <code>optional uint32 compose_id = 3;</code>
     * @param value the composeId to set
     * @return this
     */
    public ComposeSelectedRelicCsReq setComposeId(final int value) {
      bitField0_ |= 0x00000004;
      composeId = value;
      return this;
    }

    /**
     * <code>optional uint32 main_affix_id = 11;</code>
     * @return whether the mainAffixId field is set
     */
    public boolean hasMainAffixId() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 main_affix_id = 11;</code>
     * @return this
     */
    public ComposeSelectedRelicCsReq clearMainAffixId() {
      bitField0_ &= ~0x00000008;
      mainAffixId = 0;
      return this;
    }

    /**
     * <code>optional uint32 main_affix_id = 11;</code>
     * @return the mainAffixId
     */
    public int getMainAffixId() {
      return mainAffixId;
    }

    /**
     * <code>optional uint32 main_affix_id = 11;</code>
     * @param value the mainAffixId to set
     * @return this
     */
    public ComposeSelectedRelicCsReq setMainAffixId(final int value) {
      bitField0_ |= 0x00000008;
      mainAffixId = value;
      return this;
    }

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</code>
     * @return whether the composeSubAffixList field is set
     */
    public boolean hasComposeSubAffixList() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</code>
     * @return this
     */
    public ComposeSelectedRelicCsReq clearComposeSubAffixList() {
      bitField0_ &= ~0x00000010;
      composeSubAffixList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</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 #getMutableComposeSubAffixList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getComposeSubAffixList() {
      return composeSubAffixList;
    }

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</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 getMutableComposeSubAffixList() {
      bitField0_ |= 0x00000010;
      return composeSubAffixList;
    }

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</code>
     * @param value the composeSubAffixList to add
     * @return this
     */
    public ComposeSelectedRelicCsReq addComposeSubAffixList(final int value) {
      bitField0_ |= 0x00000010;
      composeSubAffixList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 compose_sub_affix_list = 12;</code>
     * @param values the composeSubAffixList to add
     * @return this
     */
    public ComposeSelectedRelicCsReq addAllComposeSubAffixList(final int... values) {
      bitField0_ |= 0x00000010;
      composeSubAffixList.addAll(values);
      return this;
    }

    @Override
    public ComposeSelectedRelicCsReq copyFrom(final ComposeSelectedRelicCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        composeRelicId = other.composeRelicId;
        count = other.count;
        composeId = other.composeId;
        mainAffixId = other.mainAffixId;
        composeSubAffixList.copyFrom(other.composeSubAffixList);
      }
      return this;
    }

    @Override
    public ComposeSelectedRelicCsReq mergeFrom(final ComposeSelectedRelicCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasComposeRelicId()) {
        setComposeRelicId(other.composeRelicId);
      }
      if (other.hasCount()) {
        setCount(other.count);
      }
      if (other.hasComposeId()) {
        setComposeId(other.composeId);
      }
      if (other.hasMainAffixId()) {
        setMainAffixId(other.mainAffixId);
      }
      if (other.hasComposeSubAffixList()) {
        getMutableComposeSubAffixList().addAll(other.composeSubAffixList);
      }
      return this;
    }

    @Override
    public ComposeSelectedRelicCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      composeRelicId = 0;
      count = 0;
      composeId = 0;
      mainAffixId = 0;
      composeSubAffixList.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ComposeSelectedRelicCsReq)) {
        return false;
      }
      ComposeSelectedRelicCsReq other = (ComposeSelectedRelicCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasComposeRelicId() || composeRelicId == other.composeRelicId)
        && (!hasCount() || count == other.count)
        && (!hasComposeId() || composeId == other.composeId)
        && (!hasMainAffixId() || mainAffixId == other.mainAffixId)
        && (!hasComposeSubAffixList() || composeSubAffixList.equals(other.composeSubAffixList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(composeRelicId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(count);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(composeId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(mainAffixId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        for (int i = 0; i < composeSubAffixList.length(); i++) {
          output.writeRawByte((byte) 96);
          output.writeUInt32NoTag(composeSubAffixList.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(composeRelicId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(count);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(composeId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(mainAffixId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += (1 * composeSubAffixList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(composeSubAffixList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ComposeSelectedRelicCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // composeRelicId
            composeRelicId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // count
            count = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // composeId
            composeId = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // mainAffixId
            mainAffixId = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 98) {
              break;
            }
          }
          case 98: {
            // composeSubAffixList [packed=true]
            input.readPackedUInt32(composeSubAffixList, tag);
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 96: {
            // composeSubAffixList [packed=false]
            tag = input.readRepeatedUInt32(composeSubAffixList, tag);
            bitField0_ |= 0x00000010;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.composeRelicId, composeRelicId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.count, count);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.composeId, composeId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.mainAffixId, mainAffixId);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRepeatedUInt32(FieldNames.composeSubAffixList, composeSubAffixList);
      }
      output.endObject();
    }

    @Override
    public ComposeSelectedRelicCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1424923132:
          case 885799284: {
            if (input.isAtField(FieldNames.composeRelicId)) {
              if (!input.trySkipNullValue()) {
                composeRelicId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 94851343: {
            if (input.isAtField(FieldNames.count)) {
              if (!input.trySkipNullValue()) {
                count = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1399759283:
          case -442843416: {
            if (input.isAtField(FieldNames.composeId)) {
              if (!input.trySkipNullValue()) {
                composeId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1973876974:
          case -1426712144: {
            if (input.isAtField(FieldNames.mainAffixId)) {
              if (!input.trySkipNullValue()) {
                mainAffixId = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 951775968:
          case 467259225: {
            if (input.isAtField(FieldNames.composeSubAffixList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(composeSubAffixList);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ComposeSelectedRelicCsReqFactory implements MessageFactory<ComposeSelectedRelicCsReq> {
      INSTANCE;

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

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

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

      static final FieldName composeId = FieldName.forField("composeId", "compose_id");

      static final FieldName mainAffixId = FieldName.forField("mainAffixId", "main_affix_id");

      static final FieldName composeSubAffixList = FieldName.forField("composeSubAffixList", "compose_sub_affix_list");
    }
  }
}
