///
/// PlaybackState.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 `PlaybackState`, backed by a C++ enum.
 */
public typealias PlaybackState = margelo.nitro.aviation.PlaybackState

public extension PlaybackState {
  /**
   * Get a PlaybackState 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 "ready":
        self = .ready
      case "playing":
        self = .playing
      case "paused":
        self = .paused
      case "buffering":
        self = .buffering
      case "stopped":
        self = .stopped
      case "error":
        self = .error
      default:
        return nil
    }
  }

  /**
   * Get the String value this PlaybackState represents.
   */
  var stringValue: String {
    switch self {
      case .idle:
        return "idle"
      case .loading:
        return "loading"
      case .ready:
        return "ready"
      case .playing:
        return "playing"
      case .paused:
        return "paused"
      case .buffering:
        return "buffering"
      case .stopped:
        return "stopped"
      case .error:
        return "error"
    }
  }
}
