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

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

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

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

    /**
     * <code>optional .MotionInfo target_motion = 5;</code>
     */
    private final MotionInfoOuterClass.MotionInfo targetMotion = MotionInfoOuterClass.MotionInfo.newInstance();

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</code>
     */
    private final RepeatedInt hitTargetIdList = RepeatedInt.newEmptyInstance();

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</code>
     */
    private final RepeatedInt assistMonsterIdList = RepeatedInt.newEmptyInstance();

    private SceneCastSkillCsReq() {
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * <code>optional .MotionInfo target_motion = 5;</code>
     * @return whether the targetMotion field is set
     */
    public boolean hasTargetMotion() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional .MotionInfo target_motion = 5;</code>
     * @return this
     */
    public SceneCastSkillCsReq clearTargetMotion() {
      bitField0_ &= ~0x00000008;
      targetMotion.clear();
      return this;
    }

    /**
     * <code>optional .MotionInfo target_motion = 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 #getMutableTargetMotion()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public MotionInfoOuterClass.MotionInfo getTargetMotion() {
      return targetMotion;
    }

    /**
     * <code>optional .MotionInfo target_motion = 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 MotionInfoOuterClass.MotionInfo getMutableTargetMotion() {
      bitField0_ |= 0x00000008;
      return targetMotion;
    }

    /**
     * <code>optional .MotionInfo target_motion = 5;</code>
     * @param value the targetMotion to set
     * @return this
     */
    public SceneCastSkillCsReq setTargetMotion(final MotionInfoOuterClass.MotionInfo value) {
      bitField0_ |= 0x00000008;
      targetMotion.copyFrom(value);
      return this;
    }

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</code>
     * @return whether the hitTargetIdList field is set
     */
    public boolean hasHitTargetIdList() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</code>
     * @return this
     */
    public SceneCastSkillCsReq clearHitTargetIdList() {
      bitField0_ &= ~0x00000010;
      hitTargetIdList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</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 #getMutableHitTargetIdList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getHitTargetIdList() {
      return hitTargetIdList;
    }

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</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 getMutableHitTargetIdList() {
      bitField0_ |= 0x00000010;
      return hitTargetIdList;
    }

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</code>
     * @param value the hitTargetIdList to add
     * @return this
     */
    public SceneCastSkillCsReq addHitTargetIdList(final int value) {
      bitField0_ |= 0x00000010;
      hitTargetIdList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 hit_target_id_list = 1;</code>
     * @param values the hitTargetIdList to add
     * @return this
     */
    public SceneCastSkillCsReq addAllHitTargetIdList(final int... values) {
      bitField0_ |= 0x00000010;
      hitTargetIdList.addAll(values);
      return this;
    }

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</code>
     * @return whether the assistMonsterIdList field is set
     */
    public boolean hasAssistMonsterIdList() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</code>
     * @return this
     */
    public SceneCastSkillCsReq clearAssistMonsterIdList() {
      bitField0_ &= ~0x00000020;
      assistMonsterIdList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</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 #getMutableAssistMonsterIdList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getAssistMonsterIdList() {
      return assistMonsterIdList;
    }

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</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 getMutableAssistMonsterIdList() {
      bitField0_ |= 0x00000020;
      return assistMonsterIdList;
    }

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</code>
     * @param value the assistMonsterIdList to add
     * @return this
     */
    public SceneCastSkillCsReq addAssistMonsterIdList(final int value) {
      bitField0_ |= 0x00000020;
      assistMonsterIdList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 assist_monster_id_list = 3;</code>
     * @param values the assistMonsterIdList to add
     * @return this
     */
    public SceneCastSkillCsReq addAllAssistMonsterIdList(final int... values) {
      bitField0_ |= 0x00000020;
      assistMonsterIdList.addAll(values);
      return this;
    }

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

    @Override
    public SceneCastSkillCsReq mergeFrom(final SceneCastSkillCsReq other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasAttackedGroupId()) {
        setAttackedGroupId(other.attackedGroupId);
      }
      if (other.hasSkillIndex()) {
        setSkillIndex(other.skillIndex);
      }
      if (other.hasCasterId()) {
        setCasterId(other.casterId);
      }
      if (other.hasTargetMotion()) {
        getMutableTargetMotion().mergeFrom(other.targetMotion);
      }
      if (other.hasHitTargetIdList()) {
        getMutableHitTargetIdList().addAll(other.hitTargetIdList);
      }
      if (other.hasAssistMonsterIdList()) {
        getMutableAssistMonsterIdList().addAll(other.assistMonsterIdList);
      }
      return this;
    }

    @Override
    public SceneCastSkillCsReq clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      attackedGroupId = 0;
      skillIndex = 0;
      casterId = 0;
      targetMotion.clear();
      hitTargetIdList.clear();
      assistMonsterIdList.clear();
      return this;
    }

    @Override
    public SceneCastSkillCsReq clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      targetMotion.clearQuick();
      hitTargetIdList.clear();
      assistMonsterIdList.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof SceneCastSkillCsReq)) {
        return false;
      }
      SceneCastSkillCsReq other = (SceneCastSkillCsReq) o;
      return bitField0_ == other.bitField0_
        && (!hasAttackedGroupId() || attackedGroupId == other.attackedGroupId)
        && (!hasSkillIndex() || skillIndex == other.skillIndex)
        && (!hasCasterId() || casterId == other.casterId)
        && (!hasTargetMotion() || targetMotion.equals(other.targetMotion))
        && (!hasHitTargetIdList() || hitTargetIdList.equals(other.hitTargetIdList))
        && (!hasAssistMonsterIdList() || assistMonsterIdList.equals(other.assistMonsterIdList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(attackedGroupId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 64);
        output.writeUInt32NoTag(skillIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(casterId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 42);
        output.writeMessageNoTag(targetMotion);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        for (int i = 0; i < hitTargetIdList.length(); i++) {
          output.writeRawByte((byte) 8);
          output.writeUInt32NoTag(hitTargetIdList.array()[i]);
        }
      }
      if ((bitField0_ & 0x00000020) != 0) {
        for (int i = 0; i < assistMonsterIdList.length(); i++) {
          output.writeRawByte((byte) 24);
          output.writeUInt32NoTag(assistMonsterIdList.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(attackedGroupId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(skillIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(casterId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(targetMotion);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += (1 * hitTargetIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(hitTargetIdList);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += (1 * assistMonsterIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(assistMonsterIdList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public SceneCastSkillCsReq mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // attackedGroupId
            attackedGroupId = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 64) {
              break;
            }
          }
          case 64: {
            // skillIndex
            skillIndex = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // casterId
            casterId = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 42) {
              break;
            }
          }
          case 42: {
            // targetMotion
            input.readMessage(targetMotion);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // hitTargetIdList [packed=true]
            input.readPackedUInt32(hitTargetIdList, tag);
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // assistMonsterIdList [packed=true]
            input.readPackedUInt32(assistMonsterIdList, tag);
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 8: {
            // hitTargetIdList [packed=false]
            tag = input.readRepeatedUInt32(hitTargetIdList, tag);
            bitField0_ |= 0x00000010;
            break;
          }
          case 24: {
            // assistMonsterIdList [packed=false]
            tag = input.readRepeatedUInt32(assistMonsterIdList, tag);
            bitField0_ |= 0x00000020;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.attackedGroupId, attackedGroupId);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.skillIndex, skillIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.casterId, casterId);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeMessage(FieldNames.targetMotion, targetMotion);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRepeatedUInt32(FieldNames.hitTargetIdList, hitTargetIdList);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRepeatedUInt32(FieldNames.assistMonsterIdList, assistMonsterIdList);
      }
      output.endObject();
    }

    @Override
    public SceneCastSkillCsReq mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1725961965:
          case -715836621: {
            if (input.isAtField(FieldNames.attackedGroupId)) {
              if (!input.trySkipNullValue()) {
                attackedGroupId = 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 35676775:
          case 1106001422: {
            if (input.isAtField(FieldNames.casterId)) {
              if (!input.trySkipNullValue()) {
                casterId = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -716903257:
          case -2015521244: {
            if (input.isAtField(FieldNames.targetMotion)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(targetMotion);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 269057149:
          case 197471936: {
            if (input.isAtField(FieldNames.hitTargetIdList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(hitTargetIdList);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1198312214:
          case -1972457465: {
            if (input.isAtField(FieldNames.assistMonsterIdList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(assistMonsterIdList);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum SceneCastSkillCsReqFactory implements MessageFactory<SceneCastSkillCsReq> {
      INSTANCE;

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

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

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

      static final FieldName casterId = FieldName.forField("casterId", "caster_id");

      static final FieldName targetMotion = FieldName.forField("targetMotion", "target_motion");

      static final FieldName hitTargetIdList = FieldName.forField("hitTargetIdList", "hit_target_id_list");

      static final FieldName assistMonsterIdList = FieldName.forField("assistMonsterIdList", "assist_monster_id_list");
    }
  }
}
