/// /// Variant_FixedDuration_OpenDuration.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.videopipeline import com.facebook.proguard.annotations.DoNotStrip /** * Represents the TypeScript variant "FixedDuration | OpenDuration". */ @Suppress("ClassName") @DoNotStrip sealed class Variant_FixedDuration_OpenDuration { @DoNotStrip data class First(@DoNotStrip val value: FixedDuration): Variant_FixedDuration_OpenDuration() @DoNotStrip data class Second(@DoNotStrip val value: OpenDuration): Variant_FixedDuration_OpenDuration() val isFirst: Boolean get() = this is First val isSecond: Boolean get() = this is Second fun asFirstOrNull(): FixedDuration? { val value = (this as? First)?.value ?: return null return value } fun asSecondOrNull(): OpenDuration? { val value = (this as? Second)?.value ?: return null return value } inline fun match(first: (FixedDuration) -> R, second: (OpenDuration) -> R): R { return when (this) { is First -> first(value) is Second -> second(value) } } companion object { @JvmStatic @DoNotStrip fun create(value: FixedDuration): Variant_FixedDuration_OpenDuration = First(value) @JvmStatic @DoNotStrip fun create(value: OpenDuration): Variant_FixedDuration_OpenDuration = Second(value) } }