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

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

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

    /**
     * <code>optional .AvatarReccomendData avatar_reccomend_data = 4;</code>
     */
    private final AvatarReccomendDataOuterClass.AvatarReccomendData avatarReccomendData = AvatarReccomendDataOuterClass.AvatarReccomendData.newInstance();

    /**
     * <code>optional .RelicReccomendData relic_reccomend_data = 15;</code>
     */
    private final RelicReccomendDataOuterClass.RelicReccomendData relicReccomendData = RelicReccomendDataOuterClass.RelicReccomendData.newInstance();

    private GetBigDataAllRecommendScRsp() {
    }

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

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

    /**
     * <code>optional uint32 retcode = 5;</code>
     * @return this
     */
    public GetBigDataAllRecommendScRsp clearRetcode() {
      bitField0_ &= ~0x00000001;
      retcode = 0;
      return this;
    }

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

    /**
     * <code>optional uint32 retcode = 5;</code>
     * @param value the retcode to set
     * @return this
     */
    public GetBigDataAllRecommendScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000001;
      retcode = 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 GetBigDataAllRecommendScRsp 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 GetBigDataAllRecommendScRsp#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 GetBigDataAllRecommendScRsp#getRecommendType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public GetBigDataAllRecommendScRsp 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 GetBigDataAllRecommendScRsp setRecommendType(
        final BigDataRecommendTypeOuterClass.BigDataRecommendType value) {
      bitField0_ |= 0x00000002;
      recommendType = value.getNumber();
      return this;
    }

    /**
     * <code>optional .AvatarReccomendData avatar_reccomend_data = 4;</code>
     * @return whether the avatarReccomendData field is set
     */
    public boolean hasAvatarReccomendData() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .AvatarReccomendData avatar_reccomend_data = 4;</code>
     * @return this
     */
    public GetBigDataAllRecommendScRsp clearAvatarReccomendData() {
      bitField0_ &= ~0x00000004;
      avatarReccomendData.clear();
      return this;
    }

    /**
     * <code>optional .AvatarReccomendData avatar_reccomend_data = 4;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableAvatarReccomendData()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public AvatarReccomendDataOuterClass.AvatarReccomendData getAvatarReccomendData() {
      return avatarReccomendData;
    }

    /**
     * <code>optional .AvatarReccomendData avatar_reccomend_data = 4;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public AvatarReccomendDataOuterClass.AvatarReccomendData getMutableAvatarReccomendData() {
      bitField0_ |= 0x00000004;
      return avatarReccomendData;
    }

    /**
     * <code>optional .AvatarReccomendData avatar_reccomend_data = 4;</code>
     * @param value the avatarReccomendData to set
     * @return this
     */
    public GetBigDataAllRecommendScRsp setAvatarReccomendData(
        final AvatarReccomendDataOuterClass.AvatarReccomendData value) {
      bitField0_ |= 0x00000004;
      avatarReccomendData.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .RelicReccomendData relic_reccomend_data = 15;</code>
     * @return whether the relicReccomendData field is set
     */
    public boolean hasRelicReccomendData() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .RelicReccomendData relic_reccomend_data = 15;</code>
     * @return this
     */
    public GetBigDataAllRecommendScRsp clearRelicReccomendData() {
      bitField0_ &= ~0x00000008;
      relicReccomendData.clear();
      return this;
    }

    /**
     * <code>optional .RelicReccomendData relic_reccomend_data = 15;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableRelicReccomendData()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RelicReccomendDataOuterClass.RelicReccomendData getRelicReccomendData() {
      return relicReccomendData;
    }

    /**
     * <code>optional .RelicReccomendData relic_reccomend_data = 15;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RelicReccomendDataOuterClass.RelicReccomendData getMutableRelicReccomendData() {
      bitField0_ |= 0x00000008;
      return relicReccomendData;
    }

    /**
     * <code>optional .RelicReccomendData relic_reccomend_data = 15;</code>
     * @param value the relicReccomendData to set
     * @return this
     */
    public GetBigDataAllRecommendScRsp setRelicReccomendData(
        final RelicReccomendDataOuterClass.RelicReccomendData value) {
      bitField0_ |= 0x00000008;
      relicReccomendData.copyFrom(value);
      return this;
    }

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

    @Override
    public GetBigDataAllRecommendScRsp mergeFrom(final GetBigDataAllRecommendScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasRecommendType()) {
        setRecommendTypeValue(other.recommendType);
      }
      if (other.hasAvatarReccomendData()) {
        getMutableAvatarReccomendData().mergeFrom(other.avatarReccomendData);
      }
      if (other.hasRelicReccomendData()) {
        getMutableRelicReccomendData().mergeFrom(other.relicReccomendData);
      }
      return this;
    }

    @Override
    public GetBigDataAllRecommendScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      recommendType = 0;
      avatarReccomendData.clear();
      relicReccomendData.clear();
      return this;
    }

    @Override
    public GetBigDataAllRecommendScRsp clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      avatarReccomendData.clearQuick();
      relicReccomendData.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GetBigDataAllRecommendScRsp)) {
        return false;
      }
      GetBigDataAllRecommendScRsp other = (GetBigDataAllRecommendScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasRecommendType() || recommendType == other.recommendType)
        && (!hasAvatarReccomendData() || avatarReccomendData.equals(other.avatarReccomendData))
        && (!hasRelicReccomendData() || relicReccomendData.equals(other.relicReccomendData));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeEnumNoTag(recommendType);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 34);
        output.writeMessageNoTag(avatarReccomendData);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 122);
        output.writeMessageNoTag(relicReccomendData);
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public GetBigDataAllRecommendScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 40: {
            // retcode
            retcode = 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 != 34) {
              break;
            }
          }
          case 34: {
            // avatarReccomendData
            input.readMessage(avatarReccomendData);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 122) {
              break;
            }
          }
          case 122: {
            // relicReccomendData
            input.readMessage(relicReccomendData);
            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.writeEnum(FieldNames.recommendType, recommendType, BigDataRecommendTypeOuterClass.BigDataRecommendType.converter());
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeMessage(FieldNames.avatarReccomendData, avatarReccomendData);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.relicReccomendData, relicReccomendData);
      }
      output.endObject();
    }

    @Override
    public GetBigDataAllRecommendScRsp 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 -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;
          }
          case -1865912773:
          case -1772298715: {
            if (input.isAtField(FieldNames.avatarReccomendData)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(avatarReccomendData);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1508304481:
          case -1849826101: {
            if (input.isAtField(FieldNames.relicReccomendData)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(relicReccomendData);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetBigDataAllRecommendScRspFactory implements MessageFactory<GetBigDataAllRecommendScRsp> {
      INSTANCE;

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

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

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

      static final FieldName avatarReccomendData = FieldName.forField("avatarReccomendData", "avatar_reccomend_data");

      static final FieldName relicReccomendData = FieldName.forField("relicReccomendData", "relic_reccomend_data");
    }
  }
}
