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

public extension BatteryState {
  /**
   * Get a BatteryState 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 "unplugged":
        self = .unplugged
      case "charging":
        self = .charging
      case "full":
        self = .full
      case "notCharging":
        self = .notcharging
      default:
        return nil
    }
  }

  /**
   * Get the String value this BatteryState represents.
   */
  var stringValue: String {
    switch self {
      case .unknown:
        return "unknown"
      case .unplugged:
        return "unplugged"
      case .charging:
        return "charging"
      case .full:
        return "full"
      case .notcharging:
        return "notCharging"
    }
  }
}
