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

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

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

    /**
     * <code>optional uint32 current_pam_skin_id = 6;</code>
     */
    private int currentPamSkinId;

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     */
    private final RepeatedInt unlockedPamSkins = RepeatedInt.newEmptyInstance();

    private GetPamSkinDataScRsp() {
    }

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

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

    /**
     * <code>optional uint32 retcode = 2;</code>
     * @return this
     */
    public GetPamSkinDataScRsp clearRetcode() {
      bitField0_ &= ~0x00000001;
      retcode = 0;
      return this;
    }

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

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

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

    /**
     * <code>optional uint32 current_pam_skin_id = 6;</code>
     * @return this
     */
    public GetPamSkinDataScRsp clearCurrentPamSkinId() {
      bitField0_ &= ~0x00000002;
      currentPamSkinId = 0;
      return this;
    }

    /**
     * <code>optional uint32 current_pam_skin_id = 6;</code>
     * @return the currentPamSkinId
     */
    public int getCurrentPamSkinId() {
      return currentPamSkinId;
    }

    /**
     * <code>optional uint32 current_pam_skin_id = 6;</code>
     * @param value the currentPamSkinId to set
     * @return this
     */
    public GetPamSkinDataScRsp setCurrentPamSkinId(final int value) {
      bitField0_ |= 0x00000002;
      currentPamSkinId = value;
      return this;
    }

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     * @return whether the unlockedPamSkins field is set
     */
    public boolean hasUnlockedPamSkins() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     * @return this
     */
    public GetPamSkinDataScRsp clearUnlockedPamSkins() {
      bitField0_ &= ~0x00000004;
      unlockedPamSkins.clear();
      return this;
    }

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableUnlockedPamSkins()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getUnlockedPamSkins() {
      return unlockedPamSkins;
    }

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedInt getMutableUnlockedPamSkins() {
      bitField0_ |= 0x00000004;
      return unlockedPamSkins;
    }

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     * @param value the unlockedPamSkins to add
     * @return this
     */
    public GetPamSkinDataScRsp addUnlockedPamSkins(final int value) {
      bitField0_ |= 0x00000004;
      unlockedPamSkins.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 unlocked_pam_skins = 10;</code>
     * @param values the unlockedPamSkins to add
     * @return this
     */
    public GetPamSkinDataScRsp addAllUnlockedPamSkins(final int... values) {
      bitField0_ |= 0x00000004;
      unlockedPamSkins.addAll(values);
      return this;
    }

    @Override
    public GetPamSkinDataScRsp copyFrom(final GetPamSkinDataScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        currentPamSkinId = other.currentPamSkinId;
        unlockedPamSkins.copyFrom(other.unlockedPamSkins);
      }
      return this;
    }

    @Override
    public GetPamSkinDataScRsp mergeFrom(final GetPamSkinDataScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasCurrentPamSkinId()) {
        setCurrentPamSkinId(other.currentPamSkinId);
      }
      if (other.hasUnlockedPamSkins()) {
        getMutableUnlockedPamSkins().addAll(other.unlockedPamSkins);
      }
      return this;
    }

    @Override
    public GetPamSkinDataScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      currentPamSkinId = 0;
      unlockedPamSkins.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GetPamSkinDataScRsp)) {
        return false;
      }
      GetPamSkinDataScRsp other = (GetPamSkinDataScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasCurrentPamSkinId() || currentPamSkinId == other.currentPamSkinId)
        && (!hasUnlockedPamSkins() || unlockedPamSkins.equals(other.unlockedPamSkins));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 48);
        output.writeUInt32NoTag(currentPamSkinId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < unlockedPamSkins.length(); i++) {
          output.writeRawByte((byte) 80);
          output.writeUInt32NoTag(unlockedPamSkins.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(currentPamSkinId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * unlockedPamSkins.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(unlockedPamSkins);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public GetPamSkinDataScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 48) {
              break;
            }
          }
          case 48: {
            // currentPamSkinId
            currentPamSkinId = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 82) {
              break;
            }
          }
          case 82: {
            // unlockedPamSkins [packed=true]
            input.readPackedUInt32(unlockedPamSkins, tag);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 80: {
            // unlockedPamSkins [packed=false]
            tag = input.readRepeatedUInt32(unlockedPamSkins, tag);
            bitField0_ |= 0x00000004;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.retcode, retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.currentPamSkinId, currentPamSkinId);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedUInt32(FieldNames.unlockedPamSkins, unlockedPamSkins);
      }
      output.endObject();
    }

    @Override
    public GetPamSkinDataScRsp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1097936398: {
            if (input.isAtField(FieldNames.retcode)) {
              if (!input.trySkipNullValue()) {
                retcode = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1746750021:
          case 249948340: {
            if (input.isAtField(FieldNames.currentPamSkinId)) {
              if (!input.trySkipNullValue()) {
                currentPamSkinId = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 699410269:
          case -344383785: {
            if (input.isAtField(FieldNames.unlockedPamSkins)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(unlockedPamSkins);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetPamSkinDataScRspFactory implements MessageFactory<GetPamSkinDataScRsp> {
      INSTANCE;

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

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

      static final FieldName currentPamSkinId = FieldName.forField("currentPamSkinId", "current_pam_skin_id");

      static final FieldName unlockedPamSkins = FieldName.forField("unlockedPamSkins", "unlocked_pam_skins");
    }
  }
}
