// 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.ProtoEnum;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedByte;
import us.hebi.quickbuf.RepeatedMessage;

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

    /**
     * <code>optional uint32 Value = 1;</code>
     */
    private int value_;

    /**
     * <code>optional .Events Events = 8;</code>
     */
    private final Public.Events events = Public.Events.newInstance();

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

    private InfinityTowerSettleReq() {
    }

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

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

    /**
     * <code>optional uint32 Value = 1;</code>
     * @return this
     */
    public InfinityTowerSettleReq clearValue() {
      bitField0_ &= ~0x00000001;
      value_ = 0;
      return this;
    }

    /**
     * <code>optional uint32 Value = 1;</code>
     * @return the value_
     */
    public int getValue() {
      return value_;
    }

    /**
     * <code>optional uint32 Value = 1;</code>
     * @param value the value_ to set
     * @return this
     */
    public InfinityTowerSettleReq setValue(final int value) {
      bitField0_ |= 0x00000001;
      value_ = value;
      return this;
    }

    /**
     * <code>optional .Events Events = 8;</code>
     * @return whether the events field is set
     */
    public boolean hasEvents() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .Events Events = 8;</code>
     * @return this
     */
    public InfinityTowerSettleReq clearEvents() {
      bitField0_ &= ~0x00000002;
      events.clear();
      return this;
    }

    /**
     * <code>optional .Events Events = 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 #getMutableEvents()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.Events getEvents() {
      return events;
    }

    /**
     * <code>optional .Events Events = 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 Public.Events getMutableEvents() {
      bitField0_ |= 0x00000002;
      return events;
    }

    /**
     * <code>optional .Events Events = 8;</code>
     * @param value the events to set
     * @return this
     */
    public InfinityTowerSettleReq setEvents(final Public.Events value) {
      bitField0_ |= 0x00000002;
      events.copyFrom(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 InfinityTowerSettleReq 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 InfinityTowerSettleReq 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 InfinityTowerSettleReq 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 InfinityTowerSettleReq setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public InfinityTowerSettleReq copyFrom(final InfinityTowerSettleReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        value_ = other.value_;
        events.copyFrom(other.events);
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public InfinityTowerSettleReq mergeFrom(final InfinityTowerSettleReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasValue()) {
        setValue(other.value_);
      }
      if (other.hasEvents()) {
        getMutableEvents().mergeFrom(other.events);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof InfinityTowerSettleReq)) {
        return false;
      }
      InfinityTowerSettleReq other = (InfinityTowerSettleReq) o;
      return bitField0_ == other.bitField0_
        && (!hasValue() || value_ == other.value_)
        && (!hasEvents() || events.equals(other.events))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(value_);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 66);
        output.writeMessageNoTag(events);
      }
      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(value_);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(events);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

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

    @Override
    public InfinityTowerSettleReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 82420049: {
            if (input.isAtField(FieldNames.value_)) {
              if (!input.trySkipNullValue()) {
                value_ = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2087505209: {
            if (input.isAtField(FieldNames.events)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(events);
                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 InfinityTowerSettleReq clone() {
      return new InfinityTowerSettleReq().copyFrom(this);
    }

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

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

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

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

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

    private enum InfinityTowerSettleReqFactory implements MessageFactory<InfinityTowerSettleReq> {
      INSTANCE;

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

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

      static final FieldName events = FieldName.forField("Events");

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

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

    /**
     * <code>optional uint32 NextLevelId = 1;</code>
     */
    private int nextLevelId;

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

    /**
     * <code>optional .InfinityTowerSettleResp.Reason Value = 7;</code>
     */
    private int value_;

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

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

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

    private InfinityTowerSettleResp() {
    }

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

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

    /**
     * <code>optional uint32 NextLevelId = 1;</code>
     * @return this
     */
    public InfinityTowerSettleResp clearNextLevelId() {
      bitField0_ &= ~0x00000001;
      nextLevelId = 0;
      return this;
    }

    /**
     * <code>optional uint32 NextLevelId = 1;</code>
     * @return the nextLevelId
     */
    public int getNextLevelId() {
      return nextLevelId;
    }

    /**
     * <code>optional uint32 NextLevelId = 1;</code>
     * @param value the nextLevelId to set
     * @return this
     */
    public InfinityTowerSettleResp setNextLevelId(final int value) {
      bitField0_ |= 0x00000001;
      nextLevelId = value;
      return this;
    }

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

    /**
     * <code>optional uint32 BountyLevel = 6;</code>
     * @return this
     */
    public InfinityTowerSettleResp clearBountyLevel() {
      bitField0_ &= ~0x00000002;
      bountyLevel = 0;
      return this;
    }

    /**
     * <code>optional uint32 BountyLevel = 6;</code>
     * @return the bountyLevel
     */
    public int getBountyLevel() {
      return bountyLevel;
    }

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

    /**
     * <code>optional .InfinityTowerSettleResp.Reason Value = 7;</code>
     * @return whether the value_ field is set
     */
    public boolean hasValue() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .InfinityTowerSettleResp.Reason Value = 7;</code>
     * @return this
     */
    public InfinityTowerSettleResp clearValue() {
      bitField0_ &= ~0x00000004;
      value_ = 0;
      return this;
    }

    /**
     * <code>optional .InfinityTowerSettleResp.Reason Value = 7;</code>
     * @return the value_
     */
    public Reason getValue() {
      return Reason.forNumber(value_);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link InfinityTowerSettleResp#getValue()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getValueValue() {
      return value_;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link Reason}. Setting an invalid value
     * can cause {@link InfinityTowerSettleResp#getValue()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public InfinityTowerSettleResp setValueValue(final int value) {
      bitField0_ |= 0x00000004;
      value_ = value;
      return this;
    }

    /**
     * <code>optional .InfinityTowerSettleResp.Reason Value = 7;</code>
     * @param value the value_ to set
     * @return this
     */
    public InfinityTowerSettleResp setValue(final Reason value) {
      bitField0_ |= 0x00000004;
      value_ = value.getNumber();
      return this;
    }

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

    /**
     * <code>optional .ChangeInfo Change = 3;</code>
     * @return this
     */
    public InfinityTowerSettleResp clearChange() {
      bitField0_ &= ~0x00000008;
      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_ |= 0x00000008;
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 3;</code>
     * @param value the change to set
     * @return this
     */
    public InfinityTowerSettleResp setChange(final Public.ChangeInfo value) {
      bitField0_ |= 0x00000008;
      change.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 InfinityTowerSettleResp 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 InfinityTowerSettleResp 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 InfinityTowerSettleResp 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 InfinityTowerSettleResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated .ItemTpl Show = 2;</code>
     * @return whether the show field is set
     */
    public boolean hasShow() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>repeated .ItemTpl Show = 2;</code>
     * @return this
     */
    public InfinityTowerSettleResp clearShow() {
      bitField0_ &= ~0x00000020;
      show.clear();
      return this;
    }

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

    /**
     * <code>repeated .ItemTpl Show = 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> getMutableShow() {
      bitField0_ |= 0x00000020;
      return show;
    }

    /**
     * <code>repeated .ItemTpl Show = 2;</code>
     * @param value the show to add
     * @return this
     */
    public InfinityTowerSettleResp addShow(final Public.ItemTpl value) {
      bitField0_ |= 0x00000020;
      show.add(value);
      return this;
    }

    /**
     * <code>repeated .ItemTpl Show = 2;</code>
     * @param values the show to add
     * @return this
     */
    public InfinityTowerSettleResp addAllShow(final Public.ItemTpl... values) {
      bitField0_ |= 0x00000020;
      show.addAll(values);
      return this;
    }

    @Override
    public InfinityTowerSettleResp copyFrom(final InfinityTowerSettleResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        nextLevelId = other.nextLevelId;
        bountyLevel = other.bountyLevel;
        value_ = other.value_;
        change.copyFrom(other.change);
        nextPackage.copyFrom(other.nextPackage);
        show.copyFrom(other.show);
      }
      return this;
    }

    @Override
    public InfinityTowerSettleResp mergeFrom(final InfinityTowerSettleResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasNextLevelId()) {
        setNextLevelId(other.nextLevelId);
      }
      if (other.hasBountyLevel()) {
        setBountyLevel(other.bountyLevel);
      }
      if (other.hasValue()) {
        setValueValue(other.value_);
      }
      if (other.hasChange()) {
        getMutableChange().mergeFrom(other.change);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasShow()) {
        getMutableShow().addAll(other.show);
      }
      return this;
    }

    @Override
    public InfinityTowerSettleResp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextLevelId = 0;
      bountyLevel = 0;
      value_ = 0;
      change.clear();
      nextPackage.clear();
      show.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof InfinityTowerSettleResp)) {
        return false;
      }
      InfinityTowerSettleResp other = (InfinityTowerSettleResp) o;
      return bitField0_ == other.bitField0_
        && (!hasNextLevelId() || nextLevelId == other.nextLevelId)
        && (!hasBountyLevel() || bountyLevel == other.bountyLevel)
        && (!hasValue() || value_ == other.value_)
        && (!hasChange() || change.equals(other.change))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasShow() || show.equals(other.show));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(nextLevelId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(bountyLevel);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 56);
        output.writeEnumNoTag(value_);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 26);
        output.writeMessageNoTag(change);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        for (int i = 0; i < show.length(); i++) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(show.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(nextLevelId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(bountyLevel);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(value_);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(change);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += (1 * show.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(show);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public InfinityTowerSettleResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // nextLevelId
            nextLevelId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // bountyLevel
            bountyLevel = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // value_
            final int value = input.readInt32();
            if (Reason.forNumber(value) != null) {
              value_ = value;
              bitField0_ |= 0x00000004;
            }
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // change
            input.readMessage(change);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // show
            tag = input.readRepeatedMessage(show, tag);
            bitField0_ |= 0x00000020;
            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.nextLevelId, nextLevelId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.bountyLevel, bountyLevel);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeEnum(FieldNames.value_, value_, Reason.converter());
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.change, change);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRepeatedMessage(FieldNames.show, show);
      }
      output.endObject();
    }

    @Override
    public InfinityTowerSettleResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1205477076: {
            if (input.isAtField(FieldNames.nextLevelId)) {
              if (!input.trySkipNullValue()) {
                nextLevelId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2147349127: {
            if (input.isAtField(FieldNames.bountyLevel)) {
              if (!input.trySkipNullValue()) {
                bountyLevel = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 82420049: {
            if (input.isAtField(FieldNames.value_)) {
              if (!input.trySkipNullValue()) {
                final Reason value = input.readEnum(Reason.converter());
                if (value != null) {
                  value_ = value.getNumber();
                  bitField0_ |= 0x00000004;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2017198032: {
            if (input.isAtField(FieldNames.change)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(change);
                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;
          }
          case 2576157: {
            if (input.isAtField(FieldNames.show)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(show);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    /**
     * Protobuf enum {@code Reason}
     */
    public enum Reason implements ProtoEnum<Reason> {
      /**
       * <code>Nil = 0;</code>
       */
      Nil("Nil", 0),

      /**
       * <code>PreLevel = 1;</code>
       */
      PreLevel("PreLevel", 1),

      /**
       * <code>WorldClass = 2;</code>
       */
      WorldClass("WorldClass", 2),

      /**
       * <code>Build = 3;</code>
       */
      Build("Build", 3),

      /**
       * <code>NoOpen = 4;</code>
       */
      NoOpen("NoOpen", 4);

      /**
       * <code>Nil = 0;</code>
       */
      public static final int Nil_VALUE = 0;

      /**
       * <code>PreLevel = 1;</code>
       */
      public static final int PreLevel_VALUE = 1;

      /**
       * <code>WorldClass = 2;</code>
       */
      public static final int WorldClass_VALUE = 2;

      /**
       * <code>Build = 3;</code>
       */
      public static final int Build_VALUE = 3;

      /**
       * <code>NoOpen = 4;</code>
       */
      public static final int NoOpen_VALUE = 4;

      private final String name;

      private final int number;

      private Reason(String name, int number) {
        this.name = name;
        this.number = number;
      }

      /**
       * @return the string representation of enum entry
       */
      @Override
      public String getName() {
        return name;
      }

      /**
       * @return the numeric wire value of this enum entry
       */
      @Override
      public int getNumber() {
        return number;
      }

      /**
       * @return a converter that maps between this enum's numeric and text representations
       */
      public static ProtoEnum.EnumConverter<Reason> converter() {
        return ReasonConverter.INSTANCE;
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @return The enum associated with the given numeric wire value, or null if unknown.
       */
      public static Reason forNumber(int value) {
        return ReasonConverter.INSTANCE.forNumber(value);
      }

      /**
       * @param value The numeric wire value of the corresponding enum entry.
       * @param other Fallback value in case the value is not known.
       * @return The enum associated with the given numeric wire value, or the fallback value if unknown.
       */
      public static Reason forNumberOr(int number, Reason other) {
        Reason value = forNumber(number);
        return value == null ? other : value;
      }

      enum ReasonConverter implements ProtoEnum.EnumConverter<Reason> {
        INSTANCE;

        private static final Reason[] lookup = new Reason[5];

        static {
          lookup[0] = Nil;
          lookup[1] = PreLevel;
          lookup[2] = WorldClass;
          lookup[3] = Build;
          lookup[4] = NoOpen;
        }

        @Override
        public final Reason forNumber(final int value) {
          if (value >= 0 && value < lookup.length) {
            return lookup[value];
          }
          return null;
        }

        @Override
        public final Reason forName(final CharSequence value) {
          switch (value.length()) {
            case 3: {
              if (ProtoUtil.isEqual("Nil", value)) {
                return Nil;
              }
              break;
            }
            case 5: {
              if (ProtoUtil.isEqual("Build", value)) {
                return Build;
              }
              break;
            }
            case 6: {
              if (ProtoUtil.isEqual("NoOpen", value)) {
                return NoOpen;
              }
              break;
            }
            case 8: {
              if (ProtoUtil.isEqual("PreLevel", value)) {
                return PreLevel;
              }
              break;
            }
            case 10: {
              if (ProtoUtil.isEqual("WorldClass", value)) {
                return WorldClass;
              }
              break;
            }
          }
          return null;
        }
      }
    }

    private enum InfinityTowerSettleRespFactory implements MessageFactory<InfinityTowerSettleResp> {
      INSTANCE;

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

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

      static final FieldName bountyLevel = FieldName.forField("BountyLevel");

      static final FieldName value_ = FieldName.forField("Value");

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

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

      static final FieldName show = FieldName.forField("Show");
    }
  }
}
