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

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

    private GetBigDataAllRecommendCsReq() {
    }

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

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

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

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

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

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

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

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

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

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

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

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

    @Override
    public GetBigDataAllRecommendCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          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_ |= 0x00000001;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetBigDataAllRecommendCsReqFactory implements MessageFactory<GetBigDataAllRecommendCsReq> {
      INSTANCE;

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

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