// 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;
import us.hebi.quickbuf.RepeatedMessage;

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

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

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

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

    private GachaSpinReq() {
    }

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

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public GachaSpinReq clearId() {
      bitField0_ &= ~0x00000001;
      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 GachaSpinReq setId(final int value) {
      bitField0_ |= 0x00000001;
      id = value;
      return this;
    }

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

    /**
     * <code>optional uint32 Mode = 2;</code>
     * @return this
     */
    public GachaSpinReq clearMode() {
      bitField0_ &= ~0x00000002;
      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 GachaSpinReq setMode(final int value) {
      bitField0_ |= 0x00000002;
      mode = value;
      return this;
    }

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

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

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

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

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

    @Override
    public GachaSpinReq copyFrom(final GachaSpinReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        id = other.id;
        mode = other.mode;
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public GachaSpinReq mergeFrom(final GachaSpinReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasMode()) {
        setMode(other.mode);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public GachaSpinReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      id = 0;
      mode = 0;
      nextPackage.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GachaSpinReq)) {
        return false;
      }
      GachaSpinReq other = (GachaSpinReq) o;
      return bitField0_ == other.bitField0_
        && (!hasId() || id == other.id)
        && (!hasMode() || mode == other.mode)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(mode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(mode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public GachaSpinReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // id
            id = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // mode
            mode = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000004;
            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.id, id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.mode, mode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public GachaSpinReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2403779: {
            if (input.isAtField(FieldNames.mode)) {
              if (!input.trySkipNullValue()) {
                mode = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GachaSpinReqFactory implements MessageFactory<GachaSpinReq> {
      INSTANCE;

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

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

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

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

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

    /**
     * <code>optional int64 Time = 3;</code>
     */
    private long time;

    /**
     * <code>optional uint32 AMissTimes = 10;</code>
     */
    private int aMissTimes;

    /**
     * <code>optional uint32 GachaTotalTimes = 11;</code>
     */
    private int gachaTotalTimes;

    /**
     * <code>optional uint32 TotalTimes = 12;</code>
     */
    private int totalTimes;

    /**
     * <code>optional uint32 AupGuaranteeTimes = 13;</code>
     */
    private int aupGuaranteeTimes;

    /**
     * <code>optional uint32 AupMissTimes = 14;</code>
     */
    private int aupMissTimes;

    /**
     * <code>optional uint32 DaysCount = 15;</code>
     */
    private int daysCount;

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

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

    /**
     * <code>repeated .GachaCard Cards = 1;</code>
     */
    private final RepeatedMessage<GachaCard> cards = RepeatedMessage.newEmptyInstance(GachaCard.getFactory());

    private GachaSpinResp() {
    }

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

    /**
     * <code>optional int64 Time = 3;</code>
     * @return whether the time field is set
     */
    public boolean hasTime() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int64 Time = 3;</code>
     * @return this
     */
    public GachaSpinResp clearTime() {
      bitField0_ &= ~0x00000001;
      time = 0L;
      return this;
    }

    /**
     * <code>optional int64 Time = 3;</code>
     * @return the time
     */
    public long getTime() {
      return time;
    }

    /**
     * <code>optional int64 Time = 3;</code>
     * @param value the time to set
     * @return this
     */
    public GachaSpinResp setTime(final long value) {
      bitField0_ |= 0x00000001;
      time = value;
      return this;
    }

    /**
     * <code>optional uint32 AMissTimes = 10;</code>
     * @return whether the aMissTimes field is set
     */
    public boolean hasAMissTimes() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 AMissTimes = 10;</code>
     * @return this
     */
    public GachaSpinResp clearAMissTimes() {
      bitField0_ &= ~0x00000002;
      aMissTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 AMissTimes = 10;</code>
     * @return the aMissTimes
     */
    public int getAMissTimes() {
      return aMissTimes;
    }

    /**
     * <code>optional uint32 AMissTimes = 10;</code>
     * @param value the aMissTimes to set
     * @return this
     */
    public GachaSpinResp setAMissTimes(final int value) {
      bitField0_ |= 0x00000002;
      aMissTimes = value;
      return this;
    }

    /**
     * <code>optional uint32 GachaTotalTimes = 11;</code>
     * @return whether the gachaTotalTimes field is set
     */
    public boolean hasGachaTotalTimes() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 GachaTotalTimes = 11;</code>
     * @return this
     */
    public GachaSpinResp clearGachaTotalTimes() {
      bitField0_ &= ~0x00000004;
      gachaTotalTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 GachaTotalTimes = 11;</code>
     * @return the gachaTotalTimes
     */
    public int getGachaTotalTimes() {
      return gachaTotalTimes;
    }

    /**
     * <code>optional uint32 GachaTotalTimes = 11;</code>
     * @param value the gachaTotalTimes to set
     * @return this
     */
    public GachaSpinResp setGachaTotalTimes(final int value) {
      bitField0_ |= 0x00000004;
      gachaTotalTimes = value;
      return this;
    }

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

    /**
     * <code>optional uint32 TotalTimes = 12;</code>
     * @return this
     */
    public GachaSpinResp clearTotalTimes() {
      bitField0_ &= ~0x00000008;
      totalTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 TotalTimes = 12;</code>
     * @return the totalTimes
     */
    public int getTotalTimes() {
      return totalTimes;
    }

    /**
     * <code>optional uint32 TotalTimes = 12;</code>
     * @param value the totalTimes to set
     * @return this
     */
    public GachaSpinResp setTotalTimes(final int value) {
      bitField0_ |= 0x00000008;
      totalTimes = value;
      return this;
    }

    /**
     * <code>optional uint32 AupGuaranteeTimes = 13;</code>
     * @return whether the aupGuaranteeTimes field is set
     */
    public boolean hasAupGuaranteeTimes() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional uint32 AupGuaranteeTimes = 13;</code>
     * @return this
     */
    public GachaSpinResp clearAupGuaranteeTimes() {
      bitField0_ &= ~0x00000010;
      aupGuaranteeTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 AupGuaranteeTimes = 13;</code>
     * @return the aupGuaranteeTimes
     */
    public int getAupGuaranteeTimes() {
      return aupGuaranteeTimes;
    }

    /**
     * <code>optional uint32 AupGuaranteeTimes = 13;</code>
     * @param value the aupGuaranteeTimes to set
     * @return this
     */
    public GachaSpinResp setAupGuaranteeTimes(final int value) {
      bitField0_ |= 0x00000010;
      aupGuaranteeTimes = value;
      return this;
    }

    /**
     * <code>optional uint32 AupMissTimes = 14;</code>
     * @return whether the aupMissTimes field is set
     */
    public boolean hasAupMissTimes() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional uint32 AupMissTimes = 14;</code>
     * @return this
     */
    public GachaSpinResp clearAupMissTimes() {
      bitField0_ &= ~0x00000020;
      aupMissTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 AupMissTimes = 14;</code>
     * @return the aupMissTimes
     */
    public int getAupMissTimes() {
      return aupMissTimes;
    }

    /**
     * <code>optional uint32 AupMissTimes = 14;</code>
     * @param value the aupMissTimes to set
     * @return this
     */
    public GachaSpinResp setAupMissTimes(final int value) {
      bitField0_ |= 0x00000020;
      aupMissTimes = value;
      return this;
    }

    /**
     * <code>optional uint32 DaysCount = 15;</code>
     * @return whether the daysCount field is set
     */
    public boolean hasDaysCount() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional uint32 DaysCount = 15;</code>
     * @return this
     */
    public GachaSpinResp clearDaysCount() {
      bitField0_ &= ~0x00000040;
      daysCount = 0;
      return this;
    }

    /**
     * <code>optional uint32 DaysCount = 15;</code>
     * @return the daysCount
     */
    public int getDaysCount() {
      return daysCount;
    }

    /**
     * <code>optional uint32 DaysCount = 15;</code>
     * @param value the daysCount to set
     * @return this
     */
    public GachaSpinResp setDaysCount(final int value) {
      bitField0_ |= 0x00000040;
      daysCount = value;
      return this;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * <code>repeated .GachaCard Cards = 1;</code>
     * @return whether the cards field is set
     */
    public boolean hasCards() {
      return (bitField0_ & 0x00000200) != 0;
    }

    /**
     * <code>repeated .GachaCard Cards = 1;</code>
     * @return this
     */
    public GachaSpinResp clearCards() {
      bitField0_ &= ~0x00000200;
      cards.clear();
      return this;
    }

    /**
     * <code>repeated .GachaCard Cards = 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 #getMutableCards()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<GachaCard> getCards() {
      return cards;
    }

    /**
     * <code>repeated .GachaCard Cards = 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 RepeatedMessage<GachaCard> getMutableCards() {
      bitField0_ |= 0x00000200;
      return cards;
    }

    /**
     * <code>repeated .GachaCard Cards = 1;</code>
     * @param value the cards to add
     * @return this
     */
    public GachaSpinResp addCards(final GachaCard value) {
      bitField0_ |= 0x00000200;
      cards.add(value);
      return this;
    }

    /**
     * <code>repeated .GachaCard Cards = 1;</code>
     * @param values the cards to add
     * @return this
     */
    public GachaSpinResp addAllCards(final GachaCard... values) {
      bitField0_ |= 0x00000200;
      cards.addAll(values);
      return this;
    }

    @Override
    public GachaSpinResp copyFrom(final GachaSpinResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        time = other.time;
        aMissTimes = other.aMissTimes;
        gachaTotalTimes = other.gachaTotalTimes;
        totalTimes = other.totalTimes;
        aupGuaranteeTimes = other.aupGuaranteeTimes;
        aupMissTimes = other.aupMissTimes;
        daysCount = other.daysCount;
        change.copyFrom(other.change);
        nextPackage.copyFrom(other.nextPackage);
        cards.copyFrom(other.cards);
      }
      return this;
    }

    @Override
    public GachaSpinResp mergeFrom(final GachaSpinResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasTime()) {
        setTime(other.time);
      }
      if (other.hasAMissTimes()) {
        setAMissTimes(other.aMissTimes);
      }
      if (other.hasGachaTotalTimes()) {
        setGachaTotalTimes(other.gachaTotalTimes);
      }
      if (other.hasTotalTimes()) {
        setTotalTimes(other.totalTimes);
      }
      if (other.hasAupGuaranteeTimes()) {
        setAupGuaranteeTimes(other.aupGuaranteeTimes);
      }
      if (other.hasAupMissTimes()) {
        setAupMissTimes(other.aupMissTimes);
      }
      if (other.hasDaysCount()) {
        setDaysCount(other.daysCount);
      }
      if (other.hasChange()) {
        getMutableChange().mergeFrom(other.change);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasCards()) {
        getMutableCards().addAll(other.cards);
      }
      return this;
    }

    @Override
    public GachaSpinResp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      time = 0L;
      aMissTimes = 0;
      gachaTotalTimes = 0;
      totalTimes = 0;
      aupGuaranteeTimes = 0;
      aupMissTimes = 0;
      daysCount = 0;
      change.clear();
      nextPackage.clear();
      cards.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GachaSpinResp)) {
        return false;
      }
      GachaSpinResp other = (GachaSpinResp) o;
      return bitField0_ == other.bitField0_
        && (!hasTime() || time == other.time)
        && (!hasAMissTimes() || aMissTimes == other.aMissTimes)
        && (!hasGachaTotalTimes() || gachaTotalTimes == other.gachaTotalTimes)
        && (!hasTotalTimes() || totalTimes == other.totalTimes)
        && (!hasAupGuaranteeTimes() || aupGuaranteeTimes == other.aupGuaranteeTimes)
        && (!hasAupMissTimes() || aupMissTimes == other.aupMissTimes)
        && (!hasDaysCount() || daysCount == other.daysCount)
        && (!hasChange() || change.equals(other.change))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasCards() || cards.equals(other.cards));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 24);
        output.writeInt64NoTag(time);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 80);
        output.writeUInt32NoTag(aMissTimes);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(gachaTotalTimes);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(totalTimes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 104);
        output.writeUInt32NoTag(aupGuaranteeTimes);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(aupMissTimes);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(daysCount);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeRawByte((byte) 18);
        output.writeMessageNoTag(change);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        for (int i = 0; i < cards.length(); i++) {
          output.writeRawByte((byte) 10);
          output.writeMessageNoTag(cards.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt64SizeNoTag(time);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(aMissTimes);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaTotalTimes);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(totalTimes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(aupGuaranteeTimes);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(aupMissTimes);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(daysCount);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(change);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        size += (1 * cards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(cards);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public GachaSpinResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 24: {
            // time
            time = input.readInt64();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 80) {
              break;
            }
          }
          case 80: {
            // aMissTimes
            aMissTimes = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // gachaTotalTimes
            gachaTotalTimes = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 96) {
              break;
            }
          }
          case 96: {
            // totalTimes
            totalTimes = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 104) {
              break;
            }
          }
          case 104: {
            // aupGuaranteeTimes
            aupGuaranteeTimes = input.readUInt32();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // aupMissTimes
            aupMissTimes = input.readUInt32();
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // daysCount
            daysCount = input.readUInt32();
            bitField0_ |= 0x00000040;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // change
            input.readMessage(change);
            bitField0_ |= 0x00000080;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000100;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // cards
            tag = input.readRepeatedMessage(cards, tag);
            bitField0_ |= 0x00000200;
            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.time, time);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.aMissTimes, aMissTimes);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.gachaTotalTimes, gachaTotalTimes);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.totalTimes, totalTimes);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeUInt32(FieldNames.aupGuaranteeTimes, aupGuaranteeTimes);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeUInt32(FieldNames.aupMissTimes, aupMissTimes);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeUInt32(FieldNames.daysCount, daysCount);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeMessage(FieldNames.change, change);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeRepeatedMessage(FieldNames.cards, cards);
      }
      output.endObject();
    }

    @Override
    public GachaSpinResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2606829: {
            if (input.isAtField(FieldNames.time)) {
              if (!input.trySkipNullValue()) {
                time = input.readInt64();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -955152279: {
            if (input.isAtField(FieldNames.aMissTimes)) {
              if (!input.trySkipNullValue()) {
                aMissTimes = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1802973852: {
            if (input.isAtField(FieldNames.gachaTotalTimes)) {
              if (!input.trySkipNullValue()) {
                gachaTotalTimes = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1277592194: {
            if (input.isAtField(FieldNames.totalTimes)) {
              if (!input.trySkipNullValue()) {
                totalTimes = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1466287270: {
            if (input.isAtField(FieldNames.aupGuaranteeTimes)) {
              if (!input.trySkipNullValue()) {
                aupGuaranteeTimes = input.readUInt32();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1590821778: {
            if (input.isAtField(FieldNames.aupMissTimes)) {
              if (!input.trySkipNullValue()) {
                aupMissTimes = input.readUInt32();
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2022494504: {
            if (input.isAtField(FieldNames.daysCount)) {
              if (!input.trySkipNullValue()) {
                daysCount = input.readUInt32();
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2017198032: {
            if (input.isAtField(FieldNames.change)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(change);
                bitField0_ |= 0x00000080;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000100;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 64878403: {
            if (input.isAtField(FieldNames.cards)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(cards);
                bitField0_ |= 0x00000200;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GachaSpinRespFactory implements MessageFactory<GachaSpinResp> {
      INSTANCE;

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

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

      static final FieldName aMissTimes = FieldName.forField("AMissTimes");

      static final FieldName gachaTotalTimes = FieldName.forField("GachaTotalTimes");

      static final FieldName totalTimes = FieldName.forField("TotalTimes");

      static final FieldName aupGuaranteeTimes = FieldName.forField("AupGuaranteeTimes");

      static final FieldName aupMissTimes = FieldName.forField("AupMissTimes");

      static final FieldName daysCount = FieldName.forField("DaysCount");

      static final FieldName change = FieldName.forField("Change");

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

      static final FieldName cards = FieldName.forField("Cards");
    }
  }

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

    /**
     * <code>optional .ItemTpl Card = 1;</code>
     */
    private final Public.ItemTpl card = Public.ItemTpl.newInstance();

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

    /**
     * <code>repeated .ItemTpl Rewards = 2;</code>
     */
    private final RepeatedMessage<Public.ItemTpl> rewards = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());

    private GachaCard() {
    }

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

    /**
     * <code>optional .ItemTpl Card = 1;</code>
     * @return whether the card field is set
     */
    public boolean hasCard() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .ItemTpl Card = 1;</code>
     * @return this
     */
    public GachaCard clearCard() {
      bitField0_ &= ~0x00000001;
      card.clear();
      return this;
    }

    /**
     * <code>optional .ItemTpl Card = 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 #getMutableCard()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.ItemTpl getCard() {
      return card;
    }

    /**
     * <code>optional .ItemTpl Card = 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.ItemTpl getMutableCard() {
      bitField0_ |= 0x00000001;
      return card;
    }

    /**
     * <code>optional .ItemTpl Card = 1;</code>
     * @param value the card to set
     * @return this
     */
    public GachaCard setCard(final Public.ItemTpl value) {
      bitField0_ |= 0x00000001;
      card.copyFrom(value);
      return this;
    }

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

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

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

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

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

    /**
     * <code>repeated .ItemTpl Rewards = 2;</code>
     * @return whether the rewards field is set
     */
    public boolean hasRewards() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .ItemTpl Rewards = 2;</code>
     * @return this
     */
    public GachaCard clearRewards() {
      bitField0_ &= ~0x00000004;
      rewards.clear();
      return this;
    }

    /**
     * <code>repeated .ItemTpl Rewards = 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 #getMutableRewards()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<Public.ItemTpl> getRewards() {
      return rewards;
    }

    /**
     * <code>repeated .ItemTpl Rewards = 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 RepeatedMessage<Public.ItemTpl> getMutableRewards() {
      bitField0_ |= 0x00000004;
      return rewards;
    }

    /**
     * <code>repeated .ItemTpl Rewards = 2;</code>
     * @param value the rewards to add
     * @return this
     */
    public GachaCard addRewards(final Public.ItemTpl value) {
      bitField0_ |= 0x00000004;
      rewards.add(value);
      return this;
    }

    /**
     * <code>repeated .ItemTpl Rewards = 2;</code>
     * @param values the rewards to add
     * @return this
     */
    public GachaCard addAllRewards(final Public.ItemTpl... values) {
      bitField0_ |= 0x00000004;
      rewards.addAll(values);
      return this;
    }

    @Override
    public GachaCard copyFrom(final GachaCard other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        card.copyFrom(other.card);
        nextPackage.copyFrom(other.nextPackage);
        rewards.copyFrom(other.rewards);
      }
      return this;
    }

    @Override
    public GachaCard mergeFrom(final GachaCard other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasCard()) {
        getMutableCard().mergeFrom(other.card);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasRewards()) {
        getMutableRewards().addAll(other.rewards);
      }
      return this;
    }

    @Override
    public GachaCard clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      card.clear();
      nextPackage.clear();
      rewards.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GachaCard)) {
        return false;
      }
      GachaCard other = (GachaCard) o;
      return bitField0_ == other.bitField0_
        && (!hasCard() || card.equals(other.card))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasRewards() || rewards.equals(other.rewards));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 10);
        output.writeMessageNoTag(card);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < rewards.length(); i++) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(rewards.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(card);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * rewards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(rewards);
      }
      return size;
    }

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

    @Override
    public GachaCard mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2092848: {
            if (input.isAtField(FieldNames.card)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(card);
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1529663740: {
            if (input.isAtField(FieldNames.rewards)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(rewards);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GachaCardFactory implements MessageFactory<GachaCard> {
      INSTANCE;

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

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

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

      static final FieldName rewards = FieldName.forField("Rewards");
    }
  }
}
