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

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

  /**
   * Get the String value this PurchaseState represents.
   */
  var stringValue: String {
    switch self {
      case .pending:
        return "pending"
      case .purchased:
        return "purchased"
      case .unknown:
        return "unknown"
    }
  }
}
