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

public extension MotionSensor {
  /**
   * Get a MotionSensor for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "accelerometer":
        self = .accelerometer
      case "gyroscope":
        self = .gyroscope
      case "magnetometer":
        self = .magnetometer
      case "deviceMotion":
        self = .devicemotion
      default:
        return nil
    }
  }

  /**
   * Get the String value this MotionSensor represents.
   */
  var stringValue: String {
    switch self {
      case .accelerometer:
        return "accelerometer"
      case .gyroscope:
        return "gyroscope"
      case .magnetometer:
        return "magnetometer"
      case .devicemotion:
        return "deviceMotion"
    }
  }
}
