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

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

    /**
     * <code>optional uint32 trigger_entity_id = 10;</code>
     */
    private int triggerEntityId;

    /**
     * <code>optional bool refresh_trigger = 13;</code>
     */
    private boolean refreshTrigger;

    /**
     * <code>optional string trigger_name = 9;</code>
     */
    private final Utf8String triggerName = Utf8String.newEmptyInstance();

    private RefreshTriggerByClientScRsp() {
    }

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

    /**
     * <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 RefreshTriggerByClientScRsp 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 RefreshTriggerByClientScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000001;
      retcode = value;
      return this;
    }

    /**
     * <code>optional uint32 trigger_entity_id = 10;</code>
     * @return whether the triggerEntityId field is set
     */
    public boolean hasTriggerEntityId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 trigger_entity_id = 10;</code>
     * @return this
     */
    public RefreshTriggerByClientScRsp clearTriggerEntityId() {
      bitField0_ &= ~0x00000002;
      triggerEntityId = 0;
      return this;
    }

    /**
     * <code>optional uint32 trigger_entity_id = 10;</code>
     * @return the triggerEntityId
     */
    public int getTriggerEntityId() {
      return triggerEntityId;
    }

    /**
     * <code>optional uint32 trigger_entity_id = 10;</code>
     * @param value the triggerEntityId to set
     * @return this
     */
    public RefreshTriggerByClientScRsp setTriggerEntityId(final int value) {
      bitField0_ |= 0x00000002;
      triggerEntityId = value;
      return this;
    }

    /**
     * <code>optional bool refresh_trigger = 13;</code>
     * @return whether the refreshTrigger field is set
     */
    public boolean hasRefreshTrigger() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional bool refresh_trigger = 13;</code>
     * @return this
     */
    public RefreshTriggerByClientScRsp clearRefreshTrigger() {
      bitField0_ &= ~0x00000004;
      refreshTrigger = false;
      return this;
    }

    /**
     * <code>optional bool refresh_trigger = 13;</code>
     * @return the refreshTrigger
     */
    public boolean getRefreshTrigger() {
      return refreshTrigger;
    }

    /**
     * <code>optional bool refresh_trigger = 13;</code>
     * @param value the refreshTrigger to set
     * @return this
     */
    public RefreshTriggerByClientScRsp setRefreshTrigger(final boolean value) {
      bitField0_ |= 0x00000004;
      refreshTrigger = value;
      return this;
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @return whether the triggerName field is set
     */
    public boolean hasTriggerName() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @return this
     */
    public RefreshTriggerByClientScRsp clearTriggerName() {
      bitField0_ &= ~0x00000008;
      triggerName.clear();
      return this;
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @return the triggerName
     */
    public String getTriggerName() {
      return triggerName.getString();
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @return internal {@code Utf8String} representation of triggerName for reading
     */
    public Utf8String getTriggerNameBytes() {
      return this.triggerName;
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @return internal {@code Utf8String} representation of triggerName for modifications
     */
    public Utf8String getMutableTriggerNameBytes() {
      bitField0_ |= 0x00000008;
      return this.triggerName;
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @param value the triggerName to set
     * @return this
     */
    public RefreshTriggerByClientScRsp setTriggerName(final CharSequence value) {
      bitField0_ |= 0x00000008;
      triggerName.copyFrom(value);
      return this;
    }

    /**
     * <code>optional string trigger_name = 9;</code>
     * @param value the triggerName to set
     * @return this
     */
    public RefreshTriggerByClientScRsp setTriggerName(final Utf8String value) {
      bitField0_ |= 0x00000008;
      triggerName.copyFrom(value);
      return this;
    }

    @Override
    public RefreshTriggerByClientScRsp copyFrom(final RefreshTriggerByClientScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        triggerEntityId = other.triggerEntityId;
        refreshTrigger = other.refreshTrigger;
        triggerName.copyFrom(other.triggerName);
      }
      return this;
    }

    @Override
    public RefreshTriggerByClientScRsp mergeFrom(final RefreshTriggerByClientScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasTriggerEntityId()) {
        setTriggerEntityId(other.triggerEntityId);
      }
      if (other.hasRefreshTrigger()) {
        setRefreshTrigger(other.refreshTrigger);
      }
      if (other.hasTriggerName()) {
        getMutableTriggerNameBytes().copyFrom(other.triggerName);
      }
      return this;
    }

    @Override
    public RefreshTriggerByClientScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      triggerEntityId = 0;
      refreshTrigger = false;
      triggerName.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RefreshTriggerByClientScRsp)) {
        return false;
      }
      RefreshTriggerByClientScRsp other = (RefreshTriggerByClientScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasTriggerEntityId() || triggerEntityId == other.triggerEntityId)
        && (!hasRefreshTrigger() || refreshTrigger == other.refreshTrigger)
        && (!hasTriggerName() || triggerName.equals(other.triggerName));
    }

    @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) 80);
        output.writeUInt32NoTag(triggerEntityId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 104);
        output.writeBoolNoTag(refreshTrigger);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 74);
        output.writeStringNoTag(triggerName);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(triggerEntityId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeStringSizeNoTag(triggerName);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RefreshTriggerByClientScRsp 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 != 80) {
              break;
            }
          }
          case 80: {
            // triggerEntityId
            triggerEntityId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 104) {
              break;
            }
          }
          case 104: {
            // refreshTrigger
            refreshTrigger = input.readBool();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 74) {
              break;
            }
          }
          case 74: {
            // triggerName
            input.readString(triggerName);
            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.retcode, retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.triggerEntityId, triggerEntityId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBool(FieldNames.refreshTrigger, refreshTrigger);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeString(FieldNames.triggerName, triggerName);
      }
      output.endObject();
    }

    @Override
    public RefreshTriggerByClientScRsp 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 242025014:
          case -2081789648: {
            if (input.isAtField(FieldNames.triggerEntityId)) {
              if (!input.trySkipNullValue()) {
                triggerEntityId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1616019037:
          case -1712421804: {
            if (input.isAtField(FieldNames.refreshTrigger)) {
              if (!input.trySkipNullValue()) {
                refreshTrigger = input.readBool();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -681138077:
          case 375632050: {
            if (input.isAtField(FieldNames.triggerName)) {
              if (!input.trySkipNullValue()) {
                input.readString(triggerName);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum RefreshTriggerByClientScRspFactory implements MessageFactory<RefreshTriggerByClientScRsp> {
      INSTANCE;

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

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

      static final FieldName triggerEntityId = FieldName.forField("triggerEntityId", "trigger_entity_id");

      static final FieldName refreshTrigger = FieldName.forField("refreshTrigger", "refresh_trigger");

      static final FieldName triggerName = FieldName.forField("triggerName", "trigger_name");
    }
  }
}
