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

public extension NitroRequestMethod {
  /**
   * Get a NitroRequestMethod for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "GET":
        self = .get
      case "HEAD":
        self = .head
      case "POST":
        self = .post
      case "PUT":
        self = .put
      case "PATCH":
        self = .patch
      case "DELETE":
        self = .delete
      case "OPTIONS":
        self = .options
      default:
        return nil
    }
  }

  /**
   * Get the String value this NitroRequestMethod represents.
   */
  var stringValue: String {
    switch self {
      case .get:
        return "GET"
      case .head:
        return "HEAD"
      case .post:
        return "POST"
      case .put:
        return "PUT"
      case .patch:
        return "PATCH"
      case .delete:
        return "DELETE"
      case .options:
        return "OPTIONS"
    }
  }
}
