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

/// Represents the JS union `TradeState`, backed by a C++ enum.
public typealias TradeState = margelo.nitro.rncandle.TradeState

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

  /**
   * Get the String value this TradeState represents.
   */
  public var stringValue: String {
    switch self {
    case .success:
      return "success"
    case .inprogress:
      return "inProgress"
    case .failure:
      return "failure"
    }
  }
}
