// 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.RepeatedMessage;

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

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

    /**
     * <code>optional .Gender gender = 2;</code>
     */
    private int gender;

    /**
     * <code>optional .HeroBasicType cur_basic_type = 11;</code>
     */
    private int curBasicType;

    /**
     * <code>optional bool DBMPIJBHAGI = 3;</code>
     */
    private boolean dBMPIJBHAGI;

    /**
     * <code>optional bool NHHDDFFBGNE = 4;</code>
     */
    private boolean nHHDDFFBGNE;

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</code>
     */
    private final RepeatedMessage<HeroBasicTypeInfoOuterClass.HeroBasicTypeInfo> basicTypeInfoList = RepeatedMessage.newEmptyInstance(HeroBasicTypeInfoOuterClass.HeroBasicTypeInfo.getFactory());

    private GetHeroBasicTypeInfoScRsp() {
    }

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

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

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

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

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

    /**
     * <code>optional .Gender gender = 2;</code>
     * @return whether the gender field is set
     */
    public boolean hasGender() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .Gender gender = 2;</code>
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp clearGender() {
      bitField0_ &= ~0x00000002;
      gender = 0;
      return this;
    }

    /**
     * <code>optional .Gender gender = 2;</code>
     * @return the gender
     */
    public GenderOuterClass.Gender getGender() {
      return GenderOuterClass.Gender.forNumber(gender);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link GetHeroBasicTypeInfoScRsp#getGender()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getGenderValue() {
      return gender;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link GenderOuterClass.Gender}. Setting an invalid value
     * can cause {@link GetHeroBasicTypeInfoScRsp#getGender()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp setGenderValue(final int value) {
      bitField0_ |= 0x00000002;
      gender = value;
      return this;
    }

    /**
     * <code>optional .Gender gender = 2;</code>
     * @param value the gender to set
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp setGender(final GenderOuterClass.Gender value) {
      bitField0_ |= 0x00000002;
      gender = value.getNumber();
      return this;
    }

    /**
     * <code>optional .HeroBasicType cur_basic_type = 11;</code>
     * @return whether the curBasicType field is set
     */
    public boolean hasCurBasicType() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .HeroBasicType cur_basic_type = 11;</code>
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp clearCurBasicType() {
      bitField0_ &= ~0x00000004;
      curBasicType = 0;
      return this;
    }

    /**
     * <code>optional .HeroBasicType cur_basic_type = 11;</code>
     * @return the curBasicType
     */
    public HeroBasicTypeOuterClass.HeroBasicType getCurBasicType() {
      return HeroBasicTypeOuterClass.HeroBasicType.forNumber(curBasicType);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link GetHeroBasicTypeInfoScRsp#getCurBasicType()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getCurBasicTypeValue() {
      return curBasicType;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link HeroBasicTypeOuterClass.HeroBasicType}. Setting an invalid value
     * can cause {@link GetHeroBasicTypeInfoScRsp#getCurBasicType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp setCurBasicTypeValue(final int value) {
      bitField0_ |= 0x00000004;
      curBasicType = value;
      return this;
    }

    /**
     * <code>optional .HeroBasicType cur_basic_type = 11;</code>
     * @param value the curBasicType to set
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp setCurBasicType(
        final HeroBasicTypeOuterClass.HeroBasicType value) {
      bitField0_ |= 0x00000004;
      curBasicType = value.getNumber();
      return this;
    }

    /**
     * <code>optional bool DBMPIJBHAGI = 3;</code>
     * @return whether the dBMPIJBHAGI field is set
     */
    public boolean hasDBMPIJBHAGI() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bool DBMPIJBHAGI = 3;</code>
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp clearDBMPIJBHAGI() {
      bitField0_ &= ~0x00000008;
      dBMPIJBHAGI = false;
      return this;
    }

    /**
     * <code>optional bool DBMPIJBHAGI = 3;</code>
     * @return the dBMPIJBHAGI
     */
    public boolean getDBMPIJBHAGI() {
      return dBMPIJBHAGI;
    }

    /**
     * <code>optional bool DBMPIJBHAGI = 3;</code>
     * @param value the dBMPIJBHAGI to set
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp setDBMPIJBHAGI(final boolean value) {
      bitField0_ |= 0x00000008;
      dBMPIJBHAGI = value;
      return this;
    }

    /**
     * <code>optional bool NHHDDFFBGNE = 4;</code>
     * @return whether the nHHDDFFBGNE field is set
     */
    public boolean hasNHHDDFFBGNE() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional bool NHHDDFFBGNE = 4;</code>
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp clearNHHDDFFBGNE() {
      bitField0_ &= ~0x00000010;
      nHHDDFFBGNE = false;
      return this;
    }

    /**
     * <code>optional bool NHHDDFFBGNE = 4;</code>
     * @return the nHHDDFFBGNE
     */
    public boolean getNHHDDFFBGNE() {
      return nHHDDFFBGNE;
    }

    /**
     * <code>optional bool NHHDDFFBGNE = 4;</code>
     * @param value the nHHDDFFBGNE to set
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp setNHHDDFFBGNE(final boolean value) {
      bitField0_ |= 0x00000010;
      nHHDDFFBGNE = value;
      return this;
    }

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</code>
     * @return whether the basicTypeInfoList field is set
     */
    public boolean hasBasicTypeInfoList() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</code>
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp clearBasicTypeInfoList() {
      bitField0_ &= ~0x00000020;
      basicTypeInfoList.clear();
      return this;
    }

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</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 #getMutableBasicTypeInfoList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<HeroBasicTypeInfoOuterClass.HeroBasicTypeInfo> getBasicTypeInfoList() {
      return basicTypeInfoList;
    }

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</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 RepeatedMessage<HeroBasicTypeInfoOuterClass.HeroBasicTypeInfo> getMutableBasicTypeInfoList(
        ) {
      bitField0_ |= 0x00000020;
      return basicTypeInfoList;
    }

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</code>
     * @param value the basicTypeInfoList to add
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp addBasicTypeInfoList(
        final HeroBasicTypeInfoOuterClass.HeroBasicTypeInfo value) {
      bitField0_ |= 0x00000020;
      basicTypeInfoList.add(value);
      return this;
    }

    /**
     * <code>repeated .HeroBasicTypeInfo basic_type_info_list = 7;</code>
     * @param values the basicTypeInfoList to add
     * @return this
     */
    public GetHeroBasicTypeInfoScRsp addAllBasicTypeInfoList(
        final HeroBasicTypeInfoOuterClass.HeroBasicTypeInfo... values) {
      bitField0_ |= 0x00000020;
      basicTypeInfoList.addAll(values);
      return this;
    }

    @Override
    public GetHeroBasicTypeInfoScRsp copyFrom(final GetHeroBasicTypeInfoScRsp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        retcode = other.retcode;
        gender = other.gender;
        curBasicType = other.curBasicType;
        dBMPIJBHAGI = other.dBMPIJBHAGI;
        nHHDDFFBGNE = other.nHHDDFFBGNE;
        basicTypeInfoList.copyFrom(other.basicTypeInfoList);
      }
      return this;
    }

    @Override
    public GetHeroBasicTypeInfoScRsp mergeFrom(final GetHeroBasicTypeInfoScRsp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRetcode()) {
        setRetcode(other.retcode);
      }
      if (other.hasGender()) {
        setGenderValue(other.gender);
      }
      if (other.hasCurBasicType()) {
        setCurBasicTypeValue(other.curBasicType);
      }
      if (other.hasDBMPIJBHAGI()) {
        setDBMPIJBHAGI(other.dBMPIJBHAGI);
      }
      if (other.hasNHHDDFFBGNE()) {
        setNHHDDFFBGNE(other.nHHDDFFBGNE);
      }
      if (other.hasBasicTypeInfoList()) {
        getMutableBasicTypeInfoList().addAll(other.basicTypeInfoList);
      }
      return this;
    }

    @Override
    public GetHeroBasicTypeInfoScRsp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      retcode = 0;
      gender = 0;
      curBasicType = 0;
      dBMPIJBHAGI = false;
      nHHDDFFBGNE = false;
      basicTypeInfoList.clear();
      return this;
    }

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

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof GetHeroBasicTypeInfoScRsp)) {
        return false;
      }
      GetHeroBasicTypeInfoScRsp other = (GetHeroBasicTypeInfoScRsp) o;
      return bitField0_ == other.bitField0_
        && (!hasRetcode() || retcode == other.retcode)
        && (!hasGender() || gender == other.gender)
        && (!hasCurBasicType() || curBasicType == other.curBasicType)
        && (!hasDBMPIJBHAGI() || dBMPIJBHAGI == other.dBMPIJBHAGI)
        && (!hasNHHDDFFBGNE() || nHHDDFFBGNE == other.nHHDDFFBGNE)
        && (!hasBasicTypeInfoList() || basicTypeInfoList.equals(other.basicTypeInfoList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeEnumNoTag(gender);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 88);
        output.writeEnumNoTag(curBasicType);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 24);
        output.writeBoolNoTag(dBMPIJBHAGI);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 32);
        output.writeBoolNoTag(nHHDDFFBGNE);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        for (int i = 0; i < basicTypeInfoList.length(); i++) {
          output.writeRawByte((byte) 58);
          output.writeMessageNoTag(basicTypeInfoList.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(gender);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(curBasicType);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += (1 * basicTypeInfoList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(basicTypeInfoList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public GetHeroBasicTypeInfoScRsp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 112: {
            // retcode
            retcode = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // gender
            final int value = input.readInt32();
            if (GenderOuterClass.Gender.forNumber(value) != null) {
              gender = value;
              bitField0_ |= 0x00000002;
            }
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // curBasicType
            final int value = input.readInt32();
            if (HeroBasicTypeOuterClass.HeroBasicType.forNumber(value) != null) {
              curBasicType = value;
              bitField0_ |= 0x00000004;
            }
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // dBMPIJBHAGI
            dBMPIJBHAGI = input.readBool();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // nHHDDFFBGNE
            nHHDDFFBGNE = input.readBool();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 58) {
              break;
            }
          }
          case 58: {
            // basicTypeInfoList
            tag = input.readRepeatedMessage(basicTypeInfoList, tag);
            bitField0_ |= 0x00000020;
            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.retcode, retcode);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeEnum(FieldNames.gender, gender, GenderOuterClass.Gender.converter());
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeEnum(FieldNames.curBasicType, curBasicType, HeroBasicTypeOuterClass.HeroBasicType.converter());
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBool(FieldNames.dBMPIJBHAGI, dBMPIJBHAGI);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBool(FieldNames.nHHDDFFBGNE, nHHDDFFBGNE);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRepeatedMessage(FieldNames.basicTypeInfoList, basicTypeInfoList);
      }
      output.endObject();
    }

    @Override
    public GetHeroBasicTypeInfoScRsp 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 -1249512767: {
            if (input.isAtField(FieldNames.gender)) {
              if (!input.trySkipNullValue()) {
                final GenderOuterClass.Gender value = input.readEnum(GenderOuterClass.Gender.converter());
                if (value != null) {
                  gender = value.getNumber();
                  bitField0_ |= 0x00000002;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -518506968:
          case -979186678: {
            if (input.isAtField(FieldNames.curBasicType)) {
              if (!input.trySkipNullValue()) {
                final HeroBasicTypeOuterClass.HeroBasicType value = input.readEnum(HeroBasicTypeOuterClass.HeroBasicType.converter());
                if (value != null) {
                  curBasicType = value.getNumber();
                  bitField0_ |= 0x00000004;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 777214107: {
            if (input.isAtField(FieldNames.dBMPIJBHAGI)) {
              if (!input.trySkipNullValue()) {
                dBMPIJBHAGI = input.readBool();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -436607542: {
            if (input.isAtField(FieldNames.nHHDDFFBGNE)) {
              if (!input.trySkipNullValue()) {
                nHHDDFFBGNE = input.readBool();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -344592620:
          case -1315699973: {
            if (input.isAtField(FieldNames.basicTypeInfoList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(basicTypeInfoList);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum GetHeroBasicTypeInfoScRspFactory implements MessageFactory<GetHeroBasicTypeInfoScRsp> {
      INSTANCE;

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

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

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

      static final FieldName curBasicType = FieldName.forField("curBasicType", "cur_basic_type");

      static final FieldName dBMPIJBHAGI = FieldName.forField("DBMPIJBHAGI");

      static final FieldName nHHDDFFBGNE = FieldName.forField("NHHDDFFBGNE");

      static final FieldName basicTypeInfoList = FieldName.forField("basicTypeInfoList", "basic_type_info_list");
    }
  }
}
