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

public extension DfuError {
  /**
   * Get a DfuError for the given String value, or
   * return `nil` if the given value was invalid/unknown.
   */
  init?(fromString string: String) {
    switch string {
      case "RemoteLegacyDfuInvalidState":
        self = .remotelegacydfuinvalidstate
      case "RemoteLegacyDfuNotSupported":
        self = .remotelegacydfunotsupported
      case "RemoteLegacyDfuDataExceedsLimit":
        self = .remotelegacydfudataexceedslimit
      case "RemoteLegacyDfuCrcError":
        self = .remotelegacydfucrcerror
      case "RemoteLegacyDfuOperationFailed":
        self = .remotelegacydfuoperationfailed
      case "RemoteSecureDfuOpCodeNotSupported":
        self = .remotesecuredfuopcodenotsupported
      case "RemoteSecureDfuInvalidParameter":
        self = .remotesecuredfuinvalidparameter
      case "RemoteSecureDfuInsufficientResources":
        self = .remotesecuredfuinsufficientresources
      case "RemoteSecureDfuInvalidObject":
        self = .remotesecuredfuinvalidobject
      case "RemoteSecureDfuSignatureMismatch":
        self = .remotesecuredfusignaturemismatch
      case "RemoteSecureDfuUnsupportedType":
        self = .remotesecuredfuunsupportedtype
      case "RemoteSecureDfuOperationNotPermitted":
        self = .remotesecuredfuoperationnotpermitted
      case "RemoteSecureDfuOperationFailed":
        self = .remotesecuredfuoperationfailed
      case "RemoteSecureDfuExtendedError":
        self = .remotesecuredfuextendederror
      case "RemoteExtendedErrorWrongCommandFormat":
        self = .remoteextendederrorwrongcommandformat
      case "RemoteExtendedErrorUnknownCommand":
        self = .remoteextendederrorunknowncommand
      case "RemoteExtendedErrorInitCommandInvalid":
        self = .remoteextendederrorinitcommandinvalid
      case "RemoteExtendedErrorFwVersionFailure":
        self = .remoteextendederrorfwversionfailure
      case "RemoteExtendedErrorHwVersionFailure":
        self = .remoteextendederrorhwversionfailure
      case "RemoteExtendedErrorSdVersionFailure":
        self = .remoteextendederrorsdversionfailure
      case "RemoteExtendedErrorSignatureMissing":
        self = .remoteextendederrorsignaturemissing
      case "RemoteExtendedErrorWrongHashType":
        self = .remoteextendederrorwronghashtype
      case "RemoteExtendedErrorHashFailed":
        self = .remoteextendederrorhashfailed
      case "RemoteExtendedErrorWrongSignatureType":
        self = .remoteextendederrorwrongsignaturetype
      case "RemoteExtendedErrorVerificationFailed":
        self = .remoteextendederrorverificationfailed
      case "RemoteExtendedErrorInsufficientSpace":
        self = .remoteextendederrorinsufficientspace
      case "RemoteButtonlessDfuOpCodeNotSupported":
        self = .remotebuttonlessdfuopcodenotsupported
      case "RemoteButtonlessDfuOperationFailed":
        self = .remotebuttonlessdfuoperationfailed
      case "RemoteButtonlessDfuInvalidAdvertisementName":
        self = .remotebuttonlessdfuinvalidadvertisementname
      case "RemoteButtonlessDfuBusy":
        self = .remotebuttonlessdfubusy
      case "RemoteButtonlessDfuNotBonded":
        self = .remotebuttonlessdfunotbonded
      case "RemoteExperimentalButtonlessDfuOpCodeNotSupported":
        self = .remoteexperimentalbuttonlessdfuopcodenotsupported
      case "RemoteExperimentalButtonlessDfuOperationFailed":
        self = .remoteexperimentalbuttonlessdfuoperationfailed
      case "FileNotSpecified":
        self = .filenotspecified
      case "FileInvalid":
        self = .fileinvalid
      case "ExtendedInitPacketRequired":
        self = .extendedinitpacketrequired
      case "InitPacketRequired":
        self = .initpacketrequired
      case "FileSizeInvalid":
        self = .filesizeinvalid
      case "FileTypeUnsupported":
        self = .filetypeunsupported
      case "FileIOError":
        self = .fileioerror
      case "FailedToConnect":
        self = .failedtoconnect
      case "DeviceDisconnected":
        self = .devicedisconnected
      case "BluetoothDisabled":
        self = .bluetoothdisabled
      case "DeviceNotBonded":
        self = .devicenotbonded
      case "ServiceDiscoveryFailed":
        self = .servicediscoveryfailed
      case "DeviceNotSupported":
        self = .devicenotsupported
      case "ReadingVersionFailed":
        self = .readingversionfailed
      case "EnablingControlPointFailed":
        self = .enablingcontrolpointfailed
      case "WritingCharacteristicFailed":
        self = .writingcharacteristicfailed
      case "ReceivingNotificationFailed":
        self = .receivingnotificationfailed
      case "UnsupportedResponse":
        self = .unsupportedresponse
      case "BytesLost":
        self = .byteslost
      case "CrcError":
        self = .crcerror
      case "InvalidInternalState":
        self = .invalidinternalstate
      default:
        return nil
    }
  }

  /**
   * Get the String value this DfuError represents.
   */
  var stringValue: String {
    switch self {
      case .remotelegacydfuinvalidstate:
        return "RemoteLegacyDfuInvalidState"
      case .remotelegacydfunotsupported:
        return "RemoteLegacyDfuNotSupported"
      case .remotelegacydfudataexceedslimit:
        return "RemoteLegacyDfuDataExceedsLimit"
      case .remotelegacydfucrcerror:
        return "RemoteLegacyDfuCrcError"
      case .remotelegacydfuoperationfailed:
        return "RemoteLegacyDfuOperationFailed"
      case .remotesecuredfuopcodenotsupported:
        return "RemoteSecureDfuOpCodeNotSupported"
      case .remotesecuredfuinvalidparameter:
        return "RemoteSecureDfuInvalidParameter"
      case .remotesecuredfuinsufficientresources:
        return "RemoteSecureDfuInsufficientResources"
      case .remotesecuredfuinvalidobject:
        return "RemoteSecureDfuInvalidObject"
      case .remotesecuredfusignaturemismatch:
        return "RemoteSecureDfuSignatureMismatch"
      case .remotesecuredfuunsupportedtype:
        return "RemoteSecureDfuUnsupportedType"
      case .remotesecuredfuoperationnotpermitted:
        return "RemoteSecureDfuOperationNotPermitted"
      case .remotesecuredfuoperationfailed:
        return "RemoteSecureDfuOperationFailed"
      case .remotesecuredfuextendederror:
        return "RemoteSecureDfuExtendedError"
      case .remoteextendederrorwrongcommandformat:
        return "RemoteExtendedErrorWrongCommandFormat"
      case .remoteextendederrorunknowncommand:
        return "RemoteExtendedErrorUnknownCommand"
      case .remoteextendederrorinitcommandinvalid:
        return "RemoteExtendedErrorInitCommandInvalid"
      case .remoteextendederrorfwversionfailure:
        return "RemoteExtendedErrorFwVersionFailure"
      case .remoteextendederrorhwversionfailure:
        return "RemoteExtendedErrorHwVersionFailure"
      case .remoteextendederrorsdversionfailure:
        return "RemoteExtendedErrorSdVersionFailure"
      case .remoteextendederrorsignaturemissing:
        return "RemoteExtendedErrorSignatureMissing"
      case .remoteextendederrorwronghashtype:
        return "RemoteExtendedErrorWrongHashType"
      case .remoteextendederrorhashfailed:
        return "RemoteExtendedErrorHashFailed"
      case .remoteextendederrorwrongsignaturetype:
        return "RemoteExtendedErrorWrongSignatureType"
      case .remoteextendederrorverificationfailed:
        return "RemoteExtendedErrorVerificationFailed"
      case .remoteextendederrorinsufficientspace:
        return "RemoteExtendedErrorInsufficientSpace"
      case .remotebuttonlessdfuopcodenotsupported:
        return "RemoteButtonlessDfuOpCodeNotSupported"
      case .remotebuttonlessdfuoperationfailed:
        return "RemoteButtonlessDfuOperationFailed"
      case .remotebuttonlessdfuinvalidadvertisementname:
        return "RemoteButtonlessDfuInvalidAdvertisementName"
      case .remotebuttonlessdfubusy:
        return "RemoteButtonlessDfuBusy"
      case .remotebuttonlessdfunotbonded:
        return "RemoteButtonlessDfuNotBonded"
      case .remoteexperimentalbuttonlessdfuopcodenotsupported:
        return "RemoteExperimentalButtonlessDfuOpCodeNotSupported"
      case .remoteexperimentalbuttonlessdfuoperationfailed:
        return "RemoteExperimentalButtonlessDfuOperationFailed"
      case .filenotspecified:
        return "FileNotSpecified"
      case .fileinvalid:
        return "FileInvalid"
      case .extendedinitpacketrequired:
        return "ExtendedInitPacketRequired"
      case .initpacketrequired:
        return "InitPacketRequired"
      case .filesizeinvalid:
        return "FileSizeInvalid"
      case .filetypeunsupported:
        return "FileTypeUnsupported"
      case .fileioerror:
        return "FileIOError"
      case .failedtoconnect:
        return "FailedToConnect"
      case .devicedisconnected:
        return "DeviceDisconnected"
      case .bluetoothdisabled:
        return "BluetoothDisabled"
      case .devicenotbonded:
        return "DeviceNotBonded"
      case .servicediscoveryfailed:
        return "ServiceDiscoveryFailed"
      case .devicenotsupported:
        return "DeviceNotSupported"
      case .readingversionfailed:
        return "ReadingVersionFailed"
      case .enablingcontrolpointfailed:
        return "EnablingControlPointFailed"
      case .writingcharacteristicfailed:
        return "WritingCharacteristicFailed"
      case .receivingnotificationfailed:
        return "ReceivingNotificationFailed"
      case .unsupportedresponse:
        return "UnsupportedResponse"
      case .byteslost:
        return "BytesLost"
      case .crcerror:
        return "CrcError"
      case .invalidinternalstate:
        return "InvalidInternalState"
    }
  }
}
