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

    /**
     * <code>optional uint32 pam_skin_id = 8;</code>
     */
    private int pamSkinId;

    private SelectPamSkinCsReq() {
    }

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

    /**
     * <code>optional uint32 pam_skin_id = 8;</code>
     * @return whether the pamSkinId field is set
     */
    public boolean hasPamSkinId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 pam_skin_id = 8;</code>
     * @return this
     */
    public SelectPamSkinCsReq clearPamSkinId() {
      bitField0_ &= ~0x00000001;
      pamSkinId = 0;
      return this;
    }

    /**
     * <code>optional uint32 pam_skin_id = 8;</code>
     * @return the pamSkinId
     */
    public int getPamSkinId() {
      return pamSkinId;
    }

    /**
     * <code>optional uint32 pam_skin_id = 8;</code>
     * @param value the pamSkinId to set
     * @return this
     */
    public SelectPamSkinCsReq setPamSkinId(final int value) {
      bitField0_ |= 0x00000001;
      pamSkinId = value;
      return this;
    }

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

    @Override
    public SelectPamSkinCsReq mergeFrom(final SelectPamSkinCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasPamSkinId()) {
        setPamSkinId(other.pamSkinId);
      }
      return this;
    }

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

    @Override
    public SelectPamSkinCsReq 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 SelectPamSkinCsReq)) {
        return false;
      }
      SelectPamSkinCsReq other = (SelectPamSkinCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasPamSkinId() || pamSkinId == other.pamSkinId);
    }

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

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

    @Override
    @SuppressWarnings("fallthrough")
    public SelectPamSkinCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 64: {
            // pamSkinId
            pamSkinId = input.readUInt32();
            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.writeUInt32(FieldNames.pamSkinId, pamSkinId);
      }
      output.endObject();
    }

    @Override
    public SelectPamSkinCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 1409366836:
          case -510444934: {
            if (input.isAtField(FieldNames.pamSkinId)) {
              if (!input.trySkipNullValue()) {
                pamSkinId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum SelectPamSkinCsReqFactory implements MessageFactory<SelectPamSkinCsReq> {
      INSTANCE;

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

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