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

    /**
     * <code>optional uint32 gacha_type = 2;</code>
     */
    private int gachaType;

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

    /**
     * <code>optional .GachaCeiling gacha_ceiling = 5;</code>
     */
    private final GachaCeilingOuterClass.GachaCeiling gachaCeiling = GachaCeilingOuterClass.GachaCeiling.newInstance();

    private GetGachaCeilingScRsp() {
    }

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

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

    /**
     * <code>optional uint32 gacha_type = 2;</code>
     * @return this
     */
    public GetGachaCeilingScRsp clearGachaType() {
      bitField0_ &= ~0x00000001;
      gachaType = 0;
      return this;
    }

    /**
     * <code>optional uint32 gacha_type = 2;</code>
     * @return the gachaType
     */
    public int getGachaType() {
      return gachaType;
    }

    /**
     * <code>optional uint32 gacha_type = 2;</code>
     * @param value the gachaType to set
     * @return this
     */
    public GetGachaCeilingScRsp setGachaType(final int value) {
      bitField0_ |= 0x00000001;
      gachaType = value;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 4;</code>
     * @return whether the retcode field is set
     */
    public boolean hasRetcode() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 retcode = 4;</code>
     * @return this
     */
    public GetGachaCeilingScRsp clearRetcode() {
      bitField0_ &= ~0x00000002;
      retcode = 0;
      return this;
    }

    /**
     * <code>optional uint32 retcode = 4;</code>
     * @return the retcode
     */
    public int getRetcode() {
      return retcode;
    }

    /**
     * <code>optional uint32 retcode = 4;</code>
     * @param value the retcode to set
     * @return this
     */
    public GetGachaCeilingScRsp setRetcode(final int value) {
      bitField0_ |= 0x00000002;
      retcode = value;
      return this;
    }

    /**
     * <code>optional .GachaCeiling gacha_ceiling = 5;</code>
     * @return whether the gachaCeiling field is set
     */
    public boolean hasGachaCeiling() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .GachaCeiling gacha_ceiling = 5;</code>
     * @return this
     */
    public GetGachaCeilingScRsp clearGachaCeiling() {
      bitField0_ &= ~0x00000004;
      gachaCeiling.clear();
      return this;
    }

    /**
     * <code>optional .GachaCeiling gacha_ceiling = 5;</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 #getMutableGachaCeiling()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public GachaCeilingOuterClass.GachaCeiling getGachaCeiling() {
      return gachaCeiling;
    }

    /**
     * <code>optional .GachaCeiling gacha_ceiling = 5;</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 GachaCeilingOuterClass.GachaCeiling getMutableGachaCeiling() {
      bitField0_ |= 0x00000004;
      return gachaCeiling;
    }

    /**
     * <code>optional .GachaCeiling gacha_ceiling = 5;</code>
     * @param value the gachaCeiling to set
     * @return this
     */
    public GetGachaCeilingScRsp setGachaCeiling(final GachaCeilingOuterClass.GachaCeiling value) {
      bitField0_ |= 0x00000004;
      gachaCeiling.copyFrom(value);
      return this;
    }

    @Override
    public GetGachaCeilingScRsp copyFrom(final GetGachaCeilingScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        gachaType = other.gachaType;
        retcode = other.retcode;
        gachaCeiling.copyFrom(other.gachaCeiling);
      }
      return this;
    }

    @Override
    public GetGachaCeilingScRsp mergeFrom(final GetGachaCeilingScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasGachaType()) {
        setGachaType(other.gachaType);
      }
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasGachaCeiling()) {
        getMutableGachaCeiling().mergeFrom(other.gachaCeiling);
      }
      return this;
    }

    @Override
    public GetGachaCeilingScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      gachaType = 0;
      retcode = 0;
      gachaCeiling.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GetGachaCeilingScRsp)) {
        return false;
      }
      GetGachaCeilingScRsp other = (GetGachaCeilingScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasGachaType() || gachaType == other.gachaType)
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasGachaCeiling() || gachaCeiling.equals(other.gachaCeiling));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(gachaType);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 42);
        output.writeMessageNoTag(gachaCeiling);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(gachaCeiling);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public GetGachaCeilingScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // gachaType
            gachaType = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 42) {
              break;
            }
          }
          case 42: {
            // gachaCeiling
            input.readMessage(gachaCeiling);
            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.gachaType, gachaType);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.retcode, retcode);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeMessage(FieldNames.gachaCeiling, gachaCeiling);
      }
      output.endObject();
    }

    @Override
    public GetGachaCeilingScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 802848732:
          case -871474217: {
            if (input.isAtField(FieldNames.gachaType)) {
              if (!input.trySkipNullValue()) {
                gachaType = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1097936398: {
            if (input.isAtField(FieldNames.retcode)) {
              if (!input.trySkipNullValue()) {
                retcode = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 507275483:
          case -1792489728: {
            if (input.isAtField(FieldNames.gachaCeiling)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(gachaCeiling);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetGachaCeilingScRspFactory implements MessageFactory<GetGachaCeilingScRsp> {
      INSTANCE;

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

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

      static final FieldName retcode = FieldName.forField("retcode");

      static final FieldName gachaCeiling = FieldName.forField("gachaCeiling", "gacha_ceiling");
    }
  }
}
