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

    /**
     * <code>optional uint32 activity_id = 10;</code>
     */
    private int activityId;

    /**
     * <code>optional uint32 belobog_shop_id = 15;</code>
     */
    private int belobogShopId;

    /**
     * <code>optional bool completed = 7;</code>
     */
    private boolean completed;

    /**
     * <code>optional bool is_first_reward_taken = 8;</code>
     */
    private boolean isFirstRewardTaken;

    private MaterialSubmitInfo() {
    }

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

    /**
     * <code>optional uint32 activity_id = 10;</code>
     * @return whether the activityId field is set
     */
    public boolean hasActivityId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 activity_id = 10;</code>
     * @return this
     */
    public MaterialSubmitInfo clearActivityId() {
      bitField0_ &= ~0x00000001;
      activityId = 0;
      return this;
    }

    /**
     * <code>optional uint32 activity_id = 10;</code>
     * @return the activityId
     */
    public int getActivityId() {
      return activityId;
    }

    /**
     * <code>optional uint32 activity_id = 10;</code>
     * @param value the activityId to set
     * @return this
     */
    public MaterialSubmitInfo setActivityId(final int value) {
      bitField0_ |= 0x00000001;
      activityId = value;
      return this;
    }

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

    /**
     * <code>optional uint32 belobog_shop_id = 15;</code>
     * @return this
     */
    public MaterialSubmitInfo clearBelobogShopId() {
      bitField0_ &= ~0x00000002;
      belobogShopId = 0;
      return this;
    }

    /**
     * <code>optional uint32 belobog_shop_id = 15;</code>
     * @return the belobogShopId
     */
    public int getBelobogShopId() {
      return belobogShopId;
    }

    /**
     * <code>optional uint32 belobog_shop_id = 15;</code>
     * @param value the belobogShopId to set
     * @return this
     */
    public MaterialSubmitInfo setBelobogShopId(final int value) {
      bitField0_ |= 0x00000002;
      belobogShopId = value;
      return this;
    }

    /**
     * <code>optional bool completed = 7;</code>
     * @return whether the completed field is set
     */
    public boolean hasCompleted() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional bool completed = 7;</code>
     * @return this
     */
    public MaterialSubmitInfo clearCompleted() {
      bitField0_ &= ~0x00000004;
      completed = false;
      return this;
    }

    /**
     * <code>optional bool completed = 7;</code>
     * @return the completed
     */
    public boolean getCompleted() {
      return completed;
    }

    /**
     * <code>optional bool completed = 7;</code>
     * @param value the completed to set
     * @return this
     */
    public MaterialSubmitInfo setCompleted(final boolean value) {
      bitField0_ |= 0x00000004;
      completed = value;
      return this;
    }

    /**
     * <code>optional bool is_first_reward_taken = 8;</code>
     * @return whether the isFirstRewardTaken field is set
     */
    public boolean hasIsFirstRewardTaken() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bool is_first_reward_taken = 8;</code>
     * @return this
     */
    public MaterialSubmitInfo clearIsFirstRewardTaken() {
      bitField0_ &= ~0x00000008;
      isFirstRewardTaken = false;
      return this;
    }

    /**
     * <code>optional bool is_first_reward_taken = 8;</code>
     * @return the isFirstRewardTaken
     */
    public boolean getIsFirstRewardTaken() {
      return isFirstRewardTaken;
    }

    /**
     * <code>optional bool is_first_reward_taken = 8;</code>
     * @param value the isFirstRewardTaken to set
     * @return this
     */
    public MaterialSubmitInfo setIsFirstRewardTaken(final boolean value) {
      bitField0_ |= 0x00000008;
      isFirstRewardTaken = value;
      return this;
    }

    @Override
    public MaterialSubmitInfo copyFrom(final MaterialSubmitInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        activityId = other.activityId;
        belobogShopId = other.belobogShopId;
        completed = other.completed;
        isFirstRewardTaken = other.isFirstRewardTaken;
      }
      return this;
    }

    @Override
    public MaterialSubmitInfo mergeFrom(final MaterialSubmitInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasActivityId()) {
        setActivityId(other.activityId);
      }
      if (other.hasBelobogShopId()) {
        setBelobogShopId(other.belobogShopId);
      }
      if (other.hasCompleted()) {
        setCompleted(other.completed);
      }
      if (other.hasIsFirstRewardTaken()) {
        setIsFirstRewardTaken(other.isFirstRewardTaken);
      }
      return this;
    }

    @Override
    public MaterialSubmitInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      activityId = 0;
      belobogShopId = 0;
      completed = false;
      isFirstRewardTaken = false;
      return this;
    }

    @Override
    public MaterialSubmitInfo 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 MaterialSubmitInfo)) {
        return false;
      }
      MaterialSubmitInfo other = (MaterialSubmitInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasActivityId() || activityId == other.activityId)
        && (!hasBelobogShopId() || belobogShopId == other.belobogShopId)
        && (!hasCompleted() || completed == other.completed)
        && (!hasIsFirstRewardTaken() || isFirstRewardTaken == other.isFirstRewardTaken);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 80);
        output.writeUInt32NoTag(activityId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(belobogShopId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 56);
        output.writeBoolNoTag(completed);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 64);
        output.writeBoolNoTag(isFirstRewardTaken);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(activityId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(belobogShopId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2;
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MaterialSubmitInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 80: {
            // activityId
            activityId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // belobogShopId
            belobogShopId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // completed
            completed = input.readBool();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 64) {
              break;
            }
          }
          case 64: {
            // isFirstRewardTaken
            isFirstRewardTaken = input.readBool();
            bitField0_ |= 0x00000008;
            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.activityId, activityId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.belobogShopId, belobogShopId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBool(FieldNames.completed, completed);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBool(FieldNames.isFirstRewardTaken, isFirstRewardTaken);
      }
      output.endObject();
    }

    @Override
    public MaterialSubmitInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2048619658:
          case -917278645: {
            if (input.isAtField(FieldNames.activityId)) {
              if (!input.trySkipNullValue()) {
                activityId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1130830139:
          case 310288569: {
            if (input.isAtField(FieldNames.belobogShopId)) {
              if (!input.trySkipNullValue()) {
                belobogShopId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1402931637: {
            if (input.isAtField(FieldNames.completed)) {
              if (!input.trySkipNullValue()) {
                completed = input.readBool();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 863586130:
          case 442788379: {
            if (input.isAtField(FieldNames.isFirstRewardTaken)) {
              if (!input.trySkipNullValue()) {
                isFirstRewardTaken = input.readBool();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MaterialSubmitInfoFactory implements MessageFactory<MaterialSubmitInfo> {
      INSTANCE;

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

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

      static final FieldName belobogShopId = FieldName.forField("belobogShopId", "belobog_shop_id");

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

      static final FieldName isFirstRewardTaken = FieldName.forField("isFirstRewardTaken", "is_first_reward_taken");
    }
  }
}
