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

public extension BarcodeFormat {
  /**
   * Get a BarcodeFormat for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "unknown":
        self = .unknown
      case "code-128":
        self = .code128
      case "code-39":
        self = .code39
      case "code-93":
        self = .code93
      case "codabar":
        self = .codabar
      case "data-matrix":
        self = .dataMatrix
      case "ean-13":
        self = .ean13
      case "ean-8":
        self = .ean8
      case "itf":
        self = .itf
      case "qr-code":
        self = .qrCode
      case "upc-a":
        self = .upcA
      case "upc-e":
        self = .upcE
      case "pdf-417":
        self = .pdf417
      case "aztec":
        self = .aztec
      default:
        return nil
    }
  }

  /**
   * Get the String value this BarcodeFormat represents.
   */
  var stringValue: String {
    switch self {
      case .unknown:
        return "unknown"
      case .code128:
        return "code-128"
      case .code39:
        return "code-39"
      case .code93:
        return "code-93"
      case .codabar:
        return "codabar"
      case .dataMatrix:
        return "data-matrix"
      case .ean13:
        return "ean-13"
      case .ean8:
        return "ean-8"
      case .itf:
        return "itf"
      case .qrCode:
        return "qr-code"
      case .upcA:
        return "upc-a"
      case .upcE:
        return "upc-e"
      case .pdf417:
        return "pdf-417"
      case .aztec:
        return "aztec"
    }
  }
}
