// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;

import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;

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

    /**
     * <code>optional .ExtraLineupType extra_lineup_type = 15;</code>
     */
    private int extraLineupType;

    private ChallengeLineupNotify() {
    }

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

    /**
     * <code>optional .ExtraLineupType extra_lineup_type = 15;</code>
     * @return whether the extraLineupType field is set
     */
    public boolean hasExtraLineupType() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional .ExtraLineupType extra_lineup_type = 15;</code>
     * @return this
     */
    public ChallengeLineupNotify clearExtraLineupType() {
      bitField0_ &= ~0x00000001;
      extraLineupType = 0;
      return this;
    }

    /**
     * <code>optional .ExtraLineupType extra_lineup_type = 15;</code>
     * @return the extraLineupType
     */
    public ExtraLineupTypeOuterClass.ExtraLineupType getExtraLineupType() {
      return ExtraLineupTypeOuterClass.ExtraLineupType.forNumber(extraLineupType);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link ChallengeLineupNotify#getExtraLineupType()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getExtraLineupTypeValue() {
      return extraLineupType;
    }

    /**
     * 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 ExtraLineupTypeOuterClass.ExtraLineupType}. Setting an invalid value
     * can cause {@link ChallengeLineupNotify#getExtraLineupType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public ChallengeLineupNotify setExtraLineupTypeValue(final int value) {
      bitField0_ |= 0x00000001;
      extraLineupType = value;
      return this;
    }

    /**
     * <code>optional .ExtraLineupType extra_lineup_type = 15;</code>
     * @param value the extraLineupType to set
     * @return this
     */
    public ChallengeLineupNotify setExtraLineupType(
        final ExtraLineupTypeOuterClass.ExtraLineupType value) {
      bitField0_ |= 0x00000001;
      extraLineupType = value.getNumber();
      return this;
    }

    @Override
    public ChallengeLineupNotify copyFrom(final ChallengeLineupNotify other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        extraLineupType = other.extraLineupType;
      }
      return this;
    }

    @Override
    public ChallengeLineupNotify mergeFrom(final ChallengeLineupNotify other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasExtraLineupType()) {
        setExtraLineupTypeValue(other.extraLineupType);
      }
      return this;
    }

    @Override
    public ChallengeLineupNotify clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      extraLineupType = 0;
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof ChallengeLineupNotify)) {
        return false;
      }
      ChallengeLineupNotify other = (ChallengeLineupNotify) o;
      return bitField0_ == other.bitField0_
        && (!hasExtraLineupType() || extraLineupType == other.extraLineupType);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 120);
        output.writeEnumNoTag(extraLineupType);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(extraLineupType);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public ChallengeLineupNotify mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 120: {
            // extraLineupType
            final int value = input.readInt32();
            if (ExtraLineupTypeOuterClass.ExtraLineupType.forNumber(value) != null) {
              extraLineupType = value;
              bitField0_ |= 0x00000001;
            }
            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.writeEnum(FieldNames.extraLineupType, extraLineupType, ExtraLineupTypeOuterClass.ExtraLineupType.converter());
      }
      output.endObject();
    }

    @Override
    public ChallengeLineupNotify mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -468135527:
          case -1144475077: {
            if (input.isAtField(FieldNames.extraLineupType)) {
              if (!input.trySkipNullValue()) {
                final ExtraLineupTypeOuterClass.ExtraLineupType value = input.readEnum(ExtraLineupTypeOuterClass.ExtraLineupType.converter());
                if (value != null) {
                  extraLineupType = value.getNumber();
                  bitField0_ |= 0x00000001;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum ChallengeLineupNotifyFactory implements MessageFactory<ChallengeLineupNotify> {
      INSTANCE;

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

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