// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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;
import us.hebi.quickbuf.RepeatedByte;

public final class JointDrillSync {
  /**
   * Protobuf type {@code JointDrillSyncReq}
   */
  public static final class JointDrillSyncReq extends ProtoMessage<JointDrillSyncReq> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional uint32 Floor = 1;</code>
     */
    private int floor;

    /**
     * <code>optional uint32 Time = 2;</code>
     */
    private int time;

    /**
     * <code>optional uint32 Damage = 3;</code>
     */
    private int damage;

    /**
     * <code>optional uint32 BossHp = 4;</code>
     */
    private int bossHp;

    /**
     * <code>optional uint32 BossHpMax = 5;</code>
     */
    private int bossHpMax;

    /**
     * <code>optional bytes Record = 6;</code>
     */
    private final RepeatedByte record = RepeatedByte.newEmptyInstance();

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private JointDrillSyncReq() {
    }

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

    /**
     * <code>optional uint32 Floor = 1;</code>
     * @return whether the floor field is set
     */
    public boolean hasFloor() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Floor = 1;</code>
     * @return this
     */
    public JointDrillSyncReq clearFloor() {
      bitField0_ &= ~0x00000001;
      floor = 0;
      return this;
    }

    /**
     * <code>optional uint32 Floor = 1;</code>
     * @return the floor
     */
    public int getFloor() {
      return floor;
    }

    /**
     * <code>optional uint32 Floor = 1;</code>
     * @param value the floor to set
     * @return this
     */
    public JointDrillSyncReq setFloor(final int value) {
      bitField0_ |= 0x00000001;
      floor = value;
      return this;
    }

    /**
     * <code>optional uint32 Time = 2;</code>
     * @return whether the time field is set
     */
    public boolean hasTime() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 Time = 2;</code>
     * @return this
     */
    public JointDrillSyncReq clearTime() {
      bitField0_ &= ~0x00000002;
      time = 0;
      return this;
    }

    /**
     * <code>optional uint32 Time = 2;</code>
     * @return the time
     */
    public int getTime() {
      return time;
    }

    /**
     * <code>optional uint32 Time = 2;</code>
     * @param value the time to set
     * @return this
     */
    public JointDrillSyncReq setTime(final int value) {
      bitField0_ |= 0x00000002;
      time = value;
      return this;
    }

    /**
     * <code>optional uint32 Damage = 3;</code>
     * @return whether the damage field is set
     */
    public boolean hasDamage() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 Damage = 3;</code>
     * @return this
     */
    public JointDrillSyncReq clearDamage() {
      bitField0_ &= ~0x00000004;
      damage = 0;
      return this;
    }

    /**
     * <code>optional uint32 Damage = 3;</code>
     * @return the damage
     */
    public int getDamage() {
      return damage;
    }

    /**
     * <code>optional uint32 Damage = 3;</code>
     * @param value the damage to set
     * @return this
     */
    public JointDrillSyncReq setDamage(final int value) {
      bitField0_ |= 0x00000004;
      damage = value;
      return this;
    }

    /**
     * <code>optional uint32 BossHp = 4;</code>
     * @return whether the bossHp field is set
     */
    public boolean hasBossHp() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 BossHp = 4;</code>
     * @return this
     */
    public JointDrillSyncReq clearBossHp() {
      bitField0_ &= ~0x00000008;
      bossHp = 0;
      return this;
    }

    /**
     * <code>optional uint32 BossHp = 4;</code>
     * @return the bossHp
     */
    public int getBossHp() {
      return bossHp;
    }

    /**
     * <code>optional uint32 BossHp = 4;</code>
     * @param value the bossHp to set
     * @return this
     */
    public JointDrillSyncReq setBossHp(final int value) {
      bitField0_ |= 0x00000008;
      bossHp = value;
      return this;
    }

    /**
     * <code>optional uint32 BossHpMax = 5;</code>
     * @return whether the bossHpMax field is set
     */
    public boolean hasBossHpMax() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional uint32 BossHpMax = 5;</code>
     * @return this
     */
    public JointDrillSyncReq clearBossHpMax() {
      bitField0_ &= ~0x00000010;
      bossHpMax = 0;
      return this;
    }

    /**
     * <code>optional uint32 BossHpMax = 5;</code>
     * @return the bossHpMax
     */
    public int getBossHpMax() {
      return bossHpMax;
    }

