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

    /**
     * <code>optional uint32 reforge_block_sub_affix_id = 6;</code>
     */
    private int reforgeBlockSubAffixId;

    /**
     * <code>optional uint32 relic_unique_id = 15;</code>
     */
    private int relicUniqueId;

    private RelicReforgeCsReq() {
    }

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

    /**
     * <code>optional uint32 reforge_block_sub_affix_id = 6;</code>
     * @return whether the reforgeBlockSubAffixId field is set
     */
    public boolean hasReforgeBlockSubAffixId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 reforge_block_sub_affix_id = 6;</code>
     * @return this
     */
    public RelicReforgeCsReq clearReforgeBlockSubAffixId() {
      bitField0_ &= ~0x00000001;
      reforgeBlockSubAffixId = 0;
      return this;
    }

    /**
     * <code>optional uint32 reforge_block_sub_affix_id = 6;</code>
     * @return the reforgeBlockSubAffixId
     */
    public int getReforgeBlockSubAffixId() {
      return reforgeBlockSubAffixId;
    }

    /**
     * <code>optional uint32 reforge_block_sub_affix_id = 6;</code>
     * @param value the reforgeBlockSubAffixId to set
     * @return this
     */
    public RelicReforgeCsReq setReforgeBlockSubAffixId(final int value) {
      bitField0_ |= 0x00000001;
      reforgeBlockSubAffixId = value;
      return this;
    }

    /**
     * <code>optional uint32 relic_unique_id = 15;</code>
     * @return whether the relicUniqueId field is set
     */
    public boolean hasRelicUniqueId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 relic_unique_id = 15;</code>
     * @return this
     */
    public RelicReforgeCsReq clearRelicUniqueId() {
      bitField0_ &= ~0x00000002;
      relicUniqueId = 0;
      return this;
    }

    /**
     * <code>optional uint32 relic_unique_id = 15;</code>
     * @return the relicUniqueId
     */
    public int getRelicUniqueId() {
      return relicUniqueId;
    }

    /**
     * <code>optional uint32 relic_unique_id = 15;</code>
     * @param value the relicUniqueId to set
     * @return this
     */
    public RelicReforgeCsReq setRelicUniqueId(final int value) {
      bitField0_ |= 0x00000002;
      relicUniqueId = value;
      return this;
    }

    @Override
    public RelicReforgeCsReq copyFrom(final RelicReforgeCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        reforgeBlockSubAffixId = other.reforgeBlockSubAffixId;
        relicUniqueId = other.relicUniqueId;
      }
      return this;
    }

    @Override
    public RelicReforgeCsReq mergeFrom(final RelicReforgeCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasReforgeBlockSubAffixId()) {
        setReforgeBlockSubAffixId(other.reforgeBlockSubAffixId);
      }
      if (other.hasRelicUniqueId()) {
        setRelicUniqueId(other.relicUniqueId);
      }
      return this;
    }

    @Override
    public RelicReforgeCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      reforgeBlockSubAffixId = 0;
      relicUniqueId = 0;
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RelicReforgeCsReq)) {
        return false;
      }
      RelicReforgeCsReq other = (RelicReforgeCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasReforgeBlockSubAffixId() || reforgeBlockSubAffixId == other.reforgeBlockSubAffixId)
        && (!hasRelicUniqueId() || relicUniqueId == other.relicUniqueId);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(reforgeBlockSubAffixId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(relicUniqueId);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(reforgeBlockSubAffixId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(relicUniqueId);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RelicReforgeCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 48: {
            // reforgeBlockSubAffixId
            reforgeBlockSubAffixId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // relicUniqueId
            relicUniqueId = input.readUInt32();
            bitField0_ |= 0x00000002;
            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.reforgeBlockSubAffixId, reforgeBlockSubAffixId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.relicUniqueId, relicUniqueId);
      }
      output.endObject();
    }

    @Override
    public RelicReforgeCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1156912484:
          case 721468550: {
            if (input.isAtField(FieldNames.reforgeBlockSubAffixId)) {
              if (!input.trySkipNullValue()) {
                reforgeBlockSubAffixId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1966200481:
          case 49648253: {
            if (input.isAtField(FieldNames.relicUniqueId)) {
              if (!input.trySkipNullValue()) {
                relicUniqueId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RelicReforgeCsReqFactory implements MessageFactory<RelicReforgeCsReq> {
      INSTANCE;

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

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

      static final FieldName relicUniqueId = FieldName.forField("relicUniqueId", "relic_unique_id");
    }
  }
}
