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

    /**
     * <code>optional uint32 retcode = 8;</code>
     */
    private int retcode;

    /**
     * <code>optional uint32 equipment_unique_id = 15;</code>
     */
    private int equipmentUniqueId;

    private LockEquipmentScRsp() {
    }

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

    /**
     * <code>optional uint32 retcode = 8;</code>
     * @return whether the retcode field is set
     */
    public boolean hasRetcode() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 retcode = 8;</code>
     * @return this
     */
    public LockEquipmentScRsp clearRetcode() {
      bitField0_ &= ~0x00000001;
      retcode = 0;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 8;</code>
     * @return the retcode
     */
    public int getRetcode() {
      return retcode;
    }

    /**
     * <code>optional uint32 retcode = 8;</code>
     * @param value the retcode to set
     * @return this
     */
    public LockEquipmentScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000001;
      retcode = value;
      return this;
    }

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

    /**
     * <code>optional uint32 equipment_unique_id = 15;</code>
     * @return this
     */
    public LockEquipmentScRsp clearEquipmentUniqueId() {
      bitField0_ &= ~0x00000002;
      equipmentUniqueId = 0;
      return this;
    }

    /**
     * <code>optional uint32 equipment_unique_id = 15;</code>
     * @return the equipmentUniqueId
     */
    public int getEquipmentUniqueId() {
      return equipmentUniqueId;
    }

    /**
     * <code>optional uint32 equipment_unique_id = 15;</code>
     * @param value the equipmentUniqueId to set
     * @return this
     */
    public LockEquipmentScRsp setEquipmentUniqueId(final int value) {
      bitField0_ |= 0x00000002;
      equipmentUniqueId = value;
      return this;
    }

    @Override
    public LockEquipmentScRsp copyFrom(final LockEquipmentScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        equipmentUniqueId = other.equipmentUniqueId;
      }
      return this;
    }

    @Override
    public LockEquipmentScRsp mergeFrom(final LockEquipmentScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasEquipmentUniqueId()) {
        setEquipmentUniqueId(other.equipmentUniqueId);
      }
      return this;
    }

    @Override
    public LockEquipmentScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      equipmentUniqueId = 0;
      return this;
    }

    @Override
    public LockEquipmentScRsp 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 LockEquipmentScRsp)) {
        return false;
      }
      LockEquipmentScRsp other = (LockEquipmentScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasEquipmentUniqueId() || equipmentUniqueId == other.equipmentUniqueId);
    }

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

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

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

    @Override
    public LockEquipmentScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1097936398: {
            if (input.isAtField(FieldNames.retcode)) {
              if (!input.trySkipNullValue()) {
                retcode = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1867136902:
          case 760467160: {
            if (input.isAtField(FieldNames.equipmentUniqueId)) {
              if (!input.trySkipNullValue()) {
                equipmentUniqueId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum LockEquipmentScRspFactory implements MessageFactory<LockEquipmentScRsp> {
      INSTANCE;

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

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

      static final FieldName equipmentUniqueId = FieldName.forField("equipmentUniqueId", "equipment_unique_id");
    }
  }
}
