// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;

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

    /**
     * <code>optional uint32 Basic = 2;</code>
     */
    private int basic;

    /**
     * <code>optional uint32 Premium = 3;</code>
     */
    private int premium;

    /**
     * <code>optional uint32 Version = 4;</code>
     */
    private int version;

    /**
     * <code>optional .Nil All = 1;</code>
     */
    private final Public.Nil all = Public.Nil.newInstance();

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private BattlePassRewardReceiveReq() {
    }

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

    /**
     * <code>optional uint32 Basic = 2;</code>
     * @return whether the basic field is set
     */
    public boolean hasBasic() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Basic = 2;</code>
     * @return this
     */
    public BattlePassRewardReceiveReq clearBasic() {
      bitField0_ &= ~0x00000001;
      basic = 0;
      return this;
    }

    /**
     * <code>optional uint32 Basic = 2;</code>
     * @return the basic
     */
    public int getBasic() {
      return basic;
    }

    /**
     * <code>optional uint32 Basic = 2;</code>
     * @param value the basic to set
     * @return this
     */
    public BattlePassRewardReceiveReq setBasic(final int value) {
      bitField0_ |= 0x00000001;
      basic = value;
      return this;
    }

    /**
     * <code>optional uint32 Premium = 3;</code>
     * @return whether the premium field is set
     */
    public boolean hasPremium() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 Premium = 3;</code>
     * @return this
     */
    public BattlePassRewardReceiveReq clearPremium() {
      bitField0_ &= ~0x00000002;
      premium = 0;
      return this;
    }

    /**
     * <code>optional uint32 Premium = 3;</code>
     * @return the premium
     */
    public int getPremium() {
      return premium;
    }

    /**
     * <code>optional uint32 Premium = 3;</code>
     * @param value the premium to set
     * @return this
     */
    public BattlePassRewardReceiveReq setPremium(final int value) {
      bitField0_ |= 0x00000002;
      premium = value;
      return this;
    }

    /**
     * <code>optional uint32 Version = 4;</code>
     * @return whether the version field is set
     */
    public boolean hasVersion() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 Version = 4;</code>
     * @return this
     */
    public BattlePassRewardReceiveReq clearVersion() {
      bitField0_ &= ~0x00000004;
      version = 0;
      return this;
    }

    /**
     * <code>optional uint32 Version = 4;</code>
     * @return the version
     */
    public int getVersion() {
      return version;
    }

    /**
     * <code>optional uint32 Version = 4;</code>
     * @param value the version to set
     * @return this
     */
    public BattlePassRewardReceiveReq setVersion(final int value) {
      bitField0_ |= 0x00000004;
      version = value;
      return this;
    }

    /**
     * <code>optional .Nil All = 1;</code>
     * @return whether the all field is set
     */
    public boolean hasAll() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .Nil All = 1;</code>
     * @return this
     */
    public BattlePassRewardReceiveReq clearAll() {
      bitField0_ &= ~0x00000008;
      all.clear();
      return this;
    }

    /**
     * <code>optional .Nil All = 1;</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 #getMutableAll()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.Nil getAll() {
      return all;
    }

    /**
     * <code>optional .Nil All = 1;</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 Public.Nil getMutableAll() {
      bitField0_ |= 0x00000008;
      return all;
    }

    /**
     * <code>optional .Nil All = 1;</code>
     * @param value the all to set
     * @return this
     */
    public BattlePassRewardReceiveReq setAll(final Public.Nil value) {
      bitField0_ |= 0x00000008;
      all.copyFrom(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public BattlePassRewardReceiveReq clearNextPackage() {
      bitField0_ &= ~0x00000010;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000010;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public BattlePassRewardReceiveReq addNextPackage(final byte value) {
      bitField0_ |= 0x00000010;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public BattlePassRewardReceiveReq addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public BattlePassRewardReceiveReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public BattlePassRewardReceiveReq copyFrom(final BattlePassRewardReceiveReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        basic = other.basic;
        premium = other.premium;
        version = other.version;
        all.copyFrom(other.all);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public BattlePassRewardReceiveReq mergeFrom(final BattlePassRewardReceiveReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasBasic()) {
        setBasic(other.basic);
      }
      if (other.hasPremium()) {
        setPremium(other.premium);
      }
      if (other.hasVersion()) {
        setVersion(other.version);
      }
      if (other.hasAll()) {
        getMutableAll().mergeFrom(other.all);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public BattlePassRewardReceiveReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      basic = 0;
      premium = 0;
      version = 0;
      all.clear();
      nextPackage.clear();
      return this;
    }

    @Override
    public BattlePassRewardReceiveReq clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      all.clearQuick();
      nextPackage.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof BattlePassRewardReceiveReq)) {
        return false;
      }
      BattlePassRewardReceiveReq other = (BattlePassRewardReceiveReq) o;
      return bitField0_ == other.bitField0_
        && (!hasBasic() || basic == other.basic)
        && (!hasPremium() || premium == other.premium)
        && (!hasVersion() || version == other.version)
        && (!hasAll() || all.equals(other.all))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(basic);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(premium);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(version);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 10);
        output.writeMessageNoTag(all);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(basic);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(premium);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(version);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(all);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public BattlePassRewardReceiveReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // basic
            basic = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // premium
            premium = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // version
            version = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // all
            input.readMessage(all);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000010;
            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.basic, basic);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.premium, premium);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.version, version);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.all, all);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public BattlePassRewardReceiveReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 63955982: {
            if (input.isAtField(FieldNames.basic)) {
              if (!input.trySkipNullValue()) {
                basic = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1346201143: {
            if (input.isAtField(FieldNames.premium)) {
              if (!input.trySkipNullValue()) {
                premium = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2016261304: {
            if (input.isAtField(FieldNames.version)) {
              if (!input.trySkipNullValue()) {
                version = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 65921: {
            if (input.isAtField(FieldNames.all)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(all);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum BattlePassRewardReceiveReqFactory implements MessageFactory<BattlePassRewardReceiveReq> {
      INSTANCE;

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

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

      static final FieldName premium = FieldName.forField("Premium");

      static final FieldName version = FieldName.forField("Version");

      static final FieldName all = FieldName.forField("All");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }

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

    /**
     * <code>optional .ChangeInfo Change = 3;</code>
     */
    private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();

    /**
     * <code>optional bytes BasicReward = 1;</code>
     */
    private final RepeatedByte basicReward = RepeatedByte.newEmptyInstance();

    /**
     * <code>optional bytes PremiumReward = 2;</code>
     */
    private final RepeatedByte premiumReward = RepeatedByte.newEmptyInstance();

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private BattlePassRewardReceiveResp() {
    }

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

    /**
     * <code>optional .ChangeInfo Change = 3;</code>
     * @return whether the change field is set
     */
    public boolean hasChange() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .ChangeInfo Change = 3;</code>
     * @return this
     */
    public BattlePassRewardReceiveResp clearChange() {
      bitField0_ &= ~0x00000001;
      change.clear();
      return this;
    }

    /**
     * <code>optional .ChangeInfo Change = 3;</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 #getMutableChange()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.ChangeInfo getChange() {
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 3;</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 Public.ChangeInfo getMutableChange() {
      bitField0_ |= 0x00000001;
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 3;</code>
     * @param value the change to set
     * @return this
     */
    public BattlePassRewardReceiveResp setChange(final Public.ChangeInfo value) {
      bitField0_ |= 0x00000001;
      change.copyFrom(value);
      return this;
    }

    /**
     * <code>optional bytes BasicReward = 1;</code>
     * @return whether the basicReward field is set
     */
    public boolean hasBasicReward() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bytes BasicReward = 1;</code>
     * @return this
     */
    public BattlePassRewardReceiveResp clearBasicReward() {
      bitField0_ &= ~0x00000002;
      basicReward.clear();
      return this;
    }

    /**
     * <code>optional bytes BasicReward = 1;</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 #getMutableBasicReward()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getBasicReward() {
      return basicReward;
    }

    /**
     * <code>optional bytes BasicReward = 1;</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 RepeatedByte getMutableBasicReward() {
      bitField0_ |= 0x00000002;
      return basicReward;
    }

    /**
     * <code>optional bytes BasicReward = 1;</code>
     * @param value the basicReward to add
     * @return this
     */
    public BattlePassRewardReceiveResp addBasicReward(final byte value) {
      bitField0_ |= 0x00000002;
      basicReward.add(value);
      return this;
    }

    /**
     * <code>optional bytes BasicReward = 1;</code>
     * @param values the basicReward to add
     * @return this
     */
    public BattlePassRewardReceiveResp addAllBasicReward(final byte... values) {
      bitField0_ |= 0x00000002;
      basicReward.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes BasicReward = 1;</code>
     * @param values the basicReward to set
     * @return this
     */
    public BattlePassRewardReceiveResp setBasicReward(final byte... values) {
      bitField0_ |= 0x00000002;
      basicReward.copyFrom(values);
      return this;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</code>
     * @return whether the premiumReward field is set
     */
    public boolean hasPremiumReward() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</code>
     * @return this
     */
    public BattlePassRewardReceiveResp clearPremiumReward() {
      bitField0_ &= ~0x00000004;
      premiumReward.clear();
      return this;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</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 #getMutablePremiumReward()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getPremiumReward() {
      return premiumReward;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</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 RepeatedByte getMutablePremiumReward() {
      bitField0_ |= 0x00000004;
      return premiumReward;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</code>
     * @param value the premiumReward to add
     * @return this
     */
    public BattlePassRewardReceiveResp addPremiumReward(final byte value) {
      bitField0_ |= 0x00000004;
      premiumReward.add(value);
      return this;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</code>
     * @param values the premiumReward to add
     * @return this
     */
    public BattlePassRewardReceiveResp addAllPremiumReward(final byte... values) {
      bitField0_ |= 0x00000004;
      premiumReward.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes PremiumReward = 2;</code>
     * @param values the premiumReward to set
     * @return this
     */
    public BattlePassRewardReceiveResp setPremiumReward(final byte... values) {
      bitField0_ |= 0x00000004;
      premiumReward.copyFrom(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public BattlePassRewardReceiveResp clearNextPackage() {
      bitField0_ &= ~0x00000008;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000008;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public BattlePassRewardReceiveResp addNextPackage(final byte value) {
      bitField0_ |= 0x00000008;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public BattlePassRewardReceiveResp addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000008;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public BattlePassRewardReceiveResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000008;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public BattlePassRewardReceiveResp copyFrom(final BattlePassRewardReceiveResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        change.copyFrom(other.change);
        basicReward.copyFrom(other.basicReward);
        premiumReward.copyFrom(other.premiumReward);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public BattlePassRewardReceiveResp mergeFrom(final BattlePassRewardReceiveResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasChange()) {
        getMutableChange().mergeFrom(other.change);
      }
      if (other.hasBasicReward()) {
        getMutableBasicReward().copyFrom(other.basicReward);
      }
      if (other.hasPremiumReward()) {
        getMutablePremiumReward().copyFrom(other.premiumReward);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public BattlePassRewardReceiveResp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      change.clear();
      basicReward.clear();
      premiumReward.clear();
      nextPackage.clear();
      return this;
    }

    @Override
    public BattlePassRewardReceiveResp clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      change.clearQuick();
      basicReward.clear();
      premiumReward.clear();
      nextPackage.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof BattlePassRewardReceiveResp)) {
        return false;
      }
      BattlePassRewardReceiveResp other = (BattlePassRewardReceiveResp) o;
      return bitField0_ == other.bitField0_
        && (!hasChange() || change.equals(other.change))
        && (!hasBasicReward() || basicReward.equals(other.basicReward))
        && (!hasPremiumReward() || premiumReward.equals(other.premiumReward))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 26);
        output.writeMessageNoTag(change);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 10);
        output.writeBytesNoTag(basicReward);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 18);
        output.writeBytesNoTag(premiumReward);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(change);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeBytesSizeNoTag(basicReward);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeBytesSizeNoTag(premiumReward);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public BattlePassRewardReceiveResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 26: {
            // change
            input.readMessage(change);
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // basicReward
            input.readBytes(basicReward);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // premiumReward
            input.readBytes(premiumReward);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            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.writeMessage(FieldNames.change, change);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.basicReward, basicReward);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBytes(FieldNames.premiumReward, premiumReward);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public BattlePassRewardReceiveResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2017198032: {
            if (input.isAtField(FieldNames.change)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(change);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 799038685: {
            if (input.isAtField(FieldNames.basicReward)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(basicReward);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 423877702: {
            if (input.isAtField(FieldNames.premiumReward)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(premiumReward);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum BattlePassRewardReceiveRespFactory implements MessageFactory<BattlePassRewardReceiveResp> {
      INSTANCE;

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

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

      static final FieldName basicReward = FieldName.forField("BasicReward");

      static final FieldName premiumReward = FieldName.forField("PremiumReward");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }
}
