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