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

    /**
     * <code>optional uint32 caster_id = 8;</code>
     */
    private int casterId;

    /**
     * <code>optional uint32 skill_index = 9;</code>
     */
    private int skillIndex;

    /**
     * <code>optional uint32 attacked_group_id = 15;</code>
     */
    private int attackedGroupId;

    private SceneCastSkillCostMpCsReq() {
    }

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

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

    /**
     * <code>optional uint32 caster_id = 8;</code>
     * @return this
     */
    public SceneCastSkillCostMpCsReq clearCasterId() {
      bitField0_ &= ~0x00000001;
      casterId = 0;
      return this;
    }

    /**
     * <code>optional uint32 caster_id = 8;</code>
     * @return the casterId
     */
    public int getCasterId() {
      return casterId;
    }

    /**
     * <code>optional uint32 caster_id = 8;</code>
     * @param value the casterId to set
     * @return this
     */
    public SceneCastSkillCostMpCsReq setCasterId(final int value) {
      bitField0_ |= 0x00000001;
      casterId = value;
      return this;
    }

    /**
     * <code>optional uint32 skill_index = 9;</code>
     * @return whether the skillIndex field is set
     */
    public boolean hasSkillIndex() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 skill_index = 9;</code>
     * @return this
     */
    public SceneCastSkillCostMpCsReq clearSkillIndex() {
      bitField0_ &= ~0x00000002;
      skillIndex = 0;
      return this;
    }

    /**
     * <code>optional uint32 skill_index = 9;</code>
     * @return the skillIndex
     */
    public int getSkillIndex() {
      return skillIndex;
    }

    /**
     * <code>optional uint32 skill_index = 9;</code>
     * @param value the skillIndex to set
     * @return this
     */
    public SceneCastSkillCostMpCsReq setSkillIndex(final int value) {
      bitField0_ |= 0x00000002;
      skillIndex = value;
      return this;
    }

    /**
     * <code>optional uint32 attacked_group_id = 15;</code>
     * @return whether the attackedGroupId field is set
     */
    public boolean hasAttackedGroupId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 attacked_group_id = 15;</code>
     * @return this
     */
    public SceneCastSkillCostMpCsReq clearAttackedGroupId() {
      bitField0_ &= ~0x00000004;
      attackedGroupId = 0;
      return this;
    }

    /**
     * <code>optional uint32 attacked_group_id = 15;</code>
     * @return the attackedGroupId
     */
    public int getAttackedGroupId() {
      return attackedGroupId;
    }

    /**
     * <code>optional uint32 attacked_group_id = 15;</code>
     * @param value the attackedGroupId to set
     * @return this
     */
    public SceneCastSkillCostMpCsReq setAttackedGroupId(final int value) {
      bitField0_ |= 0x00000004;
      attackedGroupId = value;
      return this;
    }

    @Override
    public SceneCastSkillCostMpCsReq copyFrom(final SceneCastSkillCostMpCsReq other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        casterId = other.casterId;
        skillIndex = other.skillIndex;
        attackedGroupId = other.attackedGroupId;
      }
      return this;
    }

    @Override
    public SceneCastSkillCostMpCsReq mergeFrom(final SceneCastSkillCostMpCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasCasterId()) {
        setCasterId(other.casterId);
      }
      if (other.hasSkillIndex()) {
        setSkillIndex(other.skillIndex);
      }
      if (other.hasAttackedGroupId()) {
        setAttackedGroupId(other.attackedGroupId);
      }
      return this;
    }

    @Override
    public SceneCastSkillCostMpCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      casterId = 0;
      skillIndex = 0;
      attackedGroupId = 0;
      return this;
    }

    @Override
    public SceneCastSkillCostMpCsReq 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 SceneCastSkillCostMpCsReq)) {
        return false;
      }
      SceneCastSkillCostMpCsReq other = (SceneCastSkillCostMpCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasCasterId() || casterId == other.casterId)
        && (!hasSkillIndex() || skillIndex == other.skillIndex)
        && (!hasAttackedGroupId() || attackedGroupId == other.attackedGroupId);
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt32NoTag(casterId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 72);
        output.writeUInt32NoTag(skillIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(attackedGroupId);
      }
    }

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

    @Override
    @SuppressWarnings("fallthrough")
    public SceneCastSkillCostMpCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 64: {
            // casterId
            casterId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 72) {
              break;
            }
          }
          case 72: {
            // skillIndex
            skillIndex = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // attackedGroupId
            attackedGroupId = input.readUInt32();
            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.casterId, casterId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.skillIndex, skillIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.attackedGroupId, attackedGroupId);
      }
      output.endObject();
    }

    @Override
    public SceneCastSkillCostMpCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 35676775:
          case 1106001422: {
            if (input.isAtField(FieldNames.casterId)) {
              if (!input.trySkipNullValue()) {
                casterId = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1587034369:
          case -1716021916: {
            if (input.isAtField(FieldNames.skillIndex)) {
              if (!input.trySkipNullValue()) {
                skillIndex = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1725961965:
          case -715836621: {
            if (input.isAtField(FieldNames.attackedGroupId)) {
              if (!input.trySkipNullValue()) {
                attackedGroupId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum SceneCastSkillCostMpCsReqFactory implements MessageFactory<SceneCastSkillCostMpCsReq> {
      INSTANCE;

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

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

      static final FieldName skillIndex = FieldName.forField("skillIndex", "skill_index");

      static final FieldName attackedGroupId = FieldName.forField("attackedGroupId", "attacked_group_id");
    }
  }
}
