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

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

    /**
     * <code>optional uint32 NOGHHPKAKAG = 11;</code>
     */
    private int nOGHHPKAKAG;

    private MechanismBarInfo() {
    }

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

    /**
     * <code>optional uint32 value = 2;</code>
     * @return whether the value_ field is set
     */
    public boolean hasValue() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 value = 2;</code>
     * @return this
     */
    public MechanismBarInfo clearValue() {
      bitField0_ &= ~0x00000001;
      value_ = 0;
      return this;
    }

    /**
     * <code>optional uint32 value = 2;</code>
     * @return the value_
     */
    public int getValue() {
      return value_;
    }

    /**
     * <code>optional uint32 value = 2;</code>
     * @param value the value_ to set
     * @return this
     */
    public MechanismBarInfo setValue(final int value) {
      bitField0_ |= 0x00000001;
      value_ = value;
      return this;
    }

    /**
     * <code>optional uint32 NOGHHPKAKAG = 11;</code>
     * @return whether the nOGHHPKAKAG field is set
     */
    public boolean hasNOGHHPKAKAG() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 NOGHHPKAKAG = 11;</code>
     * @return this
     */
    public MechanismBarInfo clearNOGHHPKAKAG() {
      bitField0_ &= ~0x00000002;
      nOGHHPKAKAG = 0;
      return this;
    }

    /**
     * <code>optional uint32 NOGHHPKAKAG = 11;</code>
     * @return the nOGHHPKAKAG
     */
    public int getNOGHHPKAKAG() {
      return nOGHHPKAKAG;
    }

    /**
     * <code>optional uint32 NOGHHPKAKAG = 11;</code>
     * @param value the nOGHHPKAKAG to set
     * @return this
     */
    public MechanismBarInfo setNOGHHPKAKAG(final int value) {
      bitField0_ |= 0x00000002;
      nOGHHPKAKAG = value;
      return this;
    }

    @Override
    public MechanismBarInfo copyFrom(final MechanismBarInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        value_ = other.value_;
        nOGHHPKAKAG = other.nOGHHPKAKAG;
      }
      return this;
    }

    @Override
    public MechanismBarInfo mergeFrom(final MechanismBarInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasValue()) {
        setValue(other.value_);
      }
      if (other.hasNOGHHPKAKAG()) {
        setNOGHHPKAKAG(other.nOGHHPKAKAG);
      }
      return this;
    }

    @Override
    public MechanismBarInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      value_ = 0;
      nOGHHPKAKAG = 0;
      return this;
    }

    @Override
    public MechanismBarInfo 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 MechanismBarInfo)) {
        return false;
      }
      MechanismBarInfo other = (MechanismBarInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasValue() || value_ == other.value_)
        && (!hasNOGHHPKAKAG() || nOGHHPKAKAG == other.nOGHHPKAKAG);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(value_);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(nOGHHPKAKAG);
      }
    }

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

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

    @Override
    public MechanismBarInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 111972721: {
            if (input.isAtField(FieldNames.value_)) {
              if (!input.trySkipNullValue()) {
                value_ = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2077510671: {
            if (input.isAtField(FieldNames.nOGHHPKAKAG)) {
              if (!input.trySkipNullValue()) {
                nOGHHPKAKAG = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MechanismBarInfoFactory implements MessageFactory<MechanismBarInfo> {
      INSTANCE;

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

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

      static final FieldName nOGHHPKAKAG = FieldName.forField("NOGHHPKAKAG");
    }
  }
}
