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

    /**
     * <code>optional int64 Deadline = 4;</code>
     */
    private long deadline;

    /**
     * <code>optional uint32 Id = 1;</code>
     */
    private int id;

    /**
     * <code>optional uint32 Mode = 2;</code>
     */
    private int mode;

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

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

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

    /**
     * <code>optional uint32 ExpThisWeek = 7;</code>
     */
    private int expThisWeek;

    /**
     * <code>optional .Quests DailyQuests = 10;</code>
     */
    private final Public.Quests dailyQuests = Public.Quests.newInstance();

    /**
     * <code>optional .Quests WeeklyQuests = 11;</code>
     */
    private final Public.Quests weeklyQuests = Public.Quests.newInstance();

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

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

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

    private BattlePassInfo() {
    }

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

    /**
     * <code>optional int64 Deadline = 4;</code>
     * @return whether the deadline field is set
     */
    public boolean hasDeadline() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int64 Deadline = 4;</code>
     * @return this
     */
    public BattlePassInfo clearDeadline() {
      bitField0_ &= ~0x00000001;
      deadline = 0L;
      return this;
    }

    /**
     * <code>optional int64 Deadline = 4;</code>
     * @return the deadline
     */
    public long getDeadline() {
      return deadline;
    }

    /**
     * <code>optional int64 Deadline = 4;</code>
     * @param value the deadline to set
     * @return this
     */
    public BattlePassInfo setDeadline(final long value) {
      bitField0_ |= 0x00000001;
      deadline = value;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return whether the id field is set
     */
    public boolean hasId() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public BattlePassInfo clearId() {
      bitField0_ &= ~0x00000002;
      id = 0;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return the id
     */
    public int getId() {
      return id;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public BattlePassInfo setId(final int value) {
      bitField0_ |= 0x00000002;
      id = value;
      return this;
    }

    /**
     * <code>optional uint32 Mode = 2;</code>
     * @return whether the mode field is set
     */
    public boolean hasMode() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 Mode = 2;</code>
     * @return this
     */
    public BattlePassInfo clearMode() {
      bitField0_ &= ~0x00000004;
      mode = 0;
      return this;
    }

    /**
     * <code>optional uint32 Mode = 2;</code>
     * @return the mode
     */
    public int getMode() {
      return mode;
    }

    /**
     * <code>optional uint32 Mode = 2;</code>
     * @param value the mode to set
     * @return this
     */
    public BattlePassInfo setMode(final int value) {
      bitField0_ |= 0x00000004;
      mode = value;
      return this;
    }

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

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

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

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

    /**
     * <code>optional uint32 Level = 5;</code>
     * @return whether the level field is set
     */
    public boolean hasLevel() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional uint32 Level = 5;</code>
     * @return this
     */
    public BattlePassInfo clearLevel() {
      bitField0_ &= ~0x00000010;
      level = 0;
      return this;
    }

    /**
     * <code>optional uint32 Level = 5;</code>
     * @return the level
     */
    public int getLevel() {
      return level;
    }

    /**
     * <code>optional uint32 Level = 5;</code>
     * @param value the level to set
     * @return this
     */
    public BattlePassInfo setLevel(final int value) {
      bitField0_ |= 0x00000010;
      level = value;
      return this;
    }

    /**
     * <code>optional uint32 Exp = 6;</code>
     * @return whether the exp field is set
     */
    public boolean hasExp() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional uint32 Exp = 6;</code>
     * @return this
     */
    public BattlePassInfo clearExp() {
      bitField0_ &= ~0x00000020;
      exp = 0;
      return this;
    }

    /**
     * <code>optional uint32 Exp = 6;</code>
     * @return the exp
     */
    public int getExp() {
      return exp;
    }

    /**
     * <code>optional uint32 Exp = 6;</code>
     * @param value the exp to set
     * @return this
     */
    public BattlePassInfo setExp(final int value) {
      bitField0_ |= 0x00000020;
      exp = value;
      return this;
    }

    /**
     * <code>optional uint32 ExpThisWeek = 7;</code>
     * @return whether the expThisWeek field is set
     */
    public boolean hasExpThisWeek() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional uint32 ExpThisWeek = 7;</code>
     * @return this
     */
    public BattlePassInfo clearExpThisWeek() {
      bitField0_ &= ~0x00000040;
      expThisWeek = 0;
      return this;
    }

    /**
     * <code>optional uint32 ExpThisWeek = 7;</code>
     * @return the expThisWeek
     */
    public int getExpThisWeek() {
      return expThisWeek;
    }

    /**
     * <code>optional uint32 ExpThisWeek = 7;</code>
     * @param value the expThisWeek to set
     * @return this
     */
    public BattlePassInfo setExpThisWeek(final int value) {
      bitField0_ |= 0x00000040;
      expThisWeek = value;
      return this;
    }

    /**
     * <code>optional .Quests DailyQuests = 10;</code>
     * @return whether the dailyQuests field is set
     */
    public boolean hasDailyQuests() {
      return (bitField0_ & 0x00000080) != 0;
    }

    /**
     * <code>optional .Quests DailyQuests = 10;</code>
     * @return this
     */
    public BattlePassInfo clearDailyQuests() {
      bitField0_ &= ~0x00000080;
      dailyQuests.clear();
      return this;
    }

    /**
     * <code>optional .Quests DailyQuests = 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 #getMutableDailyQuests()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.Quests getDailyQuests() {
      return dailyQuests;
    }

    /**
     * <code>optional .Quests DailyQuests = 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 Public.Quests getMutableDailyQuests() {
      bitField0_ |= 0x00000080;
      return dailyQuests;
    }

    /**
     * <code>optional .Quests DailyQuests = 10;</code>
     * @param value the dailyQuests to set
     * @return this
     */
    public BattlePassInfo setDailyQuests(final Public.Quests value) {
      bitField0_ |= 0x00000080;
      dailyQuests.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .Quests WeeklyQuests = 11;</code>
     * @return whether the weeklyQuests field is set
     */
    public boolean hasWeeklyQuests() {
      return (bitField0_ & 0x00000100) != 0;
    }

    /**
     * <code>optional .Quests WeeklyQuests = 11;</code>
     * @return this
     */
    public BattlePassInfo clearWeeklyQuests() {
      bitField0_ &= ~0x00000100;
      weeklyQuests.clear();
      return this;
    }

    /**
     * <code>optional .Quests WeeklyQuests = 11;</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 #getMutableWeeklyQuests()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.Quests getWeeklyQuests() {
      return weeklyQuests;
    }

    /**
     * <code>optional .Quests WeeklyQuests = 11;</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.Quests getMutableWeeklyQuests() {
      bitField0_ |= 0x00000100;
      return weeklyQuests;
    }

    /**
     * <code>optional .Quests WeeklyQuests = 11;</code>
     * @param value the weeklyQuests to set
     * @return this
     */
    public BattlePassInfo setWeeklyQuests(final Public.Quests value) {
      bitField0_ |= 0x00000100;
      weeklyQuests.copyFrom(value);
      return this;
    }

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

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

    /**
     * <code>optional bytes BasicReward = 8;</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 = 8;</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_ |= 0x00000200;
      return basicReward;
    }

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

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

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

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

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

    /**
     * <code>optional bytes PremiumReward = 9;</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 = 9;</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_ |= 0x00000400;
      return premiumReward;
    }

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

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

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

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

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public BattlePassInfo clearNextPackage() {
      bitField0_ &= ~0x00000800;
      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_ |= 0x00000800;
      return nextPackage;
    }

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

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

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

    @Override
    public BattlePassInfo copyFrom(final BattlePassInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        deadline = other.deadline;
        id = other.id;
        mode = other.mode;
        version = other.version;
        level = other.level;
        exp = other.exp;
        expThisWeek = other.expThisWeek;
        dailyQuests.copyFrom(other.dailyQuests);
        weeklyQuests.copyFrom(other.weeklyQuests);
        basicReward.copyFrom(other.basicReward);
        premiumReward.copyFrom(other.premiumReward);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public BattlePassInfo mergeFrom(final BattlePassInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasDeadline()) {
        setDeadline(other.deadline);
      }
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasMode()) {
        setMode(other.mode);
      }
      if (other.hasVersion()) {
        setVersion(other.version);
      }
      if (other.hasLevel()) {
        setLevel(other.level);
      }
      if (other.hasExp()) {
        setExp(other.exp);
      }
      if (other.hasExpThisWeek()) {
        setExpThisWeek(other.expThisWeek);
      }
      if (other.hasDailyQuests()) {
        getMutableDailyQuests().mergeFrom(other.dailyQuests);
      }
      if (other.hasWeeklyQuests()) {
        getMutableWeeklyQuests().mergeFrom(other.weeklyQuests);
      }
      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 BattlePassInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      deadline = 0L;
      id = 0;
      mode = 0;
      version = 0;
      level = 0;
      exp = 0;
      expThisWeek = 0;
      dailyQuests.clear();
      weeklyQuests.clear();
      basicReward.clear();
      premiumReward.clear();
      nextPackage.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof BattlePassInfo)) {
        return false;
      }
      BattlePassInfo other = (BattlePassInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasDeadline() || deadline == other.deadline)
        && (!hasId() || id == other.id)
        && (!hasMode() || mode == other.mode)
        && (!hasVersion() || version == other.version)
        && (!hasLevel() || level == other.level)
        && (!hasExp() || exp == other.exp)
        && (!hasExpThisWeek() || expThisWeek == other.expThisWeek)
        && (!hasDailyQuests() || dailyQuests.equals(other.dailyQuests))
        && (!hasWeeklyQuests() || weeklyQuests.equals(other.weeklyQuests))
        && (!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) 32);
        output.writeInt64NoTag(deadline);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(mode);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 24);
        output.writeUInt32NoTag(version);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(level);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(exp);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(expThisWeek);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeRawByte((byte) 82);
        output.writeMessageNoTag(dailyQuests);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeRawByte((byte) 90);
        output.writeMessageNoTag(weeklyQuests);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeRawByte((byte) 66);
        output.writeBytesNoTag(basicReward);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        output.writeRawByte((byte) 74);
        output.writeBytesNoTag(premiumReward);
      }
      if ((bitField0_ & 0x00000800) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt64SizeNoTag(deadline);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(mode);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(version);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(level);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(exp);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(expThisWeek);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(dailyQuests);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(weeklyQuests);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        size += 1 + ProtoSink.computeBytesSizeNoTag(basicReward);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        size += 1 + ProtoSink.computeBytesSizeNoTag(premiumReward);
      }
      if ((bitField0_ & 0x00000800) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public BattlePassInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 32: {
            // deadline
            deadline = input.readInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 8) {
              break;
            }
          }
          case 8: {
            // id
            id = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // mode
            mode = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // version
            version = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // level
            level = input.readUInt32();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // exp
            exp = input.readUInt32();
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // expThisWeek
            expThisWeek = input.readUInt32();
            bitField0_ |= 0x00000040;
            tag = input.readTag();
            if (tag != 82) {
              break;
            }
          }
          case 82: {
            // dailyQuests
            input.readMessage(dailyQuests);
            bitField0_ |= 0x00000080;
            tag = input.readTag();
            if (tag != 90) {
              break;
            }
          }
          case 90: {
            // weeklyQuests
            input.readMessage(weeklyQuests);
            bitField0_ |= 0x00000100;
            tag = input.readTag();
            if (tag != 66) {
              break;
            }
          }
          case 66: {
            // basicReward
            input.readBytes(basicReward);
            bitField0_ |= 0x00000200;
            tag = input.readTag();
            if (tag != 74) {
              break;
            }
          }
          case 74: {
            // premiumReward
            input.readBytes(premiumReward);
            bitField0_ |= 0x00000400;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000800;
            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.writeInt64(FieldNames.deadline, deadline);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.id, id);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.mode, mode);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.version, version);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeUInt32(FieldNames.level, level);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeUInt32(FieldNames.exp, exp);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeUInt32(FieldNames.expThisWeek, expThisWeek);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeMessage(FieldNames.dailyQuests, dailyQuests);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeMessage(FieldNames.weeklyQuests, weeklyQuests);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeBytes(FieldNames.basicReward, basicReward);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        output.writeBytes(FieldNames.premiumReward, premiumReward);
      }
      if ((bitField0_ & 0x00000800) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public BattlePassInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 568278648: {
            if (input.isAtField(FieldNames.deadline)) {
              if (!input.trySkipNullValue()) {
                deadline = input.readInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2403779: {
            if (input.isAtField(FieldNames.mode)) {
              if (!input.trySkipNullValue()) {
                mode = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2016261304: {
            if (input.isAtField(FieldNames.version)) {
              if (!input.trySkipNullValue()) {
                version = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 73313124: {
            if (input.isAtField(FieldNames.level)) {
              if (!input.trySkipNullValue()) {
                level = input.readUInt32();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 70141: {
            if (input.isAtField(FieldNames.exp)) {
              if (!input.trySkipNullValue()) {
                exp = input.readUInt32();
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -820572977: {
            if (input.isAtField(FieldNames.expThisWeek)) {
              if (!input.trySkipNullValue()) {
                expThisWeek = input.readUInt32();
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1364115242: {
            if (input.isAtField(FieldNames.dailyQuests)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(dailyQuests);
                bitField0_ |= 0x00000080;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 433561554: {
            if (input.isAtField(FieldNames.weeklyQuests)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(weeklyQuests);
                bitField0_ |= 0x00000100;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 799038685: {
            if (input.isAtField(FieldNames.basicReward)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(basicReward);
                bitField0_ |= 0x00000200;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 423877702: {
            if (input.isAtField(FieldNames.premiumReward)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(premiumReward);
                bitField0_ |= 0x00000400;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000800;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum BattlePassInfoFactory implements MessageFactory<BattlePassInfo> {
      INSTANCE;

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

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

      static final FieldName id = FieldName.forField("Id");

      static final FieldName mode = FieldName.forField("Mode");

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

      static final FieldName level = FieldName.forField("Level");

      static final FieldName exp = FieldName.forField("Exp");

      static final FieldName expThisWeek = FieldName.forField("ExpThisWeek");

      static final FieldName dailyQuests = FieldName.forField("DailyQuests");

      static final FieldName weeklyQuests = FieldName.forField("WeeklyQuests");

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

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

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