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

/**
 * Represents the JS enum `CachePolicy`, backed by a C++ enum.
 */
public typealias CachePolicy = margelo.nitro.nitro_dns.CachePolicy

public extension CachePolicy {
  /**
   * Get a CachePolicy for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "FollowDnsTtl":
        self = .followdnsttl
      case "Bypass":
        self = .bypass
      case "StaleWhileRevalidate":
        self = .stalewhilerevalidate
      case "StaleIfError":
        self = .staleiferror
      default:
        return nil
    }
  }

  /**
   * Get the String value this CachePolicy represents.
   */
  var stringValue: String {
    switch self {
      case .followdnsttl:
        return "FollowDnsTtl"
      case .bypass:
        return "Bypass"
      case .stalewhilerevalidate:
        return "StaleWhileRevalidate"
      case .staleiferror:
        return "StaleIfError"
    }
  }
}
