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

import NitroModules

/// See ``HybridRiveViewSpec``
public protocol HybridRiveViewSpec_protocol: HybridObject, HybridView {
  // Properties
  var artboardName: String? { get set }
  var stateMachineName: String? { get set }
  var autoPlay: Bool? { get set }
  var file: (any HybridRiveFileSpec) { get set }
  var alignment: Alignment? { get set }
  var fit: Fit? { get set }
  var layoutScaleFactor: Double? { get set }
  var dataBind: Variant__any_HybridViewModelInstanceSpec__DataBindMode_DataBindByName? { get set }
  var onError: (_ error: RiveError) -> Void { get set }

  // Methods
  func awaitViewReady() throws -> Promise<Bool>
  func bindViewModelInstance(viewModelInstance: (any HybridViewModelInstanceSpec)) throws -> Void
  func getViewModelInstance() throws -> (any HybridViewModelInstanceSpec)?
  func play() throws -> Promise<Void>
  func pause() throws -> Promise<Void>
  func reset() throws -> Promise<Void>
  func playIfNeeded() throws -> Void
  func onEventListener(onEvent: @escaping (_ event: UnifiedRiveEvent) -> Void) throws -> Void
  func removeEventListeners() throws -> Void
  func setNumberInputValue(name: String, value: Double, path: String?) throws -> Void
  func getNumberInputValue(name: String, path: String?) throws -> Double
  func setBooleanInputValue(name: String, value: Bool, path: String?) throws -> Void
  func getBooleanInputValue(name: String, path: String?) throws -> Bool
  func triggerInput(name: String, path: String?) throws -> Void
  func setTextRunValue(name: String, value: String, path: String?) throws -> Void
  func getTextRunValue(name: String, path: String?) throws -> String
}

public extension HybridRiveViewSpec_protocol {
  /// Default implementation of ``HybridObject.toString``
  func toString() -> String {
    return "[HybridObject RiveView]"
  }
}

/// See ``HybridRiveViewSpec``
open class HybridRiveViewSpec_base {
  private weak var cxxWrapper: HybridRiveViewSpec_cxx? = nil
  public init() { }
  public func getCxxWrapper() -> HybridRiveViewSpec_cxx {
  #if DEBUG
    guard self is any HybridRiveViewSpec else {
      fatalError("`self` is not a `HybridRiveViewSpec`! Did you accidentally inherit from `HybridRiveViewSpec_base` instead of `HybridRiveViewSpec`?")
    }
  #endif
    if let cxxWrapper = self.cxxWrapper {
      return cxxWrapper
    } else {
      let cxxWrapper = HybridRiveViewSpec_cxx(self as! any HybridRiveViewSpec)
      self.cxxWrapper = cxxWrapper
      return cxxWrapper
    }
  }
}

/**
 * A Swift base-protocol representing the RiveView HybridObject.
 * Implement this protocol to create Swift-based instances of RiveView.
 * ```swift
 * class HybridRiveView : HybridRiveViewSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridRiveViewSpec = HybridRiveViewSpec_protocol & HybridRiveViewSpec_base
