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

    /**
     * <code>optional uint32 base_avatar_id = 5;</code>
     */
    private int baseAvatarId;

    /**
     * <code>optional .MultiPathAvatarType changed_avatar_type = 7;</code>
     */
    private int changedAvatarType;

    private AvatarPathChangedNotify() {
    }

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

    /**
     * <code>optional uint32 base_avatar_id = 5;</code>
     * @return whether the baseAvatarId field is set
     */
    public boolean hasBaseAvatarId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 base_avatar_id = 5;</code>
     * @return this
     */
    public AvatarPathChangedNotify clearBaseAvatarId() {
      bitField0_ &= ~0x00000001;
      baseAvatarId = 0;
      return this;
    }

    /**
     * <code>optional uint32 base_avatar_id = 5;</code>
     * @return the baseAvatarId
     */
    public int getBaseAvatarId() {
      return baseAvatarId;
    }

    /**
     * <code>optional uint32 base_avatar_id = 5;</code>
     * @param value the baseAvatarId to set
     * @return this
     */
    public AvatarPathChangedNotify setBaseAvatarId(final int value) {
      bitField0_ |= 0x00000001;
      baseAvatarId = value;
      return this;
    }

    /**
     * <code>optional .MultiPathAvatarType changed_avatar_type = 7;</code>
     * @return whether the changedAvatarType field is set
     */
    public boolean hasChangedAvatarType() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .MultiPathAvatarType changed_avatar_type = 7;</code>
     * @return this
     */
    public AvatarPathChangedNotify clearChangedAvatarType() {
      bitField0_ &= ~0x00000002;
      changedAvatarType = 0;
      return this;
    }

    /**
     * <code>optional .MultiPathAvatarType changed_avatar_type = 7;</code>
     * @return the changedAvatarType
     */
    public MultiPathAvatarTypeOuterClass.MultiPathAvatarType getChangedAvatarType() {
      return MultiPathAvatarTypeOuterClass.MultiPathAvatarType.forNumber(changedAvatarType);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link AvatarPathChangedNotify#getChangedAvatarType()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getChangedAvatarTypeValue() {
      return changedAvatarType;
    }

    /**
     * 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 MultiPathAvatarTypeOuterClass.MultiPathAvatarType}. Setting an invalid value
     * can cause {@link AvatarPathChangedNotify#getChangedAvatarType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public AvatarPathChangedNotify setChangedAvatarTypeValue(final int value) {
      bitField0_ |= 0x00000002;
      changedAvatarType = value;
      return this;
    }

    /**
     * <code>optional .MultiPathAvatarType changed_avatar_type = 7;</code>
     * @param value the changedAvatarType to set
     * @return this
     */
    public AvatarPathChangedNotify setChangedAvatarType(
        final MultiPathAvatarTypeOuterClass.MultiPathAvatarType value) {
      bitField0_ |= 0x00000002;
      changedAvatarType = value.getNumber();
      return this;
    }

    @Override
    public AvatarPathChangedNotify copyFrom(final AvatarPathChangedNotify other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        baseAvatarId = other.baseAvatarId;
        changedAvatarType = other.changedAvatarType;
      }
      return this;
    }

    @Override
    public AvatarPathChangedNotify mergeFrom(final AvatarPathChangedNotify other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasBaseAvatarId()) {
        setBaseAvatarId(other.baseAvatarId);
      }
      if (other.hasChangedAvatarType()) {
        setChangedAvatarTypeValue(other.changedAvatarType);
      }
      return this;
    }

    @Override
    public AvatarPathChangedNotify clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      baseAvatarId = 0;
      changedAvatarType = 0;
      return this;
    }

    @Override
    public AvatarPathChangedNotify 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 AvatarPathChangedNotify)) {
        return false;
      }
      AvatarPathChangedNotify other = (AvatarPathChangedNotify) o;
      return bitField0_ == other.bitField0_
        && (!hasBaseAvatarId() || baseAvatarId == other.baseAvatarId)
        && (!hasChangedAvatarType() || changedAvatarType == other.changedAvatarType);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(baseAvatarId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 56);
        output.writeEnumNoTag(changedAvatarType);
      }
    }

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

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

    @Override
    public AvatarPathChangedNotify mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 118022725:
          case -1756826157: {
            if (input.isAtField(FieldNames.baseAvatarId)) {
              if (!input.trySkipNullValue()) {
                baseAvatarId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1985011207:
          case 1120127317: {
            if (input.isAtField(FieldNames.changedAvatarType)) {
              if (!input.trySkipNullValue()) {
                final MultiPathAvatarTypeOuterClass.MultiPathAvatarType value = input.readEnum(MultiPathAvatarTypeOuterClass.MultiPathAvatarType.converter());
                if (value != null) {
                  changedAvatarType = value.getNumber();
                  bitField0_ |= 0x00000002;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum AvatarPathChangedNotifyFactory implements MessageFactory<AvatarPathChangedNotify> {
      INSTANCE;

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

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

      static final FieldName changedAvatarType = FieldName.forField("changedAvatarType", "changed_avatar_type");
    }
  }
}
