// 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.RepeatedMessage;

public final class QueryProductInfoScRspOuterClass {
  /**
   * Protobuf type {@code QueryProductInfoScRsp}
   */
  public static final class QueryProductInfoScRsp extends ProtoMessage<QueryProductInfoScRsp> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional uint64 month_card_outdate_time = 11;</code>
     */
    private long monthCardOutdateTime;

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

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

    /**
     * <code>optional uint32 gift_coin_cur_version = 12;</code>
     */
    private int giftCoinCurVersion;

    /**
     * <code>repeated .Product product_list = 10;</code>
     */
    private final RepeatedMessage<ProductOuterClass.Product> productList = RepeatedMessage.newEmptyInstance(ProductOuterClass.Product.getFactory());

    private QueryProductInfoScRsp() {
    }

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

    /**
     * <code>optional uint64 month_card_outdate_time = 11;</code>
     * @return whether the monthCardOutdateTime field is set
     */
    public boolean hasMonthCardOutdateTime() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint64 month_card_outdate_time = 11;</code>
     * @return this
     */
    public QueryProductInfoScRsp clearMonthCardOutdateTime() {
      bitField0_ &= ~0x00000001;
      monthCardOutdateTime = 0L;
      return this;
    }

    /**
     * <code>optional uint64 month_card_outdate_time = 11;</code>
     * @return the monthCardOutdateTime
     */
    public long getMonthCardOutdateTime() {
      return monthCardOutdateTime;
    }

    /**
     * <code>optional uint64 month_card_outdate_time = 11;</code>
     * @param value the monthCardOutdateTime to set
     * @return this
     */
    public QueryProductInfoScRsp setMonthCardOutdateTime(final long value) {
      bitField0_ |= 0x00000001;
      monthCardOutdateTime = value;
      return this;
    }

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

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

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

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

    /**
     * <code>optional uint32 gift_coin_bought_history_version = 7;</code>
     * @return whether the giftCoinBoughtHistoryVersion field is set
     */
    public boolean hasGiftCoinBoughtHistoryVersion() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 gift_coin_bought_history_version = 7;</code>
     * @return this
     */
    public QueryProductInfoScRsp clearGiftCoinBoughtHistoryVersion() {
      bitField0_ &= ~0x00000004;
      giftCoinBoughtHistoryVersion = 0;
      return this;
    }

    /**
     * <code>optional uint32 gift_coin_bought_history_version = 7;</code>
     * @return the giftCoinBoughtHistoryVersion
     */
    public int getGiftCoinBoughtHistoryVersion() {
      return giftCoinBoughtHistoryVersion;
    }

    /**
     * <code>optional uint32 gift_coin_bought_history_version = 7;</code>
     * @param value the giftCoinBoughtHistoryVersion to set
     * @return this
     */
    public QueryProductInfoScRsp setGiftCoinBoughtHistoryVersion(final int value) {
      bitField0_ |= 0x00000004;
      giftCoinBoughtHistoryVersion = value;
      return this;
    }

    /**
     * <code>optional uint32 gift_coin_cur_version = 12;</code>
     * @return whether the giftCoinCurVersion field is set
     */
    public boolean hasGiftCoinCurVersion() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 gift_coin_cur_version = 12;</code>
     * @return this
     */
    public QueryProductInfoScRsp clearGiftCoinCurVersion() {
      bitField0_ &= ~0x00000008;
      giftCoinCurVersion = 0;
      return this;
    }

    /**
     * <code>optional uint32 gift_coin_cur_version = 12;</code>
     * @return the giftCoinCurVersion
     */
    public int getGiftCoinCurVersion() {
      return giftCoinCurVersion;
    }

    /**
     * <code>optional uint32 gift_coin_cur_version = 12;</code>
     * @param value the giftCoinCurVersion to set
     * @return this
     */
    public QueryProductInfoScRsp setGiftCoinCurVersion(final int value) {
      bitField0_ |= 0x00000008;
      giftCoinCurVersion = value;
      return this;
    }

    /**
     * <code>repeated .Product product_list = 10;</code>
     * @return whether the productList field is set
     */
    public boolean hasProductList() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>repeated .Product product_list = 10;</code>
     * @return this
     */
    public QueryProductInfoScRsp clearProductList() {
      bitField0_ &= ~0x00000010;
      productList.clear();
      return this;
    }

    /**
     * <code>repeated .Product product_list = 10;</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 #getMutableProductList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<ProductOuterClass.Product> getProductList() {
      return productList;
    }

    /**
     * <code>repeated .Product product_list = 10;</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 RepeatedMessage<ProductOuterClass.Product> getMutableProductList() {
      bitField0_ |= 0x00000010;
      return productList;
    }

    /**
     * <code>repeated .Product product_list = 10;</code>
     * @param value the productList to add
     * @return this
     */
    public QueryProductInfoScRsp addProductList(final ProductOuterClass.Product value) {
      bitField0_ |= 0x00000010;
      productList.add(value);
      return this;
    }

