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

public extension SpeechErrorCode {
  /**
   * Get a SpeechErrorCode for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "unknown":
        self = .unknown
      case "not-allowed":
        self = .notAllowed
      case "service-not-allowed":
        self = .serviceNotAllowed
      case "language-not-supported":
        self = .languageNotSupported
      case "audio-capture":
        self = .audioCapture
      case "interrupted":
        self = .interrupted
      case "network":
        self = .network
      case "busy":
        self = .busy
      default:
        return nil
    }
  }

  /**
   * Get the String value this SpeechErrorCode represents.
   */
  var stringValue: String {
    switch self {
      case .unknown:
        return "unknown"
      case .notAllowed:
        return "not-allowed"
      case .serviceNotAllowed:
        return "service-not-allowed"
      case .languageNotSupported:
        return "language-not-supported"
      case .audioCapture:
        return "audio-capture"
      case .interrupted:
        return "interrupted"
      case .network:
        return "network"
      case .busy:
        return "busy"
    }
  }
}
