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

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

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

    private GetBigDataRecommendCsReq() {
    }

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

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

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

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

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

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

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

    /**
     * <code>optional .BigDataRecommendType recommend_type = 2;</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 GetBigDataRecommendCsReq#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 GetBigDataRecommendCsReq#getRecommendType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public GetBigDataRecommendCsReq setRecommendTypeValue(final int value) {
      bitField0_ |= 0x00000002;
      recommendType = value;
      return this;
    }

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

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

    @Override
    public GetBigDataRecommendCsReq mergeFrom(final GetBigDataRecommendCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasTrailblazerPathId()) {
        setTrailblazerPathId(other.trailblazerPathId);
      }
      if (other.hasRecommendType()) {
        setRecommendTypeValue(other.recommendType);
      }
      return this;
    }

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

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

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 72);
        output.writeUInt32NoTag(trailblazerPathId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeEnumNoTag(recommendType);
      }
    }

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

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

    @Override
    public GetBigDataRecommendCsReq 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 -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_ |= 0x00000002;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetBigDataRecommendCsReqFactory implements MessageFactory<GetBigDataRecommendCsReq> {
      INSTANCE;

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

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

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