// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package code.obp.grpc.api

@SerialVersionUID(0L)
final case class BasicAccountJSONGrpc(
    id: _root_.scala.Predef.String = "",
    label: _root_.scala.Predef.String = "",
    bankId: _root_.scala.Predef.String = "",
    viewsAvailable: _root_.scala.collection.Seq[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson] = _root_.scala.collection.Seq.empty
    ) extends scalapb.GeneratedMessage with scalapb.Message[BasicAccountJSONGrpc] with scalapb.lenses.Updatable[BasicAccountJSONGrpc] {
    @transient
    private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
    private[this] def __computeSerializedValue(): _root_.scala.Int = {
      var __size = 0
      if (id != "") { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, id) }
      if (label != "") { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, label) }
      if (bankId != "") { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, bankId) }
      viewsAvailable.foreach(viewsAvailable => __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(viewsAvailable.serializedSize) + viewsAvailable.serializedSize)
      __size
    }
    final override def serializedSize: _root_.scala.Int = {
      var read = __serializedSizeCachedValue
      if (read == 0) {
        read = __computeSerializedValue()
        __serializedSizeCachedValue = read
      }
      read
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      {
        val __v = id
        if (__v != "") {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = label
        if (__v != "") {
          _output__.writeString(2, __v)
        }
      };
      {
        val __v = bankId
        if (__v != "") {
          _output__.writeString(3, __v)
        }
      };
      viewsAvailable.foreach { __v =>
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__v.serializedSize)
        __v.writeTo(_output__)
      };
    }
    def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): code.obp.grpc.api.BasicAccountJSONGrpc = {
      var __id = this.id
      var __label = this.label
      var __bankId = this.bankId
      val __viewsAvailable = (_root_.scala.collection.immutable.Vector.newBuilder[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson] ++= this.viewsAvailable)
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 10 =>
            __id = _input__.readString()
          case 18 =>
            __label = _input__.readString()
          case 26 =>
            __bankId = _input__.readString()
          case 34 =>
            __viewsAvailable += _root_.scalapb.LiteParser.readMessage(_input__, code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson.defaultInstance)
          case tag => _input__.skipField(tag)
        }
      }
      code.obp.grpc.api.BasicAccountJSONGrpc(
          id = __id,
          label = __label,
          bankId = __bankId,
          viewsAvailable = __viewsAvailable.result()
      )
    }
    def withId(__v: _root_.scala.Predef.String): BasicAccountJSONGrpc = copy(id = __v)
    def withLabel(__v: _root_.scala.Predef.String): BasicAccountJSONGrpc = copy(label = __v)
    def withBankId(__v: _root_.scala.Predef.String): BasicAccountJSONGrpc = copy(bankId = __v)
    def clearViewsAvailable = copy(viewsAvailable = _root_.scala.collection.Seq.empty)
    def addViewsAvailable(__vs: code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson*): BasicAccountJSONGrpc = addAllViewsAvailable(__vs)
    def addAllViewsAvailable(__vs: TraversableOnce[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson]): BasicAccountJSONGrpc = copy(viewsAvailable = viewsAvailable ++ __vs)
    def withViewsAvailable(__v: _root_.scala.collection.Seq[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson]): BasicAccountJSONGrpc = copy(viewsAvailable = __v)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => {
          val __t = id
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = label
          if (__t != "") __t else null
        }
        case 3 => {
          val __t = bankId
          if (__t != "") __t else null
        }
        case 4 => viewsAvailable
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PString(id)
        case 2 => _root_.scalapb.descriptors.PString(label)
        case 3 => _root_.scalapb.descriptors.PString(bankId)
        case 4 => _root_.scalapb.descriptors.PRepeated(viewsAvailable.map(_.toPMessage)(_root_.scala.collection.breakOut))
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion = code.obp.grpc.api.BasicAccountJSONGrpc
}

object BasicAccountJSONGrpc extends scalapb.GeneratedMessageCompanion[code.obp.grpc.api.BasicAccountJSONGrpc] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[code.obp.grpc.api.BasicAccountJSONGrpc] = this
  def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): code.obp.grpc.api.BasicAccountJSONGrpc = {
    require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
    val __fields = javaDescriptor.getFields
    code.obp.grpc.api.BasicAccountJSONGrpc(
      __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[_root_.scala.Predef.String],
      __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[_root_.scala.Predef.String],
      __fieldsMap.getOrElse(__fields.get(2), "").asInstanceOf[_root_.scala.Predef.String],
      __fieldsMap.getOrElse(__fields.get(3), Nil).asInstanceOf[_root_.scala.collection.Seq[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson]]
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[code.obp.grpc.api.BasicAccountJSONGrpc] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.")
      code.obp.grpc.api.BasicAccountJSONGrpc(
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.collection.Seq[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson]]).getOrElse(_root_.scala.collection.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ApiProto.javaDescriptor.getMessageTypes.get(6)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ApiProto.scalaDescriptor.messages(6)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 4 => __out = code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_]] = Seq[_root_.scalapb.GeneratedMessageCompanion[_]](
    _root_.code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson
  )
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = code.obp.grpc.api.BasicAccountJSONGrpc(
  )
  @SerialVersionUID(0L)
  final case class BasicViewJson(
      id: _root_.scala.Predef.String = "",
      shortName: _root_.scala.Predef.String = "",
      isPublic: _root_.scala.Boolean = false
      ) extends scalapb.GeneratedMessage with scalapb.Message[BasicViewJson] with scalapb.lenses.Updatable[BasicViewJson] {
      @transient
      private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
      private[this] def __computeSerializedValue(): _root_.scala.Int = {
        var __size = 0
        if (id != "") { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, id) }
        if (shortName != "") { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, shortName) }
        if (isPublic != false) { __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(3, isPublic) }
        __size
      }
      final override def serializedSize: _root_.scala.Int = {
        var read = __serializedSizeCachedValue
        if (read == 0) {
          read = __computeSerializedValue()
          __serializedSizeCachedValue = read
        }
        read
      }
      def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
        {
          val __v = id
          if (__v != "") {
            _output__.writeString(1, __v)
          }
        };
        {
          val __v = shortName
          if (__v != "") {
            _output__.writeString(2, __v)
          }
        };
        {
          val __v = isPublic
          if (__v != false) {
            _output__.writeBool(3, __v)
          }
        };
      }
      def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson = {
        var __id = this.id
        var __shortName = this.shortName
        var __isPublic = this.isPublic
        var _done__ = false
        while (!_done__) {
          val _tag__ = _input__.readTag()
          _tag__ match {
            case 0 => _done__ = true
            case 10 =>
              __id = _input__.readString()
            case 18 =>
              __shortName = _input__.readString()
            case 24 =>
              __isPublic = _input__.readBool()
            case tag => _input__.skipField(tag)
          }
        }
        code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson(
            id = __id,
            shortName = __shortName,
            isPublic = __isPublic
        )
      }
      def withId(__v: _root_.scala.Predef.String): BasicViewJson = copy(id = __v)
      def withShortName(__v: _root_.scala.Predef.String): BasicViewJson = copy(shortName = __v)
      def withIsPublic(__v: _root_.scala.Boolean): BasicViewJson = copy(isPublic = __v)
      def getFieldByNumber(__fieldNumber: _root_.scala.Int): scala.Any = {
        (__fieldNumber: @_root_.scala.unchecked) match {
          case 1 => {
            val __t = id
            if (__t != "") __t else null
          }
          case 2 => {
            val __t = shortName
            if (__t != "") __t else null
          }
          case 3 => {
            val __t = isPublic
            if (__t != false) __t else null
          }
        }
      }
      def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
        require(__field.containingMessage eq companion.scalaDescriptor)
        (__field.number: @_root_.scala.unchecked) match {
          case 1 => _root_.scalapb.descriptors.PString(id)
          case 2 => _root_.scalapb.descriptors.PString(shortName)
          case 3 => _root_.scalapb.descriptors.PBoolean(isPublic)
        }
      }
      def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
      def companion = code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson
  }
  
  object BasicViewJson extends scalapb.GeneratedMessageCompanion[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson] {
    implicit def messageCompanion: scalapb.GeneratedMessageCompanion[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson] = this
    def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson = {
      require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.")
      val __fields = javaDescriptor.getFields
      code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson(
        __fieldsMap.getOrElse(__fields.get(0), "").asInstanceOf[_root_.scala.Predef.String],
        __fieldsMap.getOrElse(__fields.get(1), "").asInstanceOf[_root_.scala.Predef.String],
        __fieldsMap.getOrElse(__fields.get(2), false).asInstanceOf[_root_.scala.Boolean]
      )
    }
    implicit def messageReads: _root_.scalapb.descriptors.Reads[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson] = _root_.scalapb.descriptors.Reads{
      case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
        require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.")
        code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson(
          __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
          __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
          __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Boolean]).getOrElse(false)
        )
      case _ => throw new RuntimeException("Expected PMessage")
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = code.obp.grpc.api.BasicAccountJSONGrpc.javaDescriptor.getNestedTypes.get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = code.obp.grpc.api.BasicAccountJSONGrpc.scalaDescriptor.nestedMessages(0)
    def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
    lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_]] = Seq.empty
    def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
    lazy val defaultInstance = code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson(
    )
    implicit class BasicViewJsonLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson](_l) {
      def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_))
      def shortName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.shortName)((c_, f_) => c_.copy(shortName = f_))
      def isPublic: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.isPublic)((c_, f_) => c_.copy(isPublic = f_))
    }
    final val ID_FIELD_NUMBER = 1
    final val SHORT_NAME_FIELD_NUMBER = 2
    final val IS_PUBLIC_FIELD_NUMBER = 3
  }
  
  implicit class BasicAccountJSONGrpcLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, code.obp.grpc.api.BasicAccountJSONGrpc]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, code.obp.grpc.api.BasicAccountJSONGrpc](_l) {
    def id: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.id)((c_, f_) => c_.copy(id = f_))
    def label: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.label)((c_, f_) => c_.copy(label = f_))
    def bankId: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.bankId)((c_, f_) => c_.copy(bankId = f_))
    def viewsAvailable: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.collection.Seq[code.obp.grpc.api.BasicAccountJSONGrpc.BasicViewJson]] = field(_.viewsAvailable)((c_, f_) => c_.copy(viewsAvailable = f_))
  }
  final val ID_FIELD_NUMBER = 1
  final val LABEL_FIELD_NUMBER = 2
  final val BANK_ID_FIELD_NUMBER = 3
  final val VIEWS_AVAILABLE_FIELD_NUMBER = 4
}
