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

/**
 * Represents the JS enum `DfuState`, backed by a C++ enum.
 */
public typealias DfuState = margelo.nitro.co.zyke.dfu.DfuState

public extension DfuState {
  /**
   * Get a DfuState for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "Connecting":
        self = .connecting
      case "Starting":
        self = .starting
      case "EnablingDfuMode":
        self = .enablingdfumode
      case "Uploading":
        self = .uploading
      case "Validating":
        self = .validating
      case "Disconnecting":
        self = .disconnecting
      case "Completed":
        self = .completed
      case "Aborted":
        self = .aborted
      default:
        return nil
    }
  }

  /**
   * Get the String value this DfuState represents.
   */
  var stringValue: String {
    switch self {
      case .connecting:
        return "Connecting"
      case .starting:
        return "Starting"
      case .enablingdfumode:
        return "EnablingDfuMode"
      case .uploading:
        return "Uploading"
      case .validating:
        return "Validating"
      case .disconnecting:
        return "Disconnecting"
      case .completed:
        return "Completed"
      case .aborted:
        return "Aborted"
    }
  }
}