    /**
     * <code>optional uint32 BossHpMax = 5;</code>
     * @param value the bossHpMax to set
     * @return this
     */
    public JointDrillSyncReq setBossHpMax(final int value) {
      bitField0_ |= 0x00000010;
      bossHpMax = value;
      return this;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     * @return whether the record field is set
     */
    public boolean hasRecord() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     * @return this
     */
    public JointDrillSyncReq clearRecord() {
      bitField0_ &= ~0x00000020;
      record.clear();
      return this;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableRecord()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getRecord() {
      return record;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableRecord() {
      bitField0_ |= 0x00000020;
      return record;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     * @param value the record to add
     * @return this
     */
    public JointDrillSyncReq addRecord(final byte value) {
      bitField0_ |= 0x00000020;
      record.add(value);
      return this;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     * @param values the record to add
     * @return this
     */
    public JointDrillSyncReq addAllRecord(final byte... values) {
      bitField0_ |= 0x00000020;
      record.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes Record = 6;</code>
     * @param values the record to set
     * @return this
     */
    public JointDrillSyncReq setRecord(final byte... values) {
      bitField0_ |= 0x00000020;
      record.copyFrom(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public JointDrillSyncReq clearNextPackage() {
      bitField0_ &= ~0x00000040;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000040;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public JointDrillSyncReq addNextPackage(final byte value) {
      bitField0_ |= 0x00000040;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public JointDrillSyncReq addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000040;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public JointDrillSyncReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000040;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public JointDrillSyncReq copyFrom(final JointDrillSyncReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        floor = other.floor;
        time = other.time;
        damage = other.damage;
        bossHp = other.bossHp;
        bossHpMax = other.bossHpMax;
        record.copyFrom(other.record);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public JointDrillSyncReq mergeFrom(final JointDrillSyncReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasFloor()) {
        setFloor(other.floor);
      }
      if (other.hasTime()) {
        setTime(other.time);
      }
      if (other.hasDamage()) {
        setDamage(other.damage);
      }
      if (other.hasBossHp()) {
        setBossHp(other.bossHp);
      }
      if (other.hasBossHpMax()) {
        setBossHpMax(other.bossHpMax);
      }
      if (other.hasRecord()) {
        getMutableRecord().copyFrom(other.record);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public JointDrillSyncReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      floor = 0;
      time = 0;
      damage = 0;
      bossHp = 0;
      bossHpMax = 0;
      record.clear();
      nextPackage.clear();
      return this;
    }

    @Override
    public JointDrillSyncReq clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      record.clear();
      nextPackage.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof JointDrillSyncReq)) {
        return false;
      }
      JointDrillSyncReq other = (JointDrillSyncReq) o;
      return bitField0_ == other.bitField0_
        && (!hasFloor() || floor == other.floor)
        && (!hasTime() || time == other.time)
        && (!hasDamage() || damage == other.damage)
        && (!hasBossHp() || bossHp == other.bossHp)
        && (!hasBossHpMax() || bossHpMax == other.bossHpMax)
        && (!hasRecord() || record.equals(other.record))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(floor);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(time);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(damage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(bossHp);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(bossHpMax);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 50);
        output.writeBytesNoTag(record);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(floor);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(time);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(damage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(bossHp);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(bossHpMax);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 1 + ProtoSink.computeBytesSizeNoTag(record);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public JointDrillSyncReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // floor
            floor = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // time
            time = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // damage
            damage = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // bossHp
            bossHp = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // bossHpMax
            bossHpMax = input.readUInt32();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 50) {
              break;
            }
          }
          case 50: {
            // record
            input.readBytes(record);
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000040;
            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.floor, floor);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.time, time);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.damage, damage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.bossHp, bossHp);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeUInt32(FieldNames.bossHpMax, bossHpMax);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeBytes(FieldNames.record, record);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public JointDrillSyncReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 67974124: {
            if (input.isAtField(FieldNames.floor)) {
              if (!input.trySkipNullValue()) {
                floor = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2606829: {
            if (input.isAtField(FieldNames.time)) {
              if (!input.trySkipNullValue()) {
                time = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2039707535: {
            if (input.isAtField(FieldNames.damage)) {
              if (!input.trySkipNullValue()) {
                damage = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1995573621: {
            if (input.isAtField(FieldNames.bossHp)) {
              if (!input.trySkipNullValue()) {
                bossHp = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -803490897: {
            if (input.isAtField(FieldNames.bossHpMax)) {
              if (!input.trySkipNullValue()) {
                bossHpMax = input.readUInt32();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1851041679: {
            if (input.isAtField(FieldNames.record)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(record);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum JointDrillSyncReqFactory implements MessageFactory<JointDrillSyncReq> {
      INSTANCE;

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

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

      static final FieldName time = FieldName.forField("Time");

      static final FieldName damage = FieldName.forField("Damage");

      static final FieldName bossHp = FieldName.forField("BossHp");

      static final FieldName bossHpMax = FieldName.forField("BossHpMax");

      static final FieldName record = FieldName.forField("Record");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }
}
