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

/**
 * Represents the JS union `AudioPlaybackState`, backed by a C++ enum.
 */
public typealias AudioPlaybackState = margelo.nitro.one.AudioPlaybackState

public extension AudioPlaybackState {
  /**
   * Get a AudioPlaybackState for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "idle":
        self = .idle
      case "loading":
        self = .loading
      case "playing":
        self = .playing
      case "paused":
        self = .paused
      case "ended":
        self = .ended
      case "failed":
        self = .failed
      default:
        return nil
    }
  }

  /**
   * Get the String value this AudioPlaybackState represents.
   */
  var stringValue: String {
    switch self {
      case .idle:
        return "idle"
      case .loading:
        return "loading"
      case .playing:
        return "playing"
      case .paused:
        return "paused"
      case .ended:
        return "ended"
      case .failed:
        return "failed"
    }
  }
}
