// 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;
import us.hebi.quickbuf.ProtoUtil;

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

    /**
     * <code>optional double max_hp = 1;</code>
     */
    private double maxHp;

    /**
     * <code>optional double attack = 2;</code>
     */
    private double attack;

    /**
     * <code>optional double defence = 3;</code>
     */
    private double defence;

    /**
     * <code>optional double speed = 4;</code>
     */
    private double speed;

    /**
     * <code>optional double left_hp = 5;</code>
     */
    private double leftHp;

    /**
     * <code>optional double left_sp = 6;</code>
     */
    private double leftSp;

    /**
     * <code>optional double max_sp = 7;</code>
     */
    private double maxSp;

    private AvatarProperty() {
    }

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

    /**
     * <code>optional double max_hp = 1;</code>
     * @return whether the maxHp field is set
     */
    public boolean hasMaxHp() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional double max_hp = 1;</code>
     * @return this
     */
    public AvatarProperty clearMaxHp() {
      bitField0_ &= ~0x00000001;
      maxHp = 0D;
      return this;
    }

    /**
     * <code>optional double max_hp = 1;</code>
     * @return the maxHp
     */
    public double getMaxHp() {
      return maxHp;
    }

    /**
     * <code>optional double max_hp = 1;</code>
     * @param value the maxHp to set
     * @return this
     */
    public AvatarProperty setMaxHp(final double value) {
      bitField0_ |= 0x00000001;
      maxHp = value;
      return this;
    }

    /**
     * <code>optional double attack = 2;</code>
     * @return whether the attack field is set
     */
    public boolean hasAttack() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional double attack = 2;</code>
     * @return this
     */
    public AvatarProperty clearAttack() {
      bitField0_ &= ~0x00000002;
      attack = 0D;
      return this;
    }

    /**
     * <code>optional double attack = 2;</code>
     * @return the attack
     */
    public double getAttack() {
      return attack;
    }

    /**
     * <code>optional double attack = 2;</code>
     * @param value the attack to set
     * @return this
     */
    public AvatarProperty setAttack(final double value) {
      bitField0_ |= 0x00000002;
      attack = value;
      return this;
    }

    /**
     * <code>optional double defence = 3;</code>
     * @return whether the defence field is set
     */
    public boolean hasDefence() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional double defence = 3;</code>
     * @return this
     */
    public AvatarProperty clearDefence() {
      bitField0_ &= ~0x00000004;
      defence = 0D;
      return this;
    }

    /**
     * <code>optional double defence = 3;</code>
     * @return the defence
     */
    public double getDefence() {
      return defence;
    }

    /**
     * <code>optional double defence = 3;</code>
     * @param value the defence to set
     * @return this
     */
    public AvatarProperty setDefence(final double value) {
      bitField0_ |= 0x00000004;
      defence = value;
      return this;
    }

    /**
     * <code>optional double speed = 4;</code>
     * @return whether the speed field is set
     */
    public boolean hasSpeed() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional double speed = 4;</code>
     * @return this
     */
    public AvatarProperty clearSpeed() {
      bitField0_ &= ~0x00000008;
      speed = 0D;
      return this;
    }

    /**
     * <code>optional double speed = 4;</code>
     * @return the speed
     */
    public double getSpeed() {
      return speed;
    }

    /**
     * <code>optional double speed = 4;</code>
     * @param value the speed to set
     * @return this
     */
    public AvatarProperty setSpeed(final double value) {
      bitField0_ |= 0x00000008;
      speed = value;
      return this;
    }

    /**
     * <code>optional double left_hp = 5;</code>
     * @return whether the leftHp field is set
     */
    public boolean hasLeftHp() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional double left_hp = 5;</code>
     * @return this
     */
    public AvatarProperty clearLeftHp() {
      bitField0_ &= ~0x00000010;
      leftHp = 0D;
      return this;
    }

    /**
     * <code>optional double left_hp = 5;</code>
     * @return the leftHp
     */
    public double getLeftHp() {
      return leftHp;
    }

    /**
     * <code>optional double left_hp = 5;</code>
     * @param value the leftHp to set
     * @return this
     */
    public AvatarProperty setLeftHp(final double value) {
      bitField0_ |= 0x00000010;
      leftHp = value;
      return this;
    }

    /**
     * <code>optional double left_sp = 6;</code>
     * @return whether the leftSp field is set
     */
    public boolean hasLeftSp() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional double left_sp = 6;</code>
     * @return this
     */
    public AvatarProperty clearLeftSp() {
      bitField0_ &= ~0x00000020;
      leftSp = 0D;
      return this;
    }

    /**
     * <code>optional double left_sp = 6;</code>
     * @return the leftSp
     */
    public double getLeftSp() {
      return leftSp;
    }

    /**
     * <code>optional double left_sp = 6;</code>
     * @param value the leftSp to set
     * @return this
     */
    public AvatarProperty setLeftSp(final double value) {
      bitField0_ |= 0x00000020;
      leftSp = value;
      return this;
    }

    /**
     * <code>optional double max_sp = 7;</code>
     * @return whether the maxSp field is set
     */
    public boolean hasMaxSp() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional double max_sp = 7;</code>
     * @return this
     */
    public AvatarProperty clearMaxSp() {
      bitField0_ &= ~0x00000040;
      maxSp = 0D;
      return this;
    }

    /**
     * <code>optional double max_sp = 7;</code>
     * @return the maxSp
     */
    public double getMaxSp() {
      return maxSp;
    }

    /**
     * <code>optional double max_sp = 7;</code>
     * @param value the maxSp to set
     * @return this
     */
    public AvatarProperty setMaxSp(final double value) {
      bitField0_ |= 0x00000040;
      maxSp = value;
      return this;
    }

    @Override
    public AvatarProperty copyFrom(final AvatarProperty other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        maxHp = other.maxHp;
        attack = other.attack;
        defence = other.defence;
        speed = other.speed;
        leftHp = other.leftHp;
        leftSp = other.leftSp;
        maxSp = other.maxSp;
      }
      return this;
    }

    @Override
    public AvatarProperty mergeFrom(final AvatarProperty other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasMaxHp()) {
        setMaxHp(other.maxHp);
      }
      if (other.hasAttack()) {
        setAttack(other.attack);
      }
      if (other.hasDefence()) {
        setDefence(other.defence);
      }
      if (other.hasSpeed()) {
        setSpeed(other.speed);
      }
      if (other.hasLeftHp()) {
        setLeftHp(other.leftHp);
      }
      if (other.hasLeftSp()) {
        setLeftSp(other.leftSp);
      }
      if (other.hasMaxSp()) {
        setMaxSp(other.maxSp);
      }
      return this;
    }

    @Override
    public AvatarProperty clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      maxHp = 0D;
      attack = 0D;
      defence = 0D;
      speed = 0D;
      leftHp = 0D;
      leftSp = 0D;
      maxSp = 0D;
      return this;
    }

    @Override
    public AvatarProperty 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 AvatarProperty)) {
        return false;
      }
      AvatarProperty other = (AvatarProperty) o;
      return bitField0_ == other.bitField0_
        && (!hasMaxHp() || ProtoUtil.isEqual(maxHp, other.maxHp))
        && (!hasAttack() || ProtoUtil.isEqual(attack, other.attack))
        && (!hasDefence() || ProtoUtil.isEqual(defence, other.defence))
        && (!hasSpeed() || ProtoUtil.isEqual(speed, other.speed))
        && (!hasLeftHp() || ProtoUtil.isEqual(leftHp, other.leftHp))
        && (!hasLeftSp() || ProtoUtil.isEqual(leftSp, other.leftSp))
        && (!hasMaxSp() || ProtoUtil.isEqual(maxSp, other.maxSp));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 9);
        output.writeDoubleNoTag(maxHp);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 17);
        output.writeDoubleNoTag(attack);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 25);
        output.writeDoubleNoTag(defence);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 33);
        output.writeDoubleNoTag(speed);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 41);
        output.writeDoubleNoTag(leftHp);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 49);
        output.writeDoubleNoTag(leftSp);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawByte((byte) 57);
        output.writeDoubleNoTag(maxSp);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 9;
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public AvatarProperty mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 9: {
            // maxHp
            maxHp = input.readDouble();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 17) {
              break;
            }
          }
          case 17: {
            // attack
            attack = input.readDouble();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 25) {
              break;
            }
          }
          case 25: {
            // defence
            defence = input.readDouble();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 33) {
              break;
            }
          }
          case 33: {
            // speed
            speed = input.readDouble();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 41) {
              break;
            }
          }
          case 41: {
            // leftHp
            leftHp = input.readDouble();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 49) {
              break;
            }
          }
          case 49: {
            // leftSp
            leftSp = input.readDouble();
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 57) {
              break;
            }
          }
          case 57: {
            // maxSp
            maxSp = input.readDouble();
            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.writeDouble(FieldNames.maxHp, maxHp);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeDouble(FieldNames.attack, attack);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeDouble(FieldNames.defence, defence);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeDouble(FieldNames.speed, speed);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeDouble(FieldNames.leftHp, leftHp);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeDouble(FieldNames.leftSp, leftSp);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeDouble(FieldNames.maxSp, maxSp);
      }
      output.endObject();
    }

    @Override
    public AvatarProperty mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 103671180:
          case -1081138749: {
            if (input.isAtField(FieldNames.maxHp)) {
              if (!input.trySkipNullValue()) {
                maxHp = input.readDouble();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1407259064: {
            if (input.isAtField(FieldNames.attack)) {
              if (!input.trySkipNullValue()) {
                attack = input.readDouble();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1544916048: {
            if (input.isAtField(FieldNames.defence)) {
              if (!input.trySkipNullValue()) {
                defence = input.readDouble();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 109641799: {
            if (input.isAtField(FieldNames.speed)) {
              if (!input.trySkipNullValue()) {
                speed = input.readDouble();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1106590865:
          case 55443520: {
            if (input.isAtField(FieldNames.leftHp)) {
              if (!input.trySkipNullValue()) {
                leftHp = input.readDouble();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1106590524:
          case 55443861: {
            if (input.isAtField(FieldNames.leftSp)) {
              if (!input.trySkipNullValue()) {
                leftSp = input.readDouble();
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 103671521:
          case -1081138408: {
            if (input.isAtField(FieldNames.maxSp)) {
              if (!input.trySkipNullValue()) {
                maxSp = input.readDouble();
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum AvatarPropertyFactory implements MessageFactory<AvatarProperty> {
      INSTANCE;

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

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

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

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

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

      static final FieldName leftHp = FieldName.forField("leftHp", "left_hp");

      static final FieldName leftSp = FieldName.forField("leftSp", "left_sp");

      static final FieldName maxSp = FieldName.forField("maxSp", "max_sp");
    }
  }
}
