///
/// Constraint.swift
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///



/**
 * An Swift enum with associated values representing a Variant/Union type.
 * JS type: `struct | struct | struct | struct | struct | struct | struct | struct`
 */
@frozen
public indirect enum Constraint {
  case first(FPSConstraint)
  case second(VideoStabilizationModeConstraint)
  case third(PreviewStabilizationModeConstraint)
  case fourth(ResolutionBiasConstraint)
  case fifth(VideoDynamicRangeConstraint)
  case sixth(PhotoHDRConstraint)
  case seventh(PixelFormatConstraint)
  case eigth(BinnedConstraint)
}

public extension Constraint {
  func asType<T>(_ type: T.Type = T.self) -> T? {
    switch self {
      case .first(let value): return value as? T
      case .second(let value): return value as? T
      case .third(let value): return value as? T
      case .fourth(let value): return value as? T
      case .fifth(let value): return value as? T
      case .sixth(let value): return value as? T
      case .seventh(let value): return value as? T
      case .eigth(let value): return value as? T
    }
  }
  func isType<T>(_ type: T.Type = T.self) -> Bool {
    return self.asType(type) != nil
  }
}
