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

public extension IapkitPurchaseState {
  /**
   * Get a IapkitPurchaseState 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 "unknown":
        self = .unknown
      case "entitled":
        self = .entitled
      case "pending-acknowledgment":
        self = .pendingAcknowledgment
      case "canceled":
        self = .canceled
      case "expired":
        self = .expired
      case "ready-to-consume":
        self = .readyToConsume
      case "consumed":
        self = .consumed
      case "inauthentic":
        self = .inauthentic
      default:
        return nil
    }
  }

  /**
   * Get the String value this IapkitPurchaseState represents.
   */
  var stringValue: String {
    switch self {
      case .pending:
        return "pending"
      case .unknown:
        return "unknown"
      case .entitled:
        return "entitled"
      case .pendingAcknowledgment:
        return "pending-acknowledgment"
      case .canceled:
        return "canceled"
      case .expired:
        return "expired"
      case .readyToConsume:
        return "ready-to-consume"
      case .consumed:
        return "consumed"
      case .inauthentic:
        return "inauthentic"
    }
  }
}
