The different states a purchase can be in. Different platforms and frameworks may have different sets of states that they support.

extension NamiPurchaseState: Codable {
  enum Key: CodingKey {
    case rawValue
  }
  
  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: Key.self)
    let rawValue = try container.decode(Int.self, forKey: .rawValue)
    switch rawValue {
      case 0:
        self = .pending
      case 1:
        self = .purchased
      case 2:
        self = .consumed
      case 3:
        self = .resubscribed
      case 4:
        self = .unsubscribed
      case 5:
        self = .deferred
      case 6:
        self = .failed
      case 7:
        self = .cancelled
      default:
        self = .unknown
    }
  }
}
enum class NamiPurchaseState {
  PURCHASED,
  FAILED,
  CANCELLED,
  PENDING,
  UNKNOWN
}
"CANCELLED"
"FAILED"
"PURCHASED"
"UNKNOWN"
enum NamiPurchaseState { purchased, failed, cancelled, unknown }