// 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.Utf8String;

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

    /**
     * <pre>
     *  KNAHNGAACPJ
     * </pre>
     *
     * <code>optional uint32 group_id = 6;</code>
     */
    private int groupId;

    /**
     * <code>optional uint32 floor_id = 15;</code>
     */
    private int floorId;

    /**
     * <code>optional sint32 property_value = 5;</code>
     */
    private int propertyValue;

    /**
     * <code>optional string property_name = 7;</code>
     */
    private final Utf8String propertyName = Utf8String.newEmptyInstance();

    private UpdateGroupPropertyCsReq() {
    }

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

    /**
     * <pre>
     *  KNAHNGAACPJ
     * </pre>
     *
     * <code>optional uint32 group_id = 6;</code>
     * @return whether the groupId field is set
     */
    public boolean hasGroupId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <pre>
     *  KNAHNGAACPJ
     * </pre>
     *
     * <code>optional uint32 group_id = 6;</code>
     * @return this
     */
    public UpdateGroupPropertyCsReq clearGroupId() {
      bitField0_ &= ~0x00000001;
      groupId = 0;
      return this;
    }

    /**
     * <pre>
     *  KNAHNGAACPJ
     * </pre>
     *
     * <code>optional uint32 group_id = 6;</code>
     * @return the groupId
     */
    public int getGroupId() {
      return groupId;
    }

    /**
     * <pre>
     *  KNAHNGAACPJ
     * </pre>
     *
     * <code>optional uint32 group_id = 6;</code>
     * @param value the groupId to set
     * @return this
     */
    public UpdateGroupPropertyCsReq setGroupId(final int value) {
      bitField0_ |= 0x00000001;
      groupId = value;
      return this;
    }

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

    /**
     * <code>optional uint32 floor_id = 15;</code>
     * @return this
     */
    public UpdateGroupPropertyCsReq clearFloorId() {
      bitField0_ &= ~0x00000002;
      floorId = 0;
      return this;
    }

    /**
     * <code>optional uint32 floor_id = 15;</code>
     * @return the floorId
     */
    public int getFloorId() {
      return floorId;
    }

    /**
     * <code>optional uint32 floor_id = 15;</code>
     * @param value the floorId to set
     * @return this
     */
    public UpdateGroupPropertyCsReq setFloorId(final int value) {
      bitField0_ |= 0x00000002;
      floorId = value;
      return this;
    }

    /**
     * <code>optional sint32 property_value = 5;</code>
     * @return whether the propertyValue field is set
     */
    public boolean hasPropertyValue() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional sint32 property_value = 5;</code>
     * @return this
     */
    public UpdateGroupPropertyCsReq clearPropertyValue() {
      bitField0_ &= ~0x00000004;
      propertyValue = 0;
      return this;
    }

    /**
     * <code>optional sint32 property_value = 5;</code>
     * @return the propertyValue
     */
    public int getPropertyValue() {
      return propertyValue;
    }

    /**
     * <code>optional sint32 property_value = 5;</code>
     * @param value the propertyValue to set
     * @return this
     */
    public UpdateGroupPropertyCsReq setPropertyValue(final int value) {
      bitField0_ |= 0x00000004;
      propertyValue = value;
      return this;
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @return whether the propertyName field is set
     */
    public boolean hasPropertyName() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @return this
     */
    public UpdateGroupPropertyCsReq clearPropertyName() {
      bitField0_ &= ~0x00000008;
      propertyName.clear();
      return this;
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @return the propertyName
     */
    public String getPropertyName() {
      return propertyName.getString();
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @return internal {@code Utf8String} representation of propertyName for reading
     */
    public Utf8String getPropertyNameBytes() {
      return this.propertyName;
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @return internal {@code Utf8String} representation of propertyName for modifications
     */
    public Utf8String getMutablePropertyNameBytes() {
      bitField0_ |= 0x00000008;
      return this.propertyName;
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @param value the propertyName to set
     * @return this
     */
    public UpdateGroupPropertyCsReq setPropertyName(final CharSequence value) {
      bitField0_ |= 0x00000008;
      propertyName.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string property_name = 7;</code>
     * @param value the propertyName to set
     * @return this
     */
    public UpdateGroupPropertyCsReq setPropertyName(final Utf8String value) {
      bitField0_ |= 0x00000008;
      propertyName.copyFrom(value);
      return this;
    }

    @Override
    public UpdateGroupPropertyCsReq copyFrom(final UpdateGroupPropertyCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        groupId = other.groupId;
        floorId = other.floorId;
        propertyValue = other.propertyValue;
        propertyName.copyFrom(other.propertyName);
      }
      return this;
    }

    @Override
    public UpdateGroupPropertyCsReq mergeFrom(final UpdateGroupPropertyCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasGroupId()) {
        setGroupId(other.groupId);
      }
      if (other.hasFloorId()) {
        setFloorId(other.floorId);
      }
      if (other.hasPropertyValue()) {
        setPropertyValue(other.propertyValue);
      }
      if (other.hasPropertyName()) {
        getMutablePropertyNameBytes().copyFrom(other.propertyName);
      }
      return this;
    }

    @Override
    public UpdateGroupPropertyCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      groupId = 0;
      floorId = 0;
      propertyValue = 0;
      propertyName.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof UpdateGroupPropertyCsReq)) {
        return false;
      }
      UpdateGroupPropertyCsReq other = (UpdateGroupPropertyCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasGroupId() || groupId == other.groupId)
        && (!hasFloorId() || floorId == other.floorId)
        && (!hasPropertyValue() || propertyValue == other.propertyValue)
        && (!hasPropertyName() || propertyName.equals(other.propertyName));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(groupId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(floorId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 40);
        output.writeSInt32NoTag(propertyValue);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 58);
        output.writeStringNoTag(propertyName);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(groupId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(floorId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeSInt32SizeNoTag(propertyValue);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeStringSizeNoTag(propertyName);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public UpdateGroupPropertyCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 48: {
            // groupId
            groupId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // floorId
            floorId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // propertyValue
            propertyValue = input.readSInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 58) {
              break;
            }
          }
          case 58: {
            // propertyName
            input.readString(propertyName);
            bitField0_ |= 0x00000008;
            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.groupId, groupId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.floorId, floorId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeSInt32(FieldNames.propertyValue, propertyValue);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeString(FieldNames.propertyName, propertyName);
      }
      output.endObject();
    }

    @Override
    public UpdateGroupPropertyCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 293428218:
          case 506361563: {
            if (input.isAtField(FieldNames.groupId)) {
              if (!input.trySkipNullValue()) {
                groupId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -766027193:
          case 2022982190: {
            if (input.isAtField(FieldNames.floorId)) {
              if (!input.trySkipNullValue()) {
                floorId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1028251492:
          case -1534304633: {
            if (input.isAtField(FieldNames.propertyValue)) {
              if (!input.trySkipNullValue()) {
                propertyValue = input.readSInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -864691712:
          case -1019563339: {
            if (input.isAtField(FieldNames.propertyName)) {
              if (!input.trySkipNullValue()) {
                input.readString(propertyName);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum UpdateGroupPropertyCsReqFactory implements MessageFactory<UpdateGroupPropertyCsReq> {
      INSTANCE;

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

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

      static final FieldName floorId = FieldName.forField("floorId", "floor_id");

      static final FieldName propertyValue = FieldName.forField("propertyValue", "property_value");

      static final FieldName propertyName = FieldName.forField("propertyName", "property_name");
    }
  }
}
