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

    /**
     * <code>optional uint32 trailblazer_path_id = 4;</code>
     */
    private int trailblazerPathId;

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

    /**
     * <code>optional .BigDataRecommendType recommend_type = 15;</code>
     */
    private int recommendType;

    /**
     * <code>optional bool do_enable = 6;</code>
     */
    private boolean doEnable;

    private GetBigDataRecommendScRsp() {
    }

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

    /**
     * <code>optional uint32 trailblazer_path_id = 4;</code>
     * @return whether the trailblazerPathId field is set
     */
    public boolean hasTrailblazerPathId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 trailblazer_path_id = 4;</code>
     * @return this
     */
    public GetBigDataRecommendScRsp clearTrailblazerPathId() {
      bitField0_ &= ~0x00000001;
      trailblazerPathId = 0;
      return this;
    }

    /**
     * <code>optional uint32 trailblazer_path_id = 4;</code>
     * @return the trailblazerPathId
     */
    public int getTrailblazerPathId() {
      return trailblazerPathId;
    }

    /**
     * <code>optional uint32 trailblazer_path_id = 4;</code>
     * @param value the trailblazerPathId to set
     * @return this
     */
    public GetBigDataRecommendScRsp setTrailblazerPathId(final int value) {
      bitField0_ |= 0x00000001;
      trailblazerPathId = value;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @return whether the retcode field is set
     */
    public boolean hasRetcode() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @return this
     */
    public GetBigDataRecommendScRsp clearRetcode() {
      bitField0_ &= ~0x00000002;
      retcode = 0;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @return the retcode
     */
    public int getRetcode() {
      return retcode;
    }

    /**
     * <code>optional uint32 retcode = 7;</code>
     * @param value the retcode to set
     * @return this
     */
    public GetBigDataRecommendScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000002;
      retcode = value;
      return this;
    }

    /**
     * <code>optional .BigDataRecommendType recommend_type = 15;</code>
     * @return whether the recommendType field is set
     */
    public boolean hasRecommendType() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .BigDataRecommendType recommend_type = 15;</code>
     * @return this
     */
    public GetBigDataRecommendScRsp clearRecommendType() {
      bitField0_ &= ~0x00000004;
      recommendType = 0;
      return this;
    }

    /**
     * <code>optional .BigDataRecommendType recommend_type = 15;</code>
     * @return the recommendType
     */
    public BigDataRecommendTypeOuterClass.BigDataRecommendType getRecommendType() {
      return BigDataRecommendTypeOuterClass.BigDataRecommendType.forNumber(recommendType);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link GetBigDataRecommendScRsp#getRecommendType()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getRecommendTypeValue() {
      return recommendType;
    }

    /**
     * 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 BigDataRecommendTypeOuterClass.BigDataRecommendType}. Setting an invalid value
     * can cause {@link GetBigDataRecommendScRsp#getRecommendType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public GetBigDataRecommendScRsp setRecommendTypeValue(final int value) {
      bitField0_ |= 0x00000004;
      recommendType = value;
      return this;
    }

    /**
     * <code>optional .BigDataRecommendType recommend_type = 15;</code>
     * @param value the recommendType to set
     * @return this
     */
    public GetBigDataRecommendScRsp setRecommendType(
        final BigDataRecommendTypeOuterClass.BigDataRecommendType value) {
      bitField0_ |= 0x00000004;
      recommendType = value.getNumber();
      return this;
    }

    /**
     * <code>optional bool do_enable = 6;</code>
     * @return whether the doEnable field is set
     */
    public boolean hasDoEnable() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bool do_enable = 6;</code>
     * @return this
     */
    public GetBigDataRecommendScRsp clearDoEnable() {
      bitField0_ &= ~0x00000008;
      doEnable = false;
      return this;
    }

    /**
     * <code>optional bool do_enable = 6;</code>
     * @return the doEnable
     */
    public boolean getDoEnable() {
      return doEnable;
    }

    /**
     * <code>optional bool do_enable = 6;</code>
     * @param value the doEnable to set
     * @return this
     */
    public GetBigDataRecommendScRsp setDoEnable(final boolean value) {
      bitField0_ |= 0x00000008;
      doEnable = value;
      return this;
    }

    @Override
    public GetBigDataRecommendScRsp copyFrom(final GetBigDataRecommendScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        trailblazerPathId = other.trailblazerPathId;
        retcode = other.retcode;
        recommendType = other.recommendType;
        doEnable = other.doEnable;
      }
      return this;
    }

    @Override
    public GetBigDataRecommendScRsp mergeFrom(final GetBigDataRecommendScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasTrailblazerPathId()) {
        setTrailblazerPathId(other.trailblazerPathId);
      }
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasRecommendType()) {
        setRecommendTypeValue(other.recommendType);
      }
      if (other.hasDoEnable()) {
        setDoEnable(other.doEnable);
      }
      return this;
    }

    @Override
    public GetBigDataRecommendScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      trailblazerPathId = 0;
      retcode = 0;
      recommendType = 0;
      doEnable = false;
      return this;
    }

    @Override
    public GetBigDataRecommendScRsp 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 GetBigDataRecommendScRsp)) {
        return false;
      }
      GetBigDataRecommendScRsp other = (GetBigDataRecommendScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasTrailblazerPathId() || trailblazerPathId == other.trailblazerPathId)
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasRecommendType() || recommendType == other.recommendType)
        && (!hasDoEnable() || doEnable == other.doEnable);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(trailblazerPathId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 120);
        output.writeEnumNoTag(recommendType);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 48);
        output.writeBoolNoTag(doEnable);
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public GetBigDataRecommendScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 32: {
            // trailblazerPathId
            trailblazerPathId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // recommendType
            final int value = input.readInt32();
            if (BigDataRecommendTypeOuterClass.BigDataRecommendType.forNumber(value) != null) {
              recommendType = value;
              bitField0_ |= 0x00000004;
            }
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // doEnable
            doEnable = input.readBool();
            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.trailblazerPathId, trailblazerPathId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.retcode, retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeEnum(FieldNames.recommendType, recommendType, BigDataRecommendTypeOuterClass.BigDataRecommendType.converter());
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBool(FieldNames.doEnable, doEnable);
      }
      output.endObject();
    }

    @Override
    public GetBigDataRecommendScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1655344950:
          case 1916652460: {
            if (input.isAtField(FieldNames.trailblazerPathId)) {
              if (!input.trySkipNullValue()) {
                trailblazerPathId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1097936398: {
            if (input.isAtField(FieldNames.retcode)) {
              if (!input.trySkipNullValue()) {
                retcode = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1141942762:
          case -1030468387: {
            if (input.isAtField(FieldNames.recommendType)) {
              if (!input.trySkipNullValue()) {
                final BigDataRecommendTypeOuterClass.BigDataRecommendType value = input.readEnum(BigDataRecommendTypeOuterClass.BigDataRecommendType.converter());
                if (value != null) {
                  recommendType = value.getNumber();
                  bitField0_ |= 0x00000004;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -3978770:
          case 1231221687: {
            if (input.isAtField(FieldNames.doEnable)) {
              if (!input.trySkipNullValue()) {
                doEnable = input.readBool();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetBigDataRecommendScRspFactory implements MessageFactory<GetBigDataRecommendScRsp> {
      INSTANCE;

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

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

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

      static final FieldName recommendType = FieldName.forField("recommendType", "recommend_type");

      static final FieldName doEnable = FieldName.forField("doEnable", "do_enable");
    }
  }
}
