org.plasmalabs.sdk.models.box.Challenge.scala Maven / Gradle / Ivy
The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package org.plasmalabs.sdk.models.box
/** Challenge is a single field message with its options being
* one of RevealedProposition or PreviousProposition
*/
@SerialVersionUID(0L)
final case class Challenge(
proposition: org.plasmalabs.sdk.models.box.Challenge.Proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Empty,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Challenge] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (proposition.revealed.isDefined) {
val __value = proposition.revealed.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (proposition.previous.isDefined) {
val __value = proposition.previous.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
__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 = {
proposition.revealed.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
proposition.previous.foreach { __v =>
val __m = __v
_output__.writeTag(2, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def getRevealed: quivr.models.Proposition = proposition.revealed.getOrElse(quivr.models.Proposition.defaultInstance)
def withRevealed(__v: quivr.models.Proposition): Challenge = copy(proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Revealed(__v))
def getPrevious: org.plasmalabs.sdk.models.box.Challenge.PreviousProposition = proposition.previous.getOrElse(org.plasmalabs.sdk.models.box.Challenge.PreviousProposition.defaultInstance)
def withPrevious(__v: org.plasmalabs.sdk.models.box.Challenge.PreviousProposition): Challenge = copy(proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Previous(__v))
def clearProposition: Challenge = copy(proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Empty)
def withProposition(__v: org.plasmalabs.sdk.models.box.Challenge.Proposition): Challenge = copy(proposition = __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 => proposition.revealed.orNull
case 2 => proposition.previous.orNull
}
}
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 => proposition.revealed.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => proposition.previous.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: org.plasmalabs.sdk.models.box.Challenge.type = org.plasmalabs.sdk.models.box.Challenge
_root_.scalapb.validate.Validator.assertValid(this)(org.plasmalabs.sdk.models.box.ChallengeValidator)
// @@protoc_insertion_point(GeneratedMessage[org.plasmalabs.sdk.models.box.Challenge])
}
object Challenge extends scalapb.GeneratedMessageCompanion[org.plasmalabs.sdk.models.box.Challenge] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[org.plasmalabs.sdk.models.box.Challenge] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): org.plasmalabs.sdk.models.box.Challenge = {
var __proposition: org.plasmalabs.sdk.models.box.Challenge.Proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.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 =>
__proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Revealed(__proposition.revealed.fold(_root_.scalapb.LiteParser.readMessage[quivr.models.Proposition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 18 =>
__proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Previous(__proposition.previous.fold(_root_.scalapb.LiteParser.readMessage[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
org.plasmalabs.sdk.models.box.Challenge(
proposition = __proposition,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[org.plasmalabs.sdk.models.box.Challenge] = _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.")
org.plasmalabs.sdk.models.box.Challenge(
proposition = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[quivr.models.Proposition]]).map(org.plasmalabs.sdk.models.box.Challenge.Proposition.Revealed(_))
.orElse[org.plasmalabs.sdk.models.box.Challenge.Proposition](__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition]]).map(org.plasmalabs.sdk.models.box.Challenge.Proposition.Previous(_)))
.getOrElse(org.plasmalabs.sdk.models.box.Challenge.Proposition.Empty)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ChallengeProto.javaDescriptor.getMessageTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ChallengeProto.scalaDescriptor.messages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = quivr.models.Proposition
case 2 => __out = org.plasmalabs.sdk.models.box.Challenge.PreviousProposition
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
_root_.org.plasmalabs.sdk.models.box.Challenge.PreviousProposition
)
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = org.plasmalabs.sdk.models.box.Challenge(
proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Empty
)
sealed trait Proposition extends _root_.scalapb.GeneratedOneof {
def isEmpty: _root_.scala.Boolean = false
def isDefined: _root_.scala.Boolean = true
def isRevealed: _root_.scala.Boolean = false
def isPrevious: _root_.scala.Boolean = false
def revealed: _root_.scala.Option[quivr.models.Proposition] = _root_.scala.None
def previous: _root_.scala.Option[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition] = _root_.scala.None
}
object Proposition {
@SerialVersionUID(0L)
case object Empty extends org.plasmalabs.sdk.models.box.Challenge.Proposition {
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 Revealed(value: quivr.models.Proposition) extends org.plasmalabs.sdk.models.box.Challenge.Proposition {
type ValueType = quivr.models.Proposition
override def isRevealed: _root_.scala.Boolean = true
override def revealed: _root_.scala.Option[quivr.models.Proposition] = Some(value)
override def number: _root_.scala.Int = 1
}
@SerialVersionUID(0L)
final case class Previous(value: org.plasmalabs.sdk.models.box.Challenge.PreviousProposition) extends org.plasmalabs.sdk.models.box.Challenge.Proposition {
type ValueType = org.plasmalabs.sdk.models.box.Challenge.PreviousProposition
override def isPrevious: _root_.scala.Boolean = true
override def previous: _root_.scala.Option[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition] = Some(value)
override def number: _root_.scala.Int = 2
}
}
/** Previousroposition requires two parameters
* the transaction input address and index of the previously
* revealed proposition.
*/
@SerialVersionUID(0L)
final case class PreviousProposition(
address: _root_.scala.Option[org.plasmalabs.sdk.models.TransactionInputAddress] = _root_.scala.None,
index: _root_.scala.Int = 0,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[PreviousProposition] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (address.isDefined) {
val __value = address.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
{
val __value = index
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(2, __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 = {
address.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = index
if (__v != 0) {
_output__.writeUInt32(2, __v)
}
};
unknownFields.writeTo(_output__)
}
def getAddress: org.plasmalabs.sdk.models.TransactionInputAddress = address.getOrElse(org.plasmalabs.sdk.models.TransactionInputAddress.defaultInstance)
def clearAddress: PreviousProposition = copy(address = _root_.scala.None)
def withAddress(__v: org.plasmalabs.sdk.models.TransactionInputAddress): PreviousProposition = copy(address = Option(__v))
def withIndex(__v: _root_.scala.Int): PreviousProposition = copy(index = __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 => address.orNull
case 2 => {
val __t = index
if (__t != 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 => address.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 2 => _root_.scalapb.descriptors.PInt(index)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: org.plasmalabs.sdk.models.box.Challenge.PreviousProposition.type = org.plasmalabs.sdk.models.box.Challenge.PreviousProposition
// @@protoc_insertion_point(GeneratedMessage[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition])
}
object PreviousProposition extends scalapb.GeneratedMessageCompanion[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): org.plasmalabs.sdk.models.box.Challenge.PreviousProposition = {
var __address: _root_.scala.Option[org.plasmalabs.sdk.models.TransactionInputAddress] = _root_.scala.None
var __index: _root_.scala.Int = 0
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__address = _root_.scala.Option(__address.fold(_root_.scalapb.LiteParser.readMessage[org.plasmalabs.sdk.models.TransactionInputAddress](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 16 =>
__index = _input__.readUInt32()
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
org.plasmalabs.sdk.models.box.Challenge.PreviousProposition(
address = __address,
index = __index,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition] = _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.")
org.plasmalabs.sdk.models.box.Challenge.PreviousProposition(
address = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[org.plasmalabs.sdk.models.TransactionInputAddress]]),
index = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Int]).getOrElse(0)
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = org.plasmalabs.sdk.models.box.Challenge.javaDescriptor.getNestedTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = org.plasmalabs.sdk.models.box.Challenge.scalaDescriptor.nestedMessages(0)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 1 => __out = org.plasmalabs.sdk.models.TransactionInputAddress
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = org.plasmalabs.sdk.models.box.Challenge.PreviousProposition(
address = _root_.scala.None,
index = 0
)
implicit class PreviousPropositionLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, org.plasmalabs.sdk.models.box.Challenge.PreviousProposition]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, org.plasmalabs.sdk.models.box.Challenge.PreviousProposition](_l) {
def address: _root_.scalapb.lenses.Lens[UpperPB, org.plasmalabs.sdk.models.TransactionInputAddress] = field(_.getAddress)((c_, f_) => c_.copy(address = _root_.scala.Option(f_)))
def optionalAddress: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[org.plasmalabs.sdk.models.TransactionInputAddress]] = field(_.address)((c_, f_) => c_.copy(address = f_))
def index: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.index)((c_, f_) => c_.copy(index = f_))
}
final val ADDRESS_FIELD_NUMBER = 1
final val INDEX_FIELD_NUMBER = 2
def of(
address: _root_.scala.Option[org.plasmalabs.sdk.models.TransactionInputAddress],
index: _root_.scala.Int
): _root_.org.plasmalabs.sdk.models.box.Challenge.PreviousProposition = _root_.org.plasmalabs.sdk.models.box.Challenge.PreviousProposition(
address,
index
)
// @@protoc_insertion_point(GeneratedMessageCompanion[org.plasmalabs.sdk.models.box.Challenge.PreviousProposition])
}
implicit class ChallengeLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, org.plasmalabs.sdk.models.box.Challenge]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, org.plasmalabs.sdk.models.box.Challenge](_l) {
def revealed: _root_.scalapb.lenses.Lens[UpperPB, quivr.models.Proposition] = field(_.getRevealed)((c_, f_) => c_.copy(proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Revealed(f_)))
def previous: _root_.scalapb.lenses.Lens[UpperPB, org.plasmalabs.sdk.models.box.Challenge.PreviousProposition] = field(_.getPrevious)((c_, f_) => c_.copy(proposition = org.plasmalabs.sdk.models.box.Challenge.Proposition.Previous(f_)))
def proposition: _root_.scalapb.lenses.Lens[UpperPB, org.plasmalabs.sdk.models.box.Challenge.Proposition] = field(_.proposition)((c_, f_) => c_.copy(proposition = f_))
}
final val REVEALED_FIELD_NUMBER = 1
final val PREVIOUS_FIELD_NUMBER = 2
def of(
proposition: org.plasmalabs.sdk.models.box.Challenge.Proposition
): _root_.org.plasmalabs.sdk.models.box.Challenge = _root_.org.plasmalabs.sdk.models.box.Challenge(
proposition
)
implicit def validator: scalapb.validate.Validator[org.plasmalabs.sdk.models.box.Challenge] = org.plasmalabs.sdk.models.box.ChallengeValidator
// @@protoc_insertion_point(GeneratedMessageCompanion[org.plasmalabs.sdk.models.box.Challenge])
}