All Downloads are FREE. Search and download functionalities are using the official Maven repository.

invoicesrpc.LookupInvoiceMsg.scala Maven / Gradle / Ivy

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

package invoicesrpc

@SerialVersionUID(0L)
final case class LookupInvoiceMsg(
    invoiceRef: invoicesrpc.LookupInvoiceMsg.InvoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.Empty,
    lookupModifier: invoicesrpc.LookupModifier = invoicesrpc.LookupModifier.DEFAULT,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[LookupInvoiceMsg] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (invoiceRef.paymentHash.isDefined) {
        val __value = invoiceRef.paymentHash.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(1, __value)
      };
      if (invoiceRef.paymentAddr.isDefined) {
        val __value = invoiceRef.paymentAddr.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(2, __value)
      };
      if (invoiceRef.setId.isDefined) {
        val __value = invoiceRef.setId.get
        __size += _root_.com.google.protobuf.CodedOutputStream.computeBytesSize(3, __value)
      };
      
      {
        val __value = lookupModifier.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(4, __value)
        }
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      invoiceRef.paymentHash.foreach { __v =>
        val __m = __v
        _output__.writeBytes(1, __m)
      };
      invoiceRef.paymentAddr.foreach { __v =>
        val __m = __v
        _output__.writeBytes(2, __m)
      };
      invoiceRef.setId.foreach { __v =>
        val __m = __v
        _output__.writeBytes(3, __m)
      };
      {
        val __v = lookupModifier.value
        if (__v != 0) {
          _output__.writeEnum(4, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def getPaymentHash: _root_.com.google.protobuf.ByteString = invoiceRef.paymentHash.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
    def withPaymentHash(__v: _root_.com.google.protobuf.ByteString): LookupInvoiceMsg = copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentHash(__v))
    def getPaymentAddr: _root_.com.google.protobuf.ByteString = invoiceRef.paymentAddr.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
    def withPaymentAddr(__v: _root_.com.google.protobuf.ByteString): LookupInvoiceMsg = copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentAddr(__v))
    def getSetId: _root_.com.google.protobuf.ByteString = invoiceRef.setId.getOrElse(_root_.com.google.protobuf.ByteString.EMPTY)
    def withSetId(__v: _root_.com.google.protobuf.ByteString): LookupInvoiceMsg = copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.SetId(__v))
    def withLookupModifier(__v: invoicesrpc.LookupModifier): LookupInvoiceMsg = copy(lookupModifier = __v)
    def clearInvoiceRef: LookupInvoiceMsg = copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.Empty)
    def withInvoiceRef(__v: invoicesrpc.LookupInvoiceMsg.InvoiceRef): LookupInvoiceMsg = copy(invoiceRef = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => invoiceRef.paymentHash.orNull
        case 2 => invoiceRef.paymentAddr.orNull
        case 3 => invoiceRef.setId.orNull
        case 4 => {
          val __t = lookupModifier.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => invoiceRef.paymentHash.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => invoiceRef.paymentAddr.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => invoiceRef.setId.map(_root_.scalapb.descriptors.PByteString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => _root_.scalapb.descriptors.PEnum(lookupModifier.scalaValueDescriptor)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: invoicesrpc.LookupInvoiceMsg.type = invoicesrpc.LookupInvoiceMsg
    // @@protoc_insertion_point(GeneratedMessage[invoicesrpc.LookupInvoiceMsg])
}

object LookupInvoiceMsg extends scalapb.GeneratedMessageCompanion[invoicesrpc.LookupInvoiceMsg] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[invoicesrpc.LookupInvoiceMsg] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): invoicesrpc.LookupInvoiceMsg = {
    var __lookupModifier: invoicesrpc.LookupModifier = invoicesrpc.LookupModifier.DEFAULT
    var __invoiceRef: invoicesrpc.LookupInvoiceMsg.InvoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.Empty
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentHash(_input__.readBytes())
        case 18 =>
          __invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentAddr(_input__.readBytes())
        case 26 =>
          __invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.SetId(_input__.readBytes())
        case 32 =>
          __lookupModifier = invoicesrpc.LookupModifier.fromValue(_input__.readEnum())
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    invoicesrpc.LookupInvoiceMsg(
        lookupModifier = __lookupModifier,
        invoiceRef = __invoiceRef,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[invoicesrpc.LookupInvoiceMsg] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      invoicesrpc.LookupInvoiceMsg(
        lookupModifier = invoicesrpc.LookupModifier.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(invoicesrpc.LookupModifier.DEFAULT.scalaValueDescriptor).number),
        invoiceRef = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentHash(_))
            .orElse[invoicesrpc.LookupInvoiceMsg.InvoiceRef](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentAddr(_)))
            .orElse[invoicesrpc.LookupInvoiceMsg.InvoiceRef](__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[_root_.com.google.protobuf.ByteString]]).map(invoicesrpc.LookupInvoiceMsg.InvoiceRef.SetId(_)))
            .getOrElse(invoicesrpc.LookupInvoiceMsg.InvoiceRef.Empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = InvoicesProto.javaDescriptor.getMessageTypes().get(7)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = InvoicesProto.scalaDescriptor.messages(7)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = {
    (__fieldNumber: @_root_.scala.unchecked) match {
      case 4 => invoicesrpc.LookupModifier
    }
  }
  lazy val defaultInstance = invoicesrpc.LookupInvoiceMsg(
    lookupModifier = invoicesrpc.LookupModifier.DEFAULT,
    invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.Empty
  )
  sealed trait InvoiceRef extends _root_.scalapb.GeneratedOneof {
    def isEmpty: _root_.scala.Boolean = false
    def isDefined: _root_.scala.Boolean = true
    def isPaymentHash: _root_.scala.Boolean = false
    def isPaymentAddr: _root_.scala.Boolean = false
    def isSetId: _root_.scala.Boolean = false
    def paymentHash: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None
    def paymentAddr: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None
    def setId: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = _root_.scala.None
  }
  object InvoiceRef {
    @SerialVersionUID(0L)
    case object Empty extends invoicesrpc.LookupInvoiceMsg.InvoiceRef {
      type ValueType = _root_.scala.Nothing
      override def isEmpty: _root_.scala.Boolean = true
      override def isDefined: _root_.scala.Boolean = false
      override def number: _root_.scala.Int = 0
      override def value: _root_.scala.Nothing = throw new java.util.NoSuchElementException("Empty.value")
    }
  
    @SerialVersionUID(0L)
    final case class PaymentHash(value: _root_.com.google.protobuf.ByteString) extends invoicesrpc.LookupInvoiceMsg.InvoiceRef {
      type ValueType = _root_.com.google.protobuf.ByteString
      override def isPaymentHash: _root_.scala.Boolean = true
      override def paymentHash: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value)
      override def number: _root_.scala.Int = 1
    }
    @SerialVersionUID(0L)
    final case class PaymentAddr(value: _root_.com.google.protobuf.ByteString) extends invoicesrpc.LookupInvoiceMsg.InvoiceRef {
      type ValueType = _root_.com.google.protobuf.ByteString
      override def isPaymentAddr: _root_.scala.Boolean = true
      override def paymentAddr: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value)
      override def number: _root_.scala.Int = 2
    }
    @SerialVersionUID(0L)
    final case class SetId(value: _root_.com.google.protobuf.ByteString) extends invoicesrpc.LookupInvoiceMsg.InvoiceRef {
      type ValueType = _root_.com.google.protobuf.ByteString
      override def isSetId: _root_.scala.Boolean = true
      override def setId: _root_.scala.Option[_root_.com.google.protobuf.ByteString] = Some(value)
      override def number: _root_.scala.Int = 3
    }
  }
  implicit class LookupInvoiceMsgLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, invoicesrpc.LookupInvoiceMsg]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, invoicesrpc.LookupInvoiceMsg](_l) {
    def paymentHash: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getPaymentHash)((c_, f_) => c_.copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentHash(f_)))
    def paymentAddr: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getPaymentAddr)((c_, f_) => c_.copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.PaymentAddr(f_)))
    def setId: _root_.scalapb.lenses.Lens[UpperPB, _root_.com.google.protobuf.ByteString] = field(_.getSetId)((c_, f_) => c_.copy(invoiceRef = invoicesrpc.LookupInvoiceMsg.InvoiceRef.SetId(f_)))
    def lookupModifier: _root_.scalapb.lenses.Lens[UpperPB, invoicesrpc.LookupModifier] = field(_.lookupModifier)((c_, f_) => c_.copy(lookupModifier = f_))
    def invoiceRef: _root_.scalapb.lenses.Lens[UpperPB, invoicesrpc.LookupInvoiceMsg.InvoiceRef] = field(_.invoiceRef)((c_, f_) => c_.copy(invoiceRef = f_))
  }
  final val PAYMENT_HASH_FIELD_NUMBER = 1
  final val PAYMENT_ADDR_FIELD_NUMBER = 2
  final val SET_ID_FIELD_NUMBER = 3
  final val LOOKUP_MODIFIER_FIELD_NUMBER = 4
  def of(
    invoiceRef: invoicesrpc.LookupInvoiceMsg.InvoiceRef,
    lookupModifier: invoicesrpc.LookupModifier
  ): _root_.invoicesrpc.LookupInvoiceMsg = _root_.invoicesrpc.LookupInvoiceMsg(
    invoiceRef,
    lookupModifier
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[invoicesrpc.LookupInvoiceMsg])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy