/// /// EventPropertiesOutput.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © Marc Rousavy @ Margelo /// package com.margelo.nitro.rive import com.facebook.proguard.annotations.DoNotStrip /** * Represents the TypeScript variant "Boolean | String | Double". */ @Suppress("ClassName") @DoNotStrip sealed class EventPropertiesOutput { @DoNotStrip data class First(@DoNotStrip val value: Boolean): EventPropertiesOutput() @DoNotStrip data class Second(@DoNotStrip val value: String): EventPropertiesOutput() @DoNotStrip data class Third(@DoNotStrip val value: Double): EventPropertiesOutput() val isFirst: Boolean get() = this is First val isSecond: Boolean get() = this is Second val isThird: Boolean get() = this is Third fun asFirstOrNull(): Boolean? { val value = (this as? First)?.value ?: return null return value } fun asSecondOrNull(): String? { val value = (this as? Second)?.value ?: return null return value } fun asThirdOrNull(): Double? { val value = (this as? Third)?.value ?: return null return value } inline fun match(first: (Boolean) -> R, second: (String) -> R, third: (Double) -> R): R { return when (this) { is First -> first(value) is Second -> second(value) is Third -> third(value) } } companion object { @JvmStatic @DoNotStrip fun create(value: Boolean): EventPropertiesOutput = First(value) @JvmStatic @DoNotStrip fun create(value: String): EventPropertiesOutput = Second(value) @JvmStatic @DoNotStrip fun create(value: Double): EventPropertiesOutput = Third(value) } }