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

    /**
     * <pre>
     *  CMNIOHBPIDG
     * </pre>
     *
     * <code>optional uint32 trial_stage_id = 14;</code>
     */
    private int trialStageId;

    /**
     * <pre>
     *  LGPBJOGHHEP
     * </pre>
     *
     * <code>optional .TrialActivityStatus status = 3;</code>
     */
    private int status;

    private CurTrialActivityScNotify() {
    }

    /**
     * <pre>
     *  EOIMLNJCEBG
     * </pre>
     *
     * @return a new empty instance of {@code CurTrialActivityScNotify}
     */
    public static CurTrialActivityScNotify newInstance() {
      return new CurTrialActivityScNotify();
    }

    /**
     * <pre>
     *  CMNIOHBPIDG
     * </pre>
     *
     * <code>optional uint32 trial_stage_id = 14;</code>
     * @return whether the trialStageId field is set
     */
    public boolean hasTrialStageId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <pre>
     *  CMNIOHBPIDG
     * </pre>
     *
     * <code>optional uint32 trial_stage_id = 14;</code>
     * @return this
     */
    public CurTrialActivityScNotify clearTrialStageId() {
      bitField0_ &= ~0x00000001;
      trialStageId = 0;
      return this;
    }

    /**
     * <pre>
     *  CMNIOHBPIDG
     * </pre>
     *
     * <code>optional uint32 trial_stage_id = 14;</code>
     * @return the trialStageId
     */
    public int getTrialStageId() {
      return trialStageId;
    }

    /**
     * <pre>
     *  CMNIOHBPIDG
     * </pre>
     *
     * <code>optional uint32 trial_stage_id = 14;</code>
     * @param value the trialStageId to set
     * @return this
     */
    public CurTrialActivityScNotify setTrialStageId(final int value) {
      bitField0_ |= 0x00000001;
      trialStageId = value;
      return this;
    }

    /**
     * <pre>
     *  LGPBJOGHHEP
     * </pre>
     *
     * <code>optional .TrialActivityStatus status = 3;</code>
     * @return whether the status field is set
     */
    public boolean hasStatus() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <pre>
     *  LGPBJOGHHEP
     * </pre>
     *
     * <code>optional .TrialActivityStatus status = 3;</code>
     * @return this
     */
    public CurTrialActivityScNotify clearStatus() {
      bitField0_ &= ~0x00000002;
      status = 0;
      return this;
    }

    /**
     * <pre>
     *  LGPBJOGHHEP
     * </pre>
     *
     * <code>optional .TrialActivityStatus status = 3;</code>
     * @return the status
     */
    public TrialActivityStatusOuterClass.TrialActivityStatus getStatus() {
      return TrialActivityStatusOuterClass.TrialActivityStatus.forNumber(status);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link CurTrialActivityScNotify#getStatus()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getStatusValue() {
      return status;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link TrialActivityStatusOuterClass.TrialActivityStatus}. Setting an invalid value
     * can cause {@link CurTrialActivityScNotify#getStatus()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public CurTrialActivityScNotify setStatusValue(final int value) {
      bitField0_ |= 0x00000002;
      status = value;
      return this;
    }

    /**
     * <pre>
     *  LGPBJOGHHEP
     * </pre>
     *
     * <code>optional .TrialActivityStatus status = 3;</code>
     * @param value the status to set
     * @return this
     */
    public CurTrialActivityScNotify setStatus(
        final TrialActivityStatusOuterClass.TrialActivityStatus value) {
      bitField0_ |= 0x00000002;
      status = value.getNumber();
      return this;
    }

    @Override
    public CurTrialActivityScNotify copyFrom(final CurTrialActivityScNotify other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        trialStageId = other.trialStageId;
        status = other.status;
      }
      return this;
    }

    @Override
    public CurTrialActivityScNotify mergeFrom(final CurTrialActivityScNotify other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasTrialStageId()) {
        setTrialStageId(other.trialStageId);
      }
      if (other.hasStatus()) {
        setStatusValue(other.status);
      }
      return this;
    }

    @Override
    public CurTrialActivityScNotify clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      trialStageId = 0;
      status = 0;
      return this;
    }

    @Override
    public CurTrialActivityScNotify 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 CurTrialActivityScNotify)) {
        return false;
      }
      CurTrialActivityScNotify other = (CurTrialActivityScNotify) o;
      return bitField0_ == other.bitField0_
        && (!hasTrialStageId() || trialStageId == other.trialStageId)
        && (!hasStatus() || status == other.status);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(trialStageId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 24);
        output.writeEnumNoTag(status);
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public CurTrialActivityScNotify mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 112: {
            // trialStageId
            trialStageId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // status
            final int value = input.readInt32();
            if (TrialActivityStatusOuterClass.TrialActivityStatus.forNumber(value) != null) {
              status = value;
              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.trialStageId, trialStageId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeEnum(FieldNames.status, status, TrialActivityStatusOuterClass.TrialActivityStatus.converter());
      }
      output.endObject();
    }

    @Override
    public CurTrialActivityScNotify mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -276723517:
          case -2087149307: {
            if (input.isAtField(FieldNames.trialStageId)) {
              if (!input.trySkipNullValue()) {
                trialStageId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -892481550: {
            if (input.isAtField(FieldNames.status)) {
              if (!input.trySkipNullValue()) {
                final TrialActivityStatusOuterClass.TrialActivityStatus value = input.readEnum(TrialActivityStatusOuterClass.TrialActivityStatus.converter());
                if (value != null) {
                  status = value.getNumber();
                  bitField0_ |= 0x00000002;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum CurTrialActivityScNotifyFactory implements MessageFactory<CurTrialActivityScNotify> {
      INSTANCE;

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

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

      static final FieldName status = FieldName.forField("status");
    }
  }
}