    /**
     * <code>repeated .Product product_list = 10;</code>
     * @param values the productList to add
     * @return this
     */
    public QueryProductInfoScRsp addAllProductList(final ProductOuterClass.Product... values) {
      bitField0_ |= 0x00000010;
      productList.addAll(values);
      return this;
    }

    @Override
    public QueryProductInfoScRsp copyFrom(final QueryProductInfoScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        monthCardOutdateTime = other.monthCardOutdateTime;
        retcode = other.retcode;
        giftCoinBoughtHistoryVersion = other.giftCoinBoughtHistoryVersion;
        giftCoinCurVersion = other.giftCoinCurVersion;
        productList.copyFrom(other.productList);
      }
      return this;
    }

    @Override
    public QueryProductInfoScRsp mergeFrom(final QueryProductInfoScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasMonthCardOutdateTime()) {
        setMonthCardOutdateTime(other.monthCardOutdateTime);
      }
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasGiftCoinBoughtHistoryVersion()) {
        setGiftCoinBoughtHistoryVersion(other.giftCoinBoughtHistoryVersion);
      }
      if (other.hasGiftCoinCurVersion()) {
        setGiftCoinCurVersion(other.giftCoinCurVersion);
      }
      if (other.hasProductList()) {
        getMutableProductList().addAll(other.productList);
      }
      return this;
    }

    @Override
    public QueryProductInfoScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      monthCardOutdateTime = 0L;
      retcode = 0;
      giftCoinBoughtHistoryVersion = 0;
      giftCoinCurVersion = 0;
      productList.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof QueryProductInfoScRsp)) {
        return false;
      }
      QueryProductInfoScRsp other = (QueryProductInfoScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasMonthCardOutdateTime() || monthCardOutdateTime == other.monthCardOutdateTime)
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasGiftCoinBoughtHistoryVersion() || giftCoinBoughtHistoryVersion == other.giftCoinBoughtHistoryVersion)
        && (!hasGiftCoinCurVersion() || giftCoinCurVersion == other.giftCoinCurVersion)
        && (!hasProductList() || productList.equals(other.productList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt64NoTag(monthCardOutdateTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(giftCoinBoughtHistoryVersion);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(giftCoinCurVersion);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        for (int i = 0; i < productList.length(); i++) {
          output.writeRawByte((byte) 82);
          output.writeMessageNoTag(productList.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt64SizeNoTag(monthCardOutdateTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(giftCoinBoughtHistoryVersion);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(giftCoinCurVersion);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += (1 * productList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(productList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public QueryProductInfoScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 88: {
            // monthCardOutdateTime
            monthCardOutdateTime = input.readUInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // giftCoinBoughtHistoryVersion
            giftCoinBoughtHistoryVersion = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 96) {
              break;
            }
          }
          case 96: {
            // giftCoinCurVersion
            giftCoinCurVersion = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 82) {
              break;
            }
          }
          case 82: {
            // productList
            tag = input.readRepeatedMessage(productList, tag);
            bitField0_ |= 0x00000010;
            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.writeUInt64(FieldNames.monthCardOutdateTime, monthCardOutdateTime);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.retcode, retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.giftCoinBoughtHistoryVersion, giftCoinBoughtHistoryVersion);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.giftCoinCurVersion, giftCoinCurVersion);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRepeatedMessage(FieldNames.productList, productList);
      }
      output.endObject();
    }

    @Override
    public QueryProductInfoScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -152594151:
          case 963589632: {
            if (input.isAtField(FieldNames.monthCardOutdateTime)) {
              if (!input.trySkipNullValue()) {
                monthCardOutdateTime = input.readUInt64();
                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 337076464:
          case 1032039352: {
            if (input.isAtField(FieldNames.giftCoinBoughtHistoryVersion)) {
              if (!input.trySkipNullValue()) {
                giftCoinBoughtHistoryVersion = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -623323847:
          case 347029594: {
            if (input.isAtField(FieldNames.giftCoinCurVersion)) {
              if (!input.trySkipNullValue()) {
                giftCoinCurVersion = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1491869139:
          case 1014323694: {
            if (input.isAtField(FieldNames.productList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(productList);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum QueryProductInfoScRspFactory implements MessageFactory<QueryProductInfoScRsp> {
      INSTANCE;

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

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

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

      static final FieldName giftCoinBoughtHistoryVersion = FieldName.forField("giftCoinBoughtHistoryVersion", "gift_coin_bought_history_version");

      static final FieldName giftCoinCurVersion = FieldName.forField("giftCoinCurVersion", "gift_coin_cur_version");

      static final FieldName productList = FieldName.forField("productList", "product_list");
    }
  }
}
