// SPDX-License-Identifier: GPL-3.0-or-later

// This file is auto-generated by scripts/generate_nymea_api.py
// Any changes made here will be lost when the files are regenerated.
// Do not edit manually.

#include "apiutils.h"

namespace nymea::api {

QString toString(BasicType value) {
    switch (value) {
    case BasicType::Uuid: return QStringLiteral("Uuid");
    case BasicType::String: return QStringLiteral("String");
    case BasicType::StringList: return QStringLiteral("StringList");
    case BasicType::Int: return QStringLiteral("Int");
    case BasicType::Uint: return QStringLiteral("Uint");
    case BasicType::Double: return QStringLiteral("Double");
    case BasicType::Bool: return QStringLiteral("Bool");
    case BasicType::Variant: return QStringLiteral("Variant");
    case BasicType::Color: return QStringLiteral("Color");
    case BasicType::Time: return QStringLiteral("Time");
    case BasicType::Object: return QStringLiteral("Object");
    }
    return QStringLiteral("Uuid");
}

BasicType parseBasicType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("Uuid")) return BasicType::Uuid;
    if (token == QStringLiteral("String")) return BasicType::String;
    if (token == QStringLiteral("StringList")) return BasicType::StringList;
    if (token == QStringLiteral("Int")) return BasicType::Int;
    if (token == QStringLiteral("Uint")) return BasicType::Uint;
    if (token == QStringLiteral("Double")) return BasicType::Double;
    if (token == QStringLiteral("Bool")) return BasicType::Bool;
    if (token == QStringLiteral("Variant")) return BasicType::Variant;
    if (token == QStringLiteral("Color")) return BasicType::Color;
    if (token == QStringLiteral("Time")) return BasicType::Time;
    if (token == QStringLiteral("Object")) return BasicType::Object;
    return BasicType::Uuid;
}

QString toString(BrowserIcon value) {
    switch (value) {
    case BrowserIcon::BrowserIconNone: return QStringLiteral("BrowserIconNone");
    case BrowserIcon::BrowserIconFolder: return QStringLiteral("BrowserIconFolder");
    case BrowserIcon::BrowserIconFile: return QStringLiteral("BrowserIconFile");
    case BrowserIcon::BrowserIconMusic: return QStringLiteral("BrowserIconMusic");
    case BrowserIcon::BrowserIconVideo: return QStringLiteral("BrowserIconVideo");
    case BrowserIcon::BrowserIconPictures: return QStringLiteral("BrowserIconPictures");
    case BrowserIcon::BrowserIconApplication: return QStringLiteral("BrowserIconApplication");
    case BrowserIcon::BrowserIconDocument: return QStringLiteral("BrowserIconDocument");
    case BrowserIcon::BrowserIconPackage: return QStringLiteral("BrowserIconPackage");
    case BrowserIcon::BrowserIconFavorites: return QStringLiteral("BrowserIconFavorites");
    }
    return QStringLiteral("BrowserIconNone");
}

BrowserIcon parseBrowserIcon(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("BrowserIconNone")) return BrowserIcon::BrowserIconNone;
    if (token == QStringLiteral("BrowserIconFolder")) return BrowserIcon::BrowserIconFolder;
    if (token == QStringLiteral("BrowserIconFile")) return BrowserIcon::BrowserIconFile;
    if (token == QStringLiteral("BrowserIconMusic")) return BrowserIcon::BrowserIconMusic;
    if (token == QStringLiteral("BrowserIconVideo")) return BrowserIcon::BrowserIconVideo;
    if (token == QStringLiteral("BrowserIconPictures")) return BrowserIcon::BrowserIconPictures;
    if (token == QStringLiteral("BrowserIconApplication")) return BrowserIcon::BrowserIconApplication;
    if (token == QStringLiteral("BrowserIconDocument")) return BrowserIcon::BrowserIconDocument;
    if (token == QStringLiteral("BrowserIconPackage")) return BrowserIcon::BrowserIconPackage;
    if (token == QStringLiteral("BrowserIconFavorites")) return BrowserIcon::BrowserIconFavorites;
    return BrowserIcon::BrowserIconNone;
}

QString toString(ConfigurationError value) {
    switch (value) {
    case ConfigurationError::ConfigurationErrorNoError: return QStringLiteral("ConfigurationErrorNoError");
    case ConfigurationError::ConfigurationErrorInvalidTimeZone: return QStringLiteral("ConfigurationErrorInvalidTimeZone");
    case ConfigurationError::ConfigurationErrorInvalidStationName: return QStringLiteral("ConfigurationErrorInvalidStationName");
    case ConfigurationError::ConfigurationErrorInvalidId: return QStringLiteral("ConfigurationErrorInvalidId");
    case ConfigurationError::ConfigurationErrorInvalidPort: return QStringLiteral("ConfigurationErrorInvalidPort");
    case ConfigurationError::ConfigurationErrorInvalidHostAddress: return QStringLiteral("ConfigurationErrorInvalidHostAddress");
    case ConfigurationError::ConfigurationErrorInvalidDestinationDir: return QStringLiteral("ConfigurationErrorInvalidDestinationDir");
    case ConfigurationError::ConfigurationErrorInvalidFileName: return QStringLiteral("ConfigurationErrorInvalidFileName");
    case ConfigurationError::ConfigurationErrorBluetoothHardwareNotAvailable: return QStringLiteral("ConfigurationErrorBluetoothHardwareNotAvailable");
    case ConfigurationError::ConfigurationErrorInvalidCertificate: return QStringLiteral("ConfigurationErrorInvalidCertificate");
    case ConfigurationError::ConfigurationErrorUnsupported: return QStringLiteral("ConfigurationErrorUnsupported");
    case ConfigurationError::ConfigurationErrorBackupFailed: return QStringLiteral("ConfigurationErrorBackupFailed");
    }
    return QStringLiteral("ConfigurationErrorNoError");
}

ConfigurationError parseConfigurationError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ConfigurationErrorNoError")) return ConfigurationError::ConfigurationErrorNoError;
    if (token == QStringLiteral("ConfigurationErrorInvalidTimeZone")) return ConfigurationError::ConfigurationErrorInvalidTimeZone;
    if (token == QStringLiteral("ConfigurationErrorInvalidStationName")) return ConfigurationError::ConfigurationErrorInvalidStationName;
    if (token == QStringLiteral("ConfigurationErrorInvalidId")) return ConfigurationError::ConfigurationErrorInvalidId;
    if (token == QStringLiteral("ConfigurationErrorInvalidPort")) return ConfigurationError::ConfigurationErrorInvalidPort;
    if (token == QStringLiteral("ConfigurationErrorInvalidHostAddress")) return ConfigurationError::ConfigurationErrorInvalidHostAddress;
    if (token == QStringLiteral("ConfigurationErrorInvalidDestinationDir")) return ConfigurationError::ConfigurationErrorInvalidDestinationDir;
    if (token == QStringLiteral("ConfigurationErrorInvalidFileName")) return ConfigurationError::ConfigurationErrorInvalidFileName;
    if (token == QStringLiteral("ConfigurationErrorBluetoothHardwareNotAvailable")) return ConfigurationError::ConfigurationErrorBluetoothHardwareNotAvailable;
    if (token == QStringLiteral("ConfigurationErrorInvalidCertificate")) return ConfigurationError::ConfigurationErrorInvalidCertificate;
    if (token == QStringLiteral("ConfigurationErrorUnsupported")) return ConfigurationError::ConfigurationErrorUnsupported;
    if (token == QStringLiteral("ConfigurationErrorBackupFailed")) return ConfigurationError::ConfigurationErrorBackupFailed;
    return ConfigurationError::ConfigurationErrorNoError;
}

QString toString(CreateMethod value) {
    switch (value) {
    case CreateMethod::CreateMethodUser: return QStringLiteral("CreateMethodUser");
    case CreateMethod::CreateMethodAuto: return QStringLiteral("CreateMethodAuto");
    case CreateMethod::CreateMethodDiscovery: return QStringLiteral("CreateMethodDiscovery");
    }
    return QStringLiteral("CreateMethodUser");
}

CreateMethod parseCreateMethod(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("CreateMethodUser")) return CreateMethod::CreateMethodUser;
    if (token == QStringLiteral("CreateMethodAuto")) return CreateMethod::CreateMethodAuto;
    if (token == QStringLiteral("CreateMethodDiscovery")) return CreateMethod::CreateMethodDiscovery;
    return CreateMethod::CreateMethodUser;
}

QString toString(DebugError value) {
    switch (value) {
    case DebugError::DebugErrorNoError: return QStringLiteral("DebugErrorNoError");
    }
    return QStringLiteral("DebugErrorNoError");
}

DebugError parseDebugError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("DebugErrorNoError")) return DebugError::DebugErrorNoError;
    return DebugError::DebugErrorNoError;
}

QString toString(DiscoveryType value) {
    switch (value) {
    case DiscoveryType::DiscoveryTypePrecise: return QStringLiteral("DiscoveryTypePrecise");
    case DiscoveryType::DiscoveryTypeWeak: return QStringLiteral("DiscoveryTypeWeak");
    }
    return QStringLiteral("DiscoveryTypePrecise");
}

DiscoveryType parseDiscoveryType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("DiscoveryTypePrecise")) return DiscoveryType::DiscoveryTypePrecise;
    if (token == QStringLiteral("DiscoveryTypeWeak")) return DiscoveryType::DiscoveryTypeWeak;
    return DiscoveryType::DiscoveryTypePrecise;
}

QString toString(IOType value) {
    switch (value) {
    case IOType::IOTypeNone: return QStringLiteral("IOTypeNone");
    case IOType::IOTypeDigitalInput: return QStringLiteral("IOTypeDigitalInput");
    case IOType::IOTypeDigitalOutput: return QStringLiteral("IOTypeDigitalOutput");
    case IOType::IOTypeAnalogInput: return QStringLiteral("IOTypeAnalogInput");
    case IOType::IOTypeAnalogOutput: return QStringLiteral("IOTypeAnalogOutput");
    }
    return QStringLiteral("IOTypeNone");
}

IOType parseIOType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("IOTypeNone")) return IOType::IOTypeNone;
    if (token == QStringLiteral("IOTypeDigitalInput")) return IOType::IOTypeDigitalInput;
    if (token == QStringLiteral("IOTypeDigitalOutput")) return IOType::IOTypeDigitalOutput;
    if (token == QStringLiteral("IOTypeAnalogInput")) return IOType::IOTypeAnalogInput;
    if (token == QStringLiteral("IOTypeAnalogOutput")) return IOType::IOTypeAnalogOutput;
    return IOType::IOTypeNone;
}

QString toString(InputType value) {
    switch (value) {
    case InputType::InputTypeNone: return QStringLiteral("InputTypeNone");
    case InputType::InputTypeTextLine: return QStringLiteral("InputTypeTextLine");
    case InputType::InputTypeTextArea: return QStringLiteral("InputTypeTextArea");
    case InputType::InputTypePassword: return QStringLiteral("InputTypePassword");
    case InputType::InputTypeSearch: return QStringLiteral("InputTypeSearch");
    case InputType::InputTypeMail: return QStringLiteral("InputTypeMail");
    case InputType::InputTypeIPv4Address: return QStringLiteral("InputTypeIPv4Address");
    case InputType::InputTypeIPv6Address: return QStringLiteral("InputTypeIPv6Address");
    case InputType::InputTypeUrl: return QStringLiteral("InputTypeUrl");
    case InputType::InputTypeMacAddress: return QStringLiteral("InputTypeMacAddress");
    }
    return QStringLiteral("InputTypeNone");
}

InputType parseInputType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("InputTypeNone")) return InputType::InputTypeNone;
    if (token == QStringLiteral("InputTypeTextLine")) return InputType::InputTypeTextLine;
    if (token == QStringLiteral("InputTypeTextArea")) return InputType::InputTypeTextArea;
    if (token == QStringLiteral("InputTypePassword")) return InputType::InputTypePassword;
    if (token == QStringLiteral("InputTypeSearch")) return InputType::InputTypeSearch;
    if (token == QStringLiteral("InputTypeMail")) return InputType::InputTypeMail;
    if (token == QStringLiteral("InputTypeIPv4Address")) return InputType::InputTypeIPv4Address;
    if (token == QStringLiteral("InputTypeIPv6Address")) return InputType::InputTypeIPv6Address;
    if (token == QStringLiteral("InputTypeUrl")) return InputType::InputTypeUrl;
    if (token == QStringLiteral("InputTypeMacAddress")) return InputType::InputTypeMacAddress;
    return InputType::InputTypeNone;
}

QString toString(LoggingCategoryType value) {
    switch (value) {
    case LoggingCategoryType::LoggingCategoryTypeSystem: return QStringLiteral("LoggingCategoryTypeSystem");
    case LoggingCategoryType::LoggingCategoryTypePlugin: return QStringLiteral("LoggingCategoryTypePlugin");
    case LoggingCategoryType::LoggingCategoryTypeCustom: return QStringLiteral("LoggingCategoryTypeCustom");
    }
    return QStringLiteral("LoggingCategoryTypeSystem");
}

LoggingCategoryType parseLoggingCategoryType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("LoggingCategoryTypeSystem")) return LoggingCategoryType::LoggingCategoryTypeSystem;
    if (token == QStringLiteral("LoggingCategoryTypePlugin")) return LoggingCategoryType::LoggingCategoryTypePlugin;
    if (token == QStringLiteral("LoggingCategoryTypeCustom")) return LoggingCategoryType::LoggingCategoryTypeCustom;
    return LoggingCategoryType::LoggingCategoryTypeSystem;
}

QString toString(LoggingLevel value) {
    switch (value) {
    case LoggingLevel::LoggingLevelCritical: return QStringLiteral("LoggingLevelCritical");
    case LoggingLevel::LoggingLevelWarning: return QStringLiteral("LoggingLevelWarning");
    case LoggingLevel::LoggingLevelInfo: return QStringLiteral("LoggingLevelInfo");
    case LoggingLevel::LoggingLevelDebug: return QStringLiteral("LoggingLevelDebug");
    }
    return QStringLiteral("LoggingLevelCritical");
}

LoggingLevel parseLoggingLevel(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("LoggingLevelCritical")) return LoggingLevel::LoggingLevelCritical;
    if (token == QStringLiteral("LoggingLevelWarning")) return LoggingLevel::LoggingLevelWarning;
    if (token == QStringLiteral("LoggingLevelInfo")) return LoggingLevel::LoggingLevelInfo;
    if (token == QStringLiteral("LoggingLevelDebug")) return LoggingLevel::LoggingLevelDebug;
    return LoggingLevel::LoggingLevelCritical;
}

QString toString(MediaBrowserIcon value) {
    switch (value) {
    case MediaBrowserIcon::MediaBrowserIconNone: return QStringLiteral("MediaBrowserIconNone");
    case MediaBrowserIcon::MediaBrowserIconPlaylist: return QStringLiteral("MediaBrowserIconPlaylist");
    case MediaBrowserIcon::MediaBrowserIconRecentlyPlayed: return QStringLiteral("MediaBrowserIconRecentlyPlayed");
    case MediaBrowserIcon::MediaBrowserIconLibrary: return QStringLiteral("MediaBrowserIconLibrary");
    case MediaBrowserIcon::MediaBrowserIconMusicLibrary: return QStringLiteral("MediaBrowserIconMusicLibrary");
    case MediaBrowserIcon::MediaBrowserIconVideoLibrary: return QStringLiteral("MediaBrowserIconVideoLibrary");
    case MediaBrowserIcon::MediaBrowserIconPictureLibrary: return QStringLiteral("MediaBrowserIconPictureLibrary");
    case MediaBrowserIcon::MediaBrowserIconDisk: return QStringLiteral("MediaBrowserIconDisk");
    case MediaBrowserIcon::MediaBrowserIconUSB: return QStringLiteral("MediaBrowserIconUSB");
    case MediaBrowserIcon::MediaBrowserIconNetwork: return QStringLiteral("MediaBrowserIconNetwork");
    case MediaBrowserIcon::MediaBrowserIconAux: return QStringLiteral("MediaBrowserIconAux");
    case MediaBrowserIcon::MediaBrowserIconBluetooth: return QStringLiteral("MediaBrowserIconBluetooth");
    case MediaBrowserIcon::MediaBrowserIconSpotify: return QStringLiteral("MediaBrowserIconSpotify");
    case MediaBrowserIcon::MediaBrowserIconAmazon: return QStringLiteral("MediaBrowserIconAmazon");
    case MediaBrowserIcon::MediaBrowserIconTuneIn: return QStringLiteral("MediaBrowserIconTuneIn");
    case MediaBrowserIcon::MediaBrowserIconSiriusXM: return QStringLiteral("MediaBrowserIconSiriusXM");
    case MediaBrowserIcon::MediaBrowserIconVTuner: return QStringLiteral("MediaBrowserIconVTuner");
    case MediaBrowserIcon::MediaBrowserIconTidal: return QStringLiteral("MediaBrowserIconTidal");
    case MediaBrowserIcon::MediaBrowserIconAirable: return QStringLiteral("MediaBrowserIconAirable");
    case MediaBrowserIcon::MediaBrowserIconDeezer: return QStringLiteral("MediaBrowserIconDeezer");
    case MediaBrowserIcon::MediaBrowserIconNapster: return QStringLiteral("MediaBrowserIconNapster");
    case MediaBrowserIcon::MediaBrowserIconSoundCloud: return QStringLiteral("MediaBrowserIconSoundCloud");
    case MediaBrowserIcon::MediaBrowserIconRadioParadise: return QStringLiteral("MediaBrowserIconRadioParadise");
    }
    return QStringLiteral("MediaBrowserIconNone");
}

MediaBrowserIcon parseMediaBrowserIcon(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("MediaBrowserIconNone")) return MediaBrowserIcon::MediaBrowserIconNone;
    if (token == QStringLiteral("MediaBrowserIconPlaylist")) return MediaBrowserIcon::MediaBrowserIconPlaylist;
    if (token == QStringLiteral("MediaBrowserIconRecentlyPlayed")) return MediaBrowserIcon::MediaBrowserIconRecentlyPlayed;
    if (token == QStringLiteral("MediaBrowserIconLibrary")) return MediaBrowserIcon::MediaBrowserIconLibrary;
    if (token == QStringLiteral("MediaBrowserIconMusicLibrary")) return MediaBrowserIcon::MediaBrowserIconMusicLibrary;
    if (token == QStringLiteral("MediaBrowserIconVideoLibrary")) return MediaBrowserIcon::MediaBrowserIconVideoLibrary;
    if (token == QStringLiteral("MediaBrowserIconPictureLibrary")) return MediaBrowserIcon::MediaBrowserIconPictureLibrary;
    if (token == QStringLiteral("MediaBrowserIconDisk")) return MediaBrowserIcon::MediaBrowserIconDisk;
    if (token == QStringLiteral("MediaBrowserIconUSB")) return MediaBrowserIcon::MediaBrowserIconUSB;
    if (token == QStringLiteral("MediaBrowserIconNetwork")) return MediaBrowserIcon::MediaBrowserIconNetwork;
    if (token == QStringLiteral("MediaBrowserIconAux")) return MediaBrowserIcon::MediaBrowserIconAux;
    if (token == QStringLiteral("MediaBrowserIconBluetooth")) return MediaBrowserIcon::MediaBrowserIconBluetooth;
    if (token == QStringLiteral("MediaBrowserIconSpotify")) return MediaBrowserIcon::MediaBrowserIconSpotify;
    if (token == QStringLiteral("MediaBrowserIconAmazon")) return MediaBrowserIcon::MediaBrowserIconAmazon;
    if (token == QStringLiteral("MediaBrowserIconTuneIn")) return MediaBrowserIcon::MediaBrowserIconTuneIn;
    if (token == QStringLiteral("MediaBrowserIconSiriusXM")) return MediaBrowserIcon::MediaBrowserIconSiriusXM;
    if (token == QStringLiteral("MediaBrowserIconVTuner")) return MediaBrowserIcon::MediaBrowserIconVTuner;
    if (token == QStringLiteral("MediaBrowserIconTidal")) return MediaBrowserIcon::MediaBrowserIconTidal;
    if (token == QStringLiteral("MediaBrowserIconAirable")) return MediaBrowserIcon::MediaBrowserIconAirable;
    if (token == QStringLiteral("MediaBrowserIconDeezer")) return MediaBrowserIcon::MediaBrowserIconDeezer;
    if (token == QStringLiteral("MediaBrowserIconNapster")) return MediaBrowserIcon::MediaBrowserIconNapster;
    if (token == QStringLiteral("MediaBrowserIconSoundCloud")) return MediaBrowserIcon::MediaBrowserIconSoundCloud;
    if (token == QStringLiteral("MediaBrowserIconRadioParadise")) return MediaBrowserIcon::MediaBrowserIconRadioParadise;
    return MediaBrowserIcon::MediaBrowserIconNone;
}

QString toString(ModbusRtuError value) {
    switch (value) {
    case ModbusRtuError::ModbusRtuErrorNoError: return QStringLiteral("ModbusRtuErrorNoError");
    case ModbusRtuError::ModbusRtuErrorNotAvailable: return QStringLiteral("ModbusRtuErrorNotAvailable");
    case ModbusRtuError::ModbusRtuErrorUuidNotFound: return QStringLiteral("ModbusRtuErrorUuidNotFound");
    case ModbusRtuError::ModbusRtuErrorHardwareNotFound: return QStringLiteral("ModbusRtuErrorHardwareNotFound");
    case ModbusRtuError::ModbusRtuErrorResourceBusy: return QStringLiteral("ModbusRtuErrorResourceBusy");
    case ModbusRtuError::ModbusRtuErrorNotSupported: return QStringLiteral("ModbusRtuErrorNotSupported");
    case ModbusRtuError::ModbusRtuErrorInvalidTimeoutValue: return QStringLiteral("ModbusRtuErrorInvalidTimeoutValue");
    case ModbusRtuError::ModbusRtuErrorConnectionFailed: return QStringLiteral("ModbusRtuErrorConnectionFailed");
    }
    return QStringLiteral("ModbusRtuErrorNoError");
}

ModbusRtuError parseModbusRtuError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ModbusRtuErrorNoError")) return ModbusRtuError::ModbusRtuErrorNoError;
    if (token == QStringLiteral("ModbusRtuErrorNotAvailable")) return ModbusRtuError::ModbusRtuErrorNotAvailable;
    if (token == QStringLiteral("ModbusRtuErrorUuidNotFound")) return ModbusRtuError::ModbusRtuErrorUuidNotFound;
    if (token == QStringLiteral("ModbusRtuErrorHardwareNotFound")) return ModbusRtuError::ModbusRtuErrorHardwareNotFound;
    if (token == QStringLiteral("ModbusRtuErrorResourceBusy")) return ModbusRtuError::ModbusRtuErrorResourceBusy;
    if (token == QStringLiteral("ModbusRtuErrorNotSupported")) return ModbusRtuError::ModbusRtuErrorNotSupported;
    if (token == QStringLiteral("ModbusRtuErrorInvalidTimeoutValue")) return ModbusRtuError::ModbusRtuErrorInvalidTimeoutValue;
    if (token == QStringLiteral("ModbusRtuErrorConnectionFailed")) return ModbusRtuError::ModbusRtuErrorConnectionFailed;
    return ModbusRtuError::ModbusRtuErrorNoError;
}

QString toString(NetworkDeviceState value) {
    switch (value) {
    case NetworkDeviceState::NetworkDeviceStateUnknown: return QStringLiteral("NetworkDeviceStateUnknown");
    case NetworkDeviceState::NetworkDeviceStateUnmanaged: return QStringLiteral("NetworkDeviceStateUnmanaged");
    case NetworkDeviceState::NetworkDeviceStateUnavailable: return QStringLiteral("NetworkDeviceStateUnavailable");
    case NetworkDeviceState::NetworkDeviceStateDisconnected: return QStringLiteral("NetworkDeviceStateDisconnected");
    case NetworkDeviceState::NetworkDeviceStatePrepare: return QStringLiteral("NetworkDeviceStatePrepare");
    case NetworkDeviceState::NetworkDeviceStateConfig: return QStringLiteral("NetworkDeviceStateConfig");
    case NetworkDeviceState::NetworkDeviceStateNeedAuth: return QStringLiteral("NetworkDeviceStateNeedAuth");
    case NetworkDeviceState::NetworkDeviceStateIpConfig: return QStringLiteral("NetworkDeviceStateIpConfig");
    case NetworkDeviceState::NetworkDeviceStateIpCheck: return QStringLiteral("NetworkDeviceStateIpCheck");
    case NetworkDeviceState::NetworkDeviceStateSecondaries: return QStringLiteral("NetworkDeviceStateSecondaries");
    case NetworkDeviceState::NetworkDeviceStateActivated: return QStringLiteral("NetworkDeviceStateActivated");
    case NetworkDeviceState::NetworkDeviceStateDeactivating: return QStringLiteral("NetworkDeviceStateDeactivating");
    case NetworkDeviceState::NetworkDeviceStateFailed: return QStringLiteral("NetworkDeviceStateFailed");
    }
    return QStringLiteral("NetworkDeviceStateUnknown");
}

NetworkDeviceState parseNetworkDeviceState(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("NetworkDeviceStateUnknown")) return NetworkDeviceState::NetworkDeviceStateUnknown;
    if (token == QStringLiteral("NetworkDeviceStateUnmanaged")) return NetworkDeviceState::NetworkDeviceStateUnmanaged;
    if (token == QStringLiteral("NetworkDeviceStateUnavailable")) return NetworkDeviceState::NetworkDeviceStateUnavailable;
    if (token == QStringLiteral("NetworkDeviceStateDisconnected")) return NetworkDeviceState::NetworkDeviceStateDisconnected;
    if (token == QStringLiteral("NetworkDeviceStatePrepare")) return NetworkDeviceState::NetworkDeviceStatePrepare;
    if (token == QStringLiteral("NetworkDeviceStateConfig")) return NetworkDeviceState::NetworkDeviceStateConfig;
    if (token == QStringLiteral("NetworkDeviceStateNeedAuth")) return NetworkDeviceState::NetworkDeviceStateNeedAuth;
    if (token == QStringLiteral("NetworkDeviceStateIpConfig")) return NetworkDeviceState::NetworkDeviceStateIpConfig;
    if (token == QStringLiteral("NetworkDeviceStateIpCheck")) return NetworkDeviceState::NetworkDeviceStateIpCheck;
    if (token == QStringLiteral("NetworkDeviceStateSecondaries")) return NetworkDeviceState::NetworkDeviceStateSecondaries;
    if (token == QStringLiteral("NetworkDeviceStateActivated")) return NetworkDeviceState::NetworkDeviceStateActivated;
    if (token == QStringLiteral("NetworkDeviceStateDeactivating")) return NetworkDeviceState::NetworkDeviceStateDeactivating;
    if (token == QStringLiteral("NetworkDeviceStateFailed")) return NetworkDeviceState::NetworkDeviceStateFailed;
    return NetworkDeviceState::NetworkDeviceStateUnknown;
}

QString toString(NetworkManagerError value) {
    switch (value) {
    case NetworkManagerError::NetworkManagerErrorNoError: return QStringLiteral("NetworkManagerErrorNoError");
    case NetworkManagerError::NetworkManagerErrorUnknownError: return QStringLiteral("NetworkManagerErrorUnknownError");
    case NetworkManagerError::NetworkManagerErrorWirelessNotAvailable: return QStringLiteral("NetworkManagerErrorWirelessNotAvailable");
    case NetworkManagerError::NetworkManagerErrorAccessPointNotFound: return QStringLiteral("NetworkManagerErrorAccessPointNotFound");
    case NetworkManagerError::NetworkManagerErrorNetworkInterfaceNotFound: return QStringLiteral("NetworkManagerErrorNetworkInterfaceNotFound");
    case NetworkManagerError::NetworkManagerErrorInvalidNetworkDeviceType: return QStringLiteral("NetworkManagerErrorInvalidNetworkDeviceType");
    case NetworkManagerError::NetworkManagerErrorWirelessNetworkingDisabled: return QStringLiteral("NetworkManagerErrorWirelessNetworkingDisabled");
    case NetworkManagerError::NetworkManagerErrorWirelessConnectionFailed: return QStringLiteral("NetworkManagerErrorWirelessConnectionFailed");
    case NetworkManagerError::NetworkManagerErrorNetworkingDisabled: return QStringLiteral("NetworkManagerErrorNetworkingDisabled");
    case NetworkManagerError::NetworkManagerErrorNetworkManagerNotAvailable: return QStringLiteral("NetworkManagerErrorNetworkManagerNotAvailable");
    case NetworkManagerError::NetworkManagerErrorInvalidConfiguration: return QStringLiteral("NetworkManagerErrorInvalidConfiguration");
    case NetworkManagerError::NetworkManagerErrorUnsupportedFeature: return QStringLiteral("NetworkManagerErrorUnsupportedFeature");
    }
    return QStringLiteral("NetworkManagerErrorNoError");
}

NetworkManagerError parseNetworkManagerError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("NetworkManagerErrorNoError")) return NetworkManagerError::NetworkManagerErrorNoError;
    if (token == QStringLiteral("NetworkManagerErrorUnknownError")) return NetworkManagerError::NetworkManagerErrorUnknownError;
    if (token == QStringLiteral("NetworkManagerErrorWirelessNotAvailable")) return NetworkManagerError::NetworkManagerErrorWirelessNotAvailable;
    if (token == QStringLiteral("NetworkManagerErrorAccessPointNotFound")) return NetworkManagerError::NetworkManagerErrorAccessPointNotFound;
    if (token == QStringLiteral("NetworkManagerErrorNetworkInterfaceNotFound")) return NetworkManagerError::NetworkManagerErrorNetworkInterfaceNotFound;
    if (token == QStringLiteral("NetworkManagerErrorInvalidNetworkDeviceType")) return NetworkManagerError::NetworkManagerErrorInvalidNetworkDeviceType;
    if (token == QStringLiteral("NetworkManagerErrorWirelessNetworkingDisabled")) return NetworkManagerError::NetworkManagerErrorWirelessNetworkingDisabled;
    if (token == QStringLiteral("NetworkManagerErrorWirelessConnectionFailed")) return NetworkManagerError::NetworkManagerErrorWirelessConnectionFailed;
    if (token == QStringLiteral("NetworkManagerErrorNetworkingDisabled")) return NetworkManagerError::NetworkManagerErrorNetworkingDisabled;
    if (token == QStringLiteral("NetworkManagerErrorNetworkManagerNotAvailable")) return NetworkManagerError::NetworkManagerErrorNetworkManagerNotAvailable;
    if (token == QStringLiteral("NetworkManagerErrorInvalidConfiguration")) return NetworkManagerError::NetworkManagerErrorInvalidConfiguration;
    if (token == QStringLiteral("NetworkManagerErrorUnsupportedFeature")) return NetworkManagerError::NetworkManagerErrorUnsupportedFeature;
    return NetworkManagerError::NetworkManagerErrorNoError;
}

QString toString(NetworkManagerState value) {
    switch (value) {
    case NetworkManagerState::NetworkManagerStateUnknown: return QStringLiteral("NetworkManagerStateUnknown");
    case NetworkManagerState::NetworkManagerStateAsleep: return QStringLiteral("NetworkManagerStateAsleep");
    case NetworkManagerState::NetworkManagerStateDisconnected: return QStringLiteral("NetworkManagerStateDisconnected");
    case NetworkManagerState::NetworkManagerStateDisconnecting: return QStringLiteral("NetworkManagerStateDisconnecting");
    case NetworkManagerState::NetworkManagerStateConnecting: return QStringLiteral("NetworkManagerStateConnecting");
    case NetworkManagerState::NetworkManagerStateConnectedLocal: return QStringLiteral("NetworkManagerStateConnectedLocal");
    case NetworkManagerState::NetworkManagerStateConnectedSite: return QStringLiteral("NetworkManagerStateConnectedSite");
    case NetworkManagerState::NetworkManagerStateConnectedGlobal: return QStringLiteral("NetworkManagerStateConnectedGlobal");
    }
    return QStringLiteral("NetworkManagerStateUnknown");
}

NetworkManagerState parseNetworkManagerState(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("NetworkManagerStateUnknown")) return NetworkManagerState::NetworkManagerStateUnknown;
    if (token == QStringLiteral("NetworkManagerStateAsleep")) return NetworkManagerState::NetworkManagerStateAsleep;
    if (token == QStringLiteral("NetworkManagerStateDisconnected")) return NetworkManagerState::NetworkManagerStateDisconnected;
    if (token == QStringLiteral("NetworkManagerStateDisconnecting")) return NetworkManagerState::NetworkManagerStateDisconnecting;
    if (token == QStringLiteral("NetworkManagerStateConnecting")) return NetworkManagerState::NetworkManagerStateConnecting;
    if (token == QStringLiteral("NetworkManagerStateConnectedLocal")) return NetworkManagerState::NetworkManagerStateConnectedLocal;
    if (token == QStringLiteral("NetworkManagerStateConnectedSite")) return NetworkManagerState::NetworkManagerStateConnectedSite;
    if (token == QStringLiteral("NetworkManagerStateConnectedGlobal")) return NetworkManagerState::NetworkManagerStateConnectedGlobal;
    return NetworkManagerState::NetworkManagerStateUnknown;
}

QString toString(PermissionScope value) {
    switch (value) {
    case PermissionScope::PermissionScopeNone: return QStringLiteral("PermissionScopeNone");
    case PermissionScope::PermissionScopeControlThings: return QStringLiteral("PermissionScopeControlThings");
    case PermissionScope::PermissionScopeConfigureThings: return QStringLiteral("PermissionScopeConfigureThings");
    case PermissionScope::PermissionScopeAccessAllThings: return QStringLiteral("PermissionScopeAccessAllThings");
    case PermissionScope::PermissionScopeExecuteRules: return QStringLiteral("PermissionScopeExecuteRules");
    case PermissionScope::PermissionScopeConfigureRules: return QStringLiteral("PermissionScopeConfigureRules");
    case PermissionScope::PermissionScopeAdmin: return QStringLiteral("PermissionScopeAdmin");
    }
    return QStringLiteral("PermissionScopeNone");
}

PermissionScope parsePermissionScope(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("PermissionScopeNone")) return PermissionScope::PermissionScopeNone;
    if (token == QStringLiteral("PermissionScopeControlThings")) return PermissionScope::PermissionScopeControlThings;
    if (token == QStringLiteral("PermissionScopeConfigureThings")) return PermissionScope::PermissionScopeConfigureThings;
    if (token == QStringLiteral("PermissionScopeAccessAllThings")) return PermissionScope::PermissionScopeAccessAllThings;
    if (token == QStringLiteral("PermissionScopeExecuteRules")) return PermissionScope::PermissionScopeExecuteRules;
    if (token == QStringLiteral("PermissionScopeConfigureRules")) return PermissionScope::PermissionScopeConfigureRules;
    if (token == QStringLiteral("PermissionScopeAdmin")) return PermissionScope::PermissionScopeAdmin;
    return PermissionScope::PermissionScopeNone;
}

QString toString(RepeatingMode value) {
    switch (value) {
    case RepeatingMode::RepeatingModeNone: return QStringLiteral("RepeatingModeNone");
    case RepeatingMode::RepeatingModeHourly: return QStringLiteral("RepeatingModeHourly");
    case RepeatingMode::RepeatingModeDaily: return QStringLiteral("RepeatingModeDaily");
    case RepeatingMode::RepeatingModeWeekly: return QStringLiteral("RepeatingModeWeekly");
    case RepeatingMode::RepeatingModeMonthly: return QStringLiteral("RepeatingModeMonthly");
    case RepeatingMode::RepeatingModeYearly: return QStringLiteral("RepeatingModeYearly");
    }
    return QStringLiteral("RepeatingModeNone");
}

RepeatingMode parseRepeatingMode(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("RepeatingModeNone")) return RepeatingMode::RepeatingModeNone;
    if (token == QStringLiteral("RepeatingModeHourly")) return RepeatingMode::RepeatingModeHourly;
    if (token == QStringLiteral("RepeatingModeDaily")) return RepeatingMode::RepeatingModeDaily;
    if (token == QStringLiteral("RepeatingModeWeekly")) return RepeatingMode::RepeatingModeWeekly;
    if (token == QStringLiteral("RepeatingModeMonthly")) return RepeatingMode::RepeatingModeMonthly;
    if (token == QStringLiteral("RepeatingModeYearly")) return RepeatingMode::RepeatingModeYearly;
    return RepeatingMode::RepeatingModeNone;
}

QString toString(RuleError value) {
    switch (value) {
    case RuleError::RuleErrorNoError: return QStringLiteral("RuleErrorNoError");
    case RuleError::RuleErrorInvalidRuleId: return QStringLiteral("RuleErrorInvalidRuleId");
    case RuleError::RuleErrorRuleNotFound: return QStringLiteral("RuleErrorRuleNotFound");
    case RuleError::RuleErrorThingNotFound: return QStringLiteral("RuleErrorThingNotFound");
    case RuleError::RuleErrorEventTypeNotFound: return QStringLiteral("RuleErrorEventTypeNotFound");
    case RuleError::RuleErrorStateTypeNotFound: return QStringLiteral("RuleErrorStateTypeNotFound");
    case RuleError::RuleErrorActionTypeNotFound: return QStringLiteral("RuleErrorActionTypeNotFound");
    case RuleError::RuleErrorInvalidParameter: return QStringLiteral("RuleErrorInvalidParameter");
    case RuleError::RuleErrorInvalidRuleFormat: return QStringLiteral("RuleErrorInvalidRuleFormat");
    case RuleError::RuleErrorMissingParameter: return QStringLiteral("RuleErrorMissingParameter");
    case RuleError::RuleErrorInvalidRuleActionParameter: return QStringLiteral("RuleErrorInvalidRuleActionParameter");
    case RuleError::RuleErrorInvalidStateEvaluatorValue: return QStringLiteral("RuleErrorInvalidStateEvaluatorValue");
    case RuleError::RuleErrorTypesNotMatching: return QStringLiteral("RuleErrorTypesNotMatching");
    case RuleError::RuleErrorNotExecutable: return QStringLiteral("RuleErrorNotExecutable");
    case RuleError::RuleErrorInvalidTimeDescriptor: return QStringLiteral("RuleErrorInvalidTimeDescriptor");
    case RuleError::RuleErrorInvalidRepeatingOption: return QStringLiteral("RuleErrorInvalidRepeatingOption");
    case RuleError::RuleErrorInvalidCalendarItem: return QStringLiteral("RuleErrorInvalidCalendarItem");
    case RuleError::RuleErrorInvalidTimeEventItem: return QStringLiteral("RuleErrorInvalidTimeEventItem");
    case RuleError::RuleErrorContainsEventBasesAction: return QStringLiteral("RuleErrorContainsEventBasesAction");
    case RuleError::RuleErrorNoExitActions: return QStringLiteral("RuleErrorNoExitActions");
    case RuleError::RuleErrorInterfaceNotFound: return QStringLiteral("RuleErrorInterfaceNotFound");
    }
    return QStringLiteral("RuleErrorNoError");
}

RuleError parseRuleError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("RuleErrorNoError")) return RuleError::RuleErrorNoError;
    if (token == QStringLiteral("RuleErrorInvalidRuleId")) return RuleError::RuleErrorInvalidRuleId;
    if (token == QStringLiteral("RuleErrorRuleNotFound")) return RuleError::RuleErrorRuleNotFound;
    if (token == QStringLiteral("RuleErrorThingNotFound")) return RuleError::RuleErrorThingNotFound;
    if (token == QStringLiteral("RuleErrorEventTypeNotFound")) return RuleError::RuleErrorEventTypeNotFound;
    if (token == QStringLiteral("RuleErrorStateTypeNotFound")) return RuleError::RuleErrorStateTypeNotFound;
    if (token == QStringLiteral("RuleErrorActionTypeNotFound")) return RuleError::RuleErrorActionTypeNotFound;
    if (token == QStringLiteral("RuleErrorInvalidParameter")) return RuleError::RuleErrorInvalidParameter;
    if (token == QStringLiteral("RuleErrorInvalidRuleFormat")) return RuleError::RuleErrorInvalidRuleFormat;
    if (token == QStringLiteral("RuleErrorMissingParameter")) return RuleError::RuleErrorMissingParameter;
    if (token == QStringLiteral("RuleErrorInvalidRuleActionParameter")) return RuleError::RuleErrorInvalidRuleActionParameter;
    if (token == QStringLiteral("RuleErrorInvalidStateEvaluatorValue")) return RuleError::RuleErrorInvalidStateEvaluatorValue;
    if (token == QStringLiteral("RuleErrorTypesNotMatching")) return RuleError::RuleErrorTypesNotMatching;
    if (token == QStringLiteral("RuleErrorNotExecutable")) return RuleError::RuleErrorNotExecutable;
    if (token == QStringLiteral("RuleErrorInvalidTimeDescriptor")) return RuleError::RuleErrorInvalidTimeDescriptor;
    if (token == QStringLiteral("RuleErrorInvalidRepeatingOption")) return RuleError::RuleErrorInvalidRepeatingOption;
    if (token == QStringLiteral("RuleErrorInvalidCalendarItem")) return RuleError::RuleErrorInvalidCalendarItem;
    if (token == QStringLiteral("RuleErrorInvalidTimeEventItem")) return RuleError::RuleErrorInvalidTimeEventItem;
    if (token == QStringLiteral("RuleErrorContainsEventBasesAction")) return RuleError::RuleErrorContainsEventBasesAction;
    if (token == QStringLiteral("RuleErrorNoExitActions")) return RuleError::RuleErrorNoExitActions;
    if (token == QStringLiteral("RuleErrorInterfaceNotFound")) return RuleError::RuleErrorInterfaceNotFound;
    return RuleError::RuleErrorNoError;
}

QString toString(SampleRate value) {
    switch (value) {
    case SampleRate::SampleRateAny: return QStringLiteral("SampleRateAny");
    case SampleRate::SampleRate1Min: return QStringLiteral("SampleRate1Min");
    case SampleRate::SampleRate15Mins: return QStringLiteral("SampleRate15Mins");
    case SampleRate::SampleRate1Hour: return QStringLiteral("SampleRate1Hour");
    case SampleRate::SampleRate3Hours: return QStringLiteral("SampleRate3Hours");
    case SampleRate::SampleRate1Day: return QStringLiteral("SampleRate1Day");
    case SampleRate::SampleRate1Week: return QStringLiteral("SampleRate1Week");
    case SampleRate::SampleRate1Month: return QStringLiteral("SampleRate1Month");
    case SampleRate::SampleRate1Year: return QStringLiteral("SampleRate1Year");
    }
    return QStringLiteral("SampleRateAny");
}

SampleRate parseSampleRate(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("SampleRateAny")) return SampleRate::SampleRateAny;
    if (token == QStringLiteral("SampleRate1Min")) return SampleRate::SampleRate1Min;
    if (token == QStringLiteral("SampleRate15Mins")) return SampleRate::SampleRate15Mins;
    if (token == QStringLiteral("SampleRate1Hour")) return SampleRate::SampleRate1Hour;
    if (token == QStringLiteral("SampleRate3Hours")) return SampleRate::SampleRate3Hours;
    if (token == QStringLiteral("SampleRate1Day")) return SampleRate::SampleRate1Day;
    if (token == QStringLiteral("SampleRate1Week")) return SampleRate::SampleRate1Week;
    if (token == QStringLiteral("SampleRate1Month")) return SampleRate::SampleRate1Month;
    if (token == QStringLiteral("SampleRate1Year")) return SampleRate::SampleRate1Year;
    return SampleRate::SampleRateAny;
}

QString toString(ScriptError value) {
    switch (value) {
    case ScriptError::ScriptErrorNoError: return QStringLiteral("ScriptErrorNoError");
    case ScriptError::ScriptErrorScriptNotFound: return QStringLiteral("ScriptErrorScriptNotFound");
    case ScriptError::ScriptErrorInvalidScript: return QStringLiteral("ScriptErrorInvalidScript");
    case ScriptError::ScriptErrorHardwareFailure: return QStringLiteral("ScriptErrorHardwareFailure");
    }
    return QStringLiteral("ScriptErrorNoError");
}

ScriptError parseScriptError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ScriptErrorNoError")) return ScriptError::ScriptErrorNoError;
    if (token == QStringLiteral("ScriptErrorScriptNotFound")) return ScriptError::ScriptErrorScriptNotFound;
    if (token == QStringLiteral("ScriptErrorInvalidScript")) return ScriptError::ScriptErrorInvalidScript;
    if (token == QStringLiteral("ScriptErrorHardwareFailure")) return ScriptError::ScriptErrorHardwareFailure;
    return ScriptError::ScriptErrorNoError;
}

QString toString(ScriptMessageType value) {
    switch (value) {
    case ScriptMessageType::ScriptMessageTypeLog: return QStringLiteral("ScriptMessageTypeLog");
    case ScriptMessageType::ScriptMessageTypeWarning: return QStringLiteral("ScriptMessageTypeWarning");
    }
    return QStringLiteral("ScriptMessageTypeLog");
}

ScriptMessageType parseScriptMessageType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ScriptMessageTypeLog")) return ScriptMessageType::ScriptMessageTypeLog;
    if (token == QStringLiteral("ScriptMessageTypeWarning")) return ScriptMessageType::ScriptMessageTypeWarning;
    return ScriptMessageType::ScriptMessageTypeLog;
}

QString toString(SerialPortDataBits value) {
    switch (value) {
    case SerialPortDataBits::SerialPortDataBitsData5: return QStringLiteral("SerialPortDataBitsData5");
    case SerialPortDataBits::SerialPortDataBitsData6: return QStringLiteral("SerialPortDataBitsData6");
    case SerialPortDataBits::SerialPortDataBitsData7: return QStringLiteral("SerialPortDataBitsData7");
    case SerialPortDataBits::SerialPortDataBitsData8: return QStringLiteral("SerialPortDataBitsData8");
    case SerialPortDataBits::SerialPortDataBitsUnknownDataBits: return QStringLiteral("SerialPortDataBitsUnknownDataBits");
    }
    return QStringLiteral("SerialPortDataBitsData5");
}

SerialPortDataBits parseSerialPortDataBits(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("SerialPortDataBitsData5")) return SerialPortDataBits::SerialPortDataBitsData5;
    if (token == QStringLiteral("SerialPortDataBitsData6")) return SerialPortDataBits::SerialPortDataBitsData6;
    if (token == QStringLiteral("SerialPortDataBitsData7")) return SerialPortDataBits::SerialPortDataBitsData7;
    if (token == QStringLiteral("SerialPortDataBitsData8")) return SerialPortDataBits::SerialPortDataBitsData8;
    if (token == QStringLiteral("SerialPortDataBitsUnknownDataBits")) return SerialPortDataBits::SerialPortDataBitsUnknownDataBits;
    return SerialPortDataBits::SerialPortDataBitsData5;
}

QString toString(SerialPortParity value) {
    switch (value) {
    case SerialPortParity::SerialPortParityNoParity: return QStringLiteral("SerialPortParityNoParity");
    case SerialPortParity::SerialPortParityEvenParity: return QStringLiteral("SerialPortParityEvenParity");
    case SerialPortParity::SerialPortParityOddParity: return QStringLiteral("SerialPortParityOddParity");
    case SerialPortParity::SerialPortParitySpaceParity: return QStringLiteral("SerialPortParitySpaceParity");
    case SerialPortParity::SerialPortParityMarkParity: return QStringLiteral("SerialPortParityMarkParity");
    case SerialPortParity::SerialPortParityUnknownParity: return QStringLiteral("SerialPortParityUnknownParity");
    }
    return QStringLiteral("SerialPortParityNoParity");
}

SerialPortParity parseSerialPortParity(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("SerialPortParityNoParity")) return SerialPortParity::SerialPortParityNoParity;
    if (token == QStringLiteral("SerialPortParityEvenParity")) return SerialPortParity::SerialPortParityEvenParity;
    if (token == QStringLiteral("SerialPortParityOddParity")) return SerialPortParity::SerialPortParityOddParity;
    if (token == QStringLiteral("SerialPortParitySpaceParity")) return SerialPortParity::SerialPortParitySpaceParity;
    if (token == QStringLiteral("SerialPortParityMarkParity")) return SerialPortParity::SerialPortParityMarkParity;
    if (token == QStringLiteral("SerialPortParityUnknownParity")) return SerialPortParity::SerialPortParityUnknownParity;
    return SerialPortParity::SerialPortParityNoParity;
}

QString toString(SerialPortStopBits value) {
    switch (value) {
    case SerialPortStopBits::SerialPortStopBitsOneStop: return QStringLiteral("SerialPortStopBitsOneStop");
    case SerialPortStopBits::SerialPortStopBitsOneAndHalfStop: return QStringLiteral("SerialPortStopBitsOneAndHalfStop");
    case SerialPortStopBits::SerialPortStopBitsTwoStop: return QStringLiteral("SerialPortStopBitsTwoStop");
    case SerialPortStopBits::SerialPortStopBitsUnknownStopBits: return QStringLiteral("SerialPortStopBitsUnknownStopBits");
    }
    return QStringLiteral("SerialPortStopBitsOneStop");
}

SerialPortStopBits parseSerialPortStopBits(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("SerialPortStopBitsOneStop")) return SerialPortStopBits::SerialPortStopBitsOneStop;
    if (token == QStringLiteral("SerialPortStopBitsOneAndHalfStop")) return SerialPortStopBits::SerialPortStopBitsOneAndHalfStop;
    if (token == QStringLiteral("SerialPortStopBitsTwoStop")) return SerialPortStopBits::SerialPortStopBitsTwoStop;
    if (token == QStringLiteral("SerialPortStopBitsUnknownStopBits")) return SerialPortStopBits::SerialPortStopBitsUnknownStopBits;
    return SerialPortStopBits::SerialPortStopBitsOneStop;
}

QString toString(SetupMethod value) {
    switch (value) {
    case SetupMethod::SetupMethodJustAdd: return QStringLiteral("SetupMethodJustAdd");
    case SetupMethod::SetupMethodDisplayPin: return QStringLiteral("SetupMethodDisplayPin");
    case SetupMethod::SetupMethodEnterPin: return QStringLiteral("SetupMethodEnterPin");
    case SetupMethod::SetupMethodPushButton: return QStringLiteral("SetupMethodPushButton");
    case SetupMethod::SetupMethodUserAndPassword: return QStringLiteral("SetupMethodUserAndPassword");
    case SetupMethod::SetupMethodOAuth: return QStringLiteral("SetupMethodOAuth");
    }
    return QStringLiteral("SetupMethodJustAdd");
}

SetupMethod parseSetupMethod(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("SetupMethodJustAdd")) return SetupMethod::SetupMethodJustAdd;
    if (token == QStringLiteral("SetupMethodDisplayPin")) return SetupMethod::SetupMethodDisplayPin;
    if (token == QStringLiteral("SetupMethodEnterPin")) return SetupMethod::SetupMethodEnterPin;
    if (token == QStringLiteral("SetupMethodPushButton")) return SetupMethod::SetupMethodPushButton;
    if (token == QStringLiteral("SetupMethodUserAndPassword")) return SetupMethod::SetupMethodUserAndPassword;
    if (token == QStringLiteral("SetupMethodOAuth")) return SetupMethod::SetupMethodOAuth;
    return SetupMethod::SetupMethodJustAdd;
}

QString toString(SortOrder value) {
    switch (value) {
    case SortOrder::AscendingOrder: return QStringLiteral("AscendingOrder");
    case SortOrder::DescendingOrder: return QStringLiteral("DescendingOrder");
    }
    return QStringLiteral("AscendingOrder");
}

SortOrder parseSortOrder(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("AscendingOrder")) return SortOrder::AscendingOrder;
    if (token == QStringLiteral("DescendingOrder")) return SortOrder::DescendingOrder;
    return SortOrder::AscendingOrder;
}

QString toString(StateOperator value) {
    switch (value) {
    case StateOperator::StateOperatorAnd: return QStringLiteral("StateOperatorAnd");
    case StateOperator::StateOperatorOr: return QStringLiteral("StateOperatorOr");
    }
    return QStringLiteral("StateOperatorAnd");
}

StateOperator parseStateOperator(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("StateOperatorAnd")) return StateOperator::StateOperatorAnd;
    if (token == QStringLiteral("StateOperatorOr")) return StateOperator::StateOperatorOr;
    return StateOperator::StateOperatorAnd;
}

QString toString(StateValueFilter value) {
    switch (value) {
    case StateValueFilter::StateValueFilterNone: return QStringLiteral("StateValueFilterNone");
    case StateValueFilter::StateValueFilterAdaptive: return QStringLiteral("StateValueFilterAdaptive");
    }
    return QStringLiteral("StateValueFilterNone");
}

StateValueFilter parseStateValueFilter(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("StateValueFilterNone")) return StateValueFilter::StateValueFilterNone;
    if (token == QStringLiteral("StateValueFilterAdaptive")) return StateValueFilter::StateValueFilterAdaptive;
    return StateValueFilter::StateValueFilterNone;
}

QString toString(TagError value) {
    switch (value) {
    case TagError::TagErrorNoError: return QStringLiteral("TagErrorNoError");
    case TagError::TagErrorThingNotFound: return QStringLiteral("TagErrorThingNotFound");
    case TagError::TagErrorRuleNotFound: return QStringLiteral("TagErrorRuleNotFound");
    case TagError::TagErrorTagNotFound: return QStringLiteral("TagErrorTagNotFound");
    }
    return QStringLiteral("TagErrorNoError");
}

TagError parseTagError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("TagErrorNoError")) return TagError::TagErrorNoError;
    if (token == QStringLiteral("TagErrorThingNotFound")) return TagError::TagErrorThingNotFound;
    if (token == QStringLiteral("TagErrorRuleNotFound")) return TagError::TagErrorRuleNotFound;
    if (token == QStringLiteral("TagErrorTagNotFound")) return TagError::TagErrorTagNotFound;
    return TagError::TagErrorNoError;
}

QString toString(ThingError value) {
    switch (value) {
    case ThingError::ThingErrorNoError: return QStringLiteral("ThingErrorNoError");
    case ThingError::ThingErrorPluginNotFound: return QStringLiteral("ThingErrorPluginNotFound");
    case ThingError::ThingErrorVendorNotFound: return QStringLiteral("ThingErrorVendorNotFound");
    case ThingError::ThingErrorThingNotFound: return QStringLiteral("ThingErrorThingNotFound");
    case ThingError::ThingErrorThingClassNotFound: return QStringLiteral("ThingErrorThingClassNotFound");
    case ThingError::ThingErrorActionTypeNotFound: return QStringLiteral("ThingErrorActionTypeNotFound");
    case ThingError::ThingErrorStateTypeNotFound: return QStringLiteral("ThingErrorStateTypeNotFound");
    case ThingError::ThingErrorEventTypeNotFound: return QStringLiteral("ThingErrorEventTypeNotFound");
    case ThingError::ThingErrorThingDescriptorNotFound: return QStringLiteral("ThingErrorThingDescriptorNotFound");
    case ThingError::ThingErrorMissingParameter: return QStringLiteral("ThingErrorMissingParameter");
    case ThingError::ThingErrorInvalidParameter: return QStringLiteral("ThingErrorInvalidParameter");
    case ThingError::ThingErrorSetupFailed: return QStringLiteral("ThingErrorSetupFailed");
    case ThingError::ThingErrorDuplicateUuid: return QStringLiteral("ThingErrorDuplicateUuid");
    case ThingError::ThingErrorCreationMethodNotSupported: return QStringLiteral("ThingErrorCreationMethodNotSupported");
    case ThingError::ThingErrorSetupMethodNotSupported: return QStringLiteral("ThingErrorSetupMethodNotSupported");
    case ThingError::ThingErrorHardwareNotAvailable: return QStringLiteral("ThingErrorHardwareNotAvailable");
    case ThingError::ThingErrorHardwareFailure: return QStringLiteral("ThingErrorHardwareFailure");
    case ThingError::ThingErrorAuthenticationFailure: return QStringLiteral("ThingErrorAuthenticationFailure");
    case ThingError::ThingErrorThingInUse: return QStringLiteral("ThingErrorThingInUse");
    case ThingError::ThingErrorThingInRule: return QStringLiteral("ThingErrorThingInRule");
    case ThingError::ThingErrorThingIsChild: return QStringLiteral("ThingErrorThingIsChild");
    case ThingError::ThingErrorPairingTransactionIdNotFound: return QStringLiteral("ThingErrorPairingTransactionIdNotFound");
    case ThingError::ThingErrorParameterNotWritable: return QStringLiteral("ThingErrorParameterNotWritable");
    case ThingError::ThingErrorItemNotFound: return QStringLiteral("ThingErrorItemNotFound");
    case ThingError::ThingErrorItemNotExecutable: return QStringLiteral("ThingErrorItemNotExecutable");
    case ThingError::ThingErrorUnsupportedFeature: return QStringLiteral("ThingErrorUnsupportedFeature");
    case ThingError::ThingErrorTimeout: return QStringLiteral("ThingErrorTimeout");
    }
    return QStringLiteral("ThingErrorNoError");
}

ThingError parseThingError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ThingErrorNoError")) return ThingError::ThingErrorNoError;
    if (token == QStringLiteral("ThingErrorPluginNotFound")) return ThingError::ThingErrorPluginNotFound;
    if (token == QStringLiteral("ThingErrorVendorNotFound")) return ThingError::ThingErrorVendorNotFound;
    if (token == QStringLiteral("ThingErrorThingNotFound")) return ThingError::ThingErrorThingNotFound;
    if (token == QStringLiteral("ThingErrorThingClassNotFound")) return ThingError::ThingErrorThingClassNotFound;
    if (token == QStringLiteral("ThingErrorActionTypeNotFound")) return ThingError::ThingErrorActionTypeNotFound;
    if (token == QStringLiteral("ThingErrorStateTypeNotFound")) return ThingError::ThingErrorStateTypeNotFound;
    if (token == QStringLiteral("ThingErrorEventTypeNotFound")) return ThingError::ThingErrorEventTypeNotFound;
    if (token == QStringLiteral("ThingErrorThingDescriptorNotFound")) return ThingError::ThingErrorThingDescriptorNotFound;
    if (token == QStringLiteral("ThingErrorMissingParameter")) return ThingError::ThingErrorMissingParameter;
    if (token == QStringLiteral("ThingErrorInvalidParameter")) return ThingError::ThingErrorInvalidParameter;
    if (token == QStringLiteral("ThingErrorSetupFailed")) return ThingError::ThingErrorSetupFailed;
    if (token == QStringLiteral("ThingErrorDuplicateUuid")) return ThingError::ThingErrorDuplicateUuid;
    if (token == QStringLiteral("ThingErrorCreationMethodNotSupported")) return ThingError::ThingErrorCreationMethodNotSupported;
    if (token == QStringLiteral("ThingErrorSetupMethodNotSupported")) return ThingError::ThingErrorSetupMethodNotSupported;
    if (token == QStringLiteral("ThingErrorHardwareNotAvailable")) return ThingError::ThingErrorHardwareNotAvailable;
    if (token == QStringLiteral("ThingErrorHardwareFailure")) return ThingError::ThingErrorHardwareFailure;
    if (token == QStringLiteral("ThingErrorAuthenticationFailure")) return ThingError::ThingErrorAuthenticationFailure;
    if (token == QStringLiteral("ThingErrorThingInUse")) return ThingError::ThingErrorThingInUse;
    if (token == QStringLiteral("ThingErrorThingInRule")) return ThingError::ThingErrorThingInRule;
    if (token == QStringLiteral("ThingErrorThingIsChild")) return ThingError::ThingErrorThingIsChild;
    if (token == QStringLiteral("ThingErrorPairingTransactionIdNotFound")) return ThingError::ThingErrorPairingTransactionIdNotFound;
    if (token == QStringLiteral("ThingErrorParameterNotWritable")) return ThingError::ThingErrorParameterNotWritable;
    if (token == QStringLiteral("ThingErrorItemNotFound")) return ThingError::ThingErrorItemNotFound;
    if (token == QStringLiteral("ThingErrorItemNotExecutable")) return ThingError::ThingErrorItemNotExecutable;
    if (token == QStringLiteral("ThingErrorUnsupportedFeature")) return ThingError::ThingErrorUnsupportedFeature;
    if (token == QStringLiteral("ThingErrorTimeout")) return ThingError::ThingErrorTimeout;
    return ThingError::ThingErrorNoError;
}

QString toString(ThingSetupStatus value) {
    switch (value) {
    case ThingSetupStatus::ThingSetupStatusNone: return QStringLiteral("ThingSetupStatusNone");
    case ThingSetupStatus::ThingSetupStatusInProgress: return QStringLiteral("ThingSetupStatusInProgress");
    case ThingSetupStatus::ThingSetupStatusComplete: return QStringLiteral("ThingSetupStatusComplete");
    case ThingSetupStatus::ThingSetupStatusFailed: return QStringLiteral("ThingSetupStatusFailed");
    }
    return QStringLiteral("ThingSetupStatusNone");
}

ThingSetupStatus parseThingSetupStatus(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ThingSetupStatusNone")) return ThingSetupStatus::ThingSetupStatusNone;
    if (token == QStringLiteral("ThingSetupStatusInProgress")) return ThingSetupStatus::ThingSetupStatusInProgress;
    if (token == QStringLiteral("ThingSetupStatusComplete")) return ThingSetupStatus::ThingSetupStatusComplete;
    if (token == QStringLiteral("ThingSetupStatusFailed")) return ThingSetupStatus::ThingSetupStatusFailed;
    return ThingSetupStatus::ThingSetupStatusNone;
}

QString toString(Unit value) {
    switch (value) {
    case Unit::UnitNone: return QStringLiteral("UnitNone");
    case Unit::UnitMilliSeconds: return QStringLiteral("UnitMilliSeconds");
    case Unit::UnitSeconds: return QStringLiteral("UnitSeconds");
    case Unit::UnitMinutes: return QStringLiteral("UnitMinutes");
    case Unit::UnitHours: return QStringLiteral("UnitHours");
    case Unit::UnitUnixTime: return QStringLiteral("UnitUnixTime");
    case Unit::UnitMeterPerSecond: return QStringLiteral("UnitMeterPerSecond");
    case Unit::UnitKiloMeterPerHour: return QStringLiteral("UnitKiloMeterPerHour");
    case Unit::UnitDegree: return QStringLiteral("UnitDegree");
    case Unit::UnitRadiant: return QStringLiteral("UnitRadiant");
    case Unit::UnitDegreeCelsius: return QStringLiteral("UnitDegreeCelsius");
    case Unit::UnitDegreeKelvin: return QStringLiteral("UnitDegreeKelvin");
    case Unit::UnitMired: return QStringLiteral("UnitMired");
    case Unit::UnitMilliBar: return QStringLiteral("UnitMilliBar");
    case Unit::UnitBar: return QStringLiteral("UnitBar");
    case Unit::UnitPascal: return QStringLiteral("UnitPascal");
    case Unit::UnitHectoPascal: return QStringLiteral("UnitHectoPascal");
    case Unit::UnitAtmosphere: return QStringLiteral("UnitAtmosphere");
    case Unit::UnitLumen: return QStringLiteral("UnitLumen");
    case Unit::UnitLux: return QStringLiteral("UnitLux");
    case Unit::UnitCandela: return QStringLiteral("UnitCandela");
    case Unit::UnitMilliMeter: return QStringLiteral("UnitMilliMeter");
    case Unit::UnitCentiMeter: return QStringLiteral("UnitCentiMeter");
    case Unit::UnitMeter: return QStringLiteral("UnitMeter");
    case Unit::UnitKiloMeter: return QStringLiteral("UnitKiloMeter");
    case Unit::UnitGram: return QStringLiteral("UnitGram");
    case Unit::UnitKiloGram: return QStringLiteral("UnitKiloGram");
    case Unit::UnitDezibel: return QStringLiteral("UnitDezibel");
    case Unit::UnitBpm: return QStringLiteral("UnitBpm");
    case Unit::UnitKiloByte: return QStringLiteral("UnitKiloByte");
    case Unit::UnitMegaByte: return QStringLiteral("UnitMegaByte");
    case Unit::UnitGigaByte: return QStringLiteral("UnitGigaByte");
    case Unit::UnitTeraByte: return QStringLiteral("UnitTeraByte");
    case Unit::UnitMilliWatt: return QStringLiteral("UnitMilliWatt");
    case Unit::UnitWatt: return QStringLiteral("UnitWatt");
    case Unit::UnitKiloWatt: return QStringLiteral("UnitKiloWatt");
    case Unit::UnitKiloWattHour: return QStringLiteral("UnitKiloWattHour");
    case Unit::UnitEuroPerMegaWattHour: return QStringLiteral("UnitEuroPerMegaWattHour");
    case Unit::UnitEuroCentPerKiloWattHour: return QStringLiteral("UnitEuroCentPerKiloWattHour");
    case Unit::UnitPercentage: return QStringLiteral("UnitPercentage");
    case Unit::UnitPartsPerMillion: return QStringLiteral("UnitPartsPerMillion");
    case Unit::UnitPartsPerBillion: return QStringLiteral("UnitPartsPerBillion");
    case Unit::UnitEuro: return QStringLiteral("UnitEuro");
    case Unit::UnitDollar: return QStringLiteral("UnitDollar");
    case Unit::UnitHertz: return QStringLiteral("UnitHertz");
    case Unit::UnitAmpere: return QStringLiteral("UnitAmpere");
    case Unit::UnitMilliAmpere: return QStringLiteral("UnitMilliAmpere");
    case Unit::UnitVolt: return QStringLiteral("UnitVolt");
    case Unit::UnitMilliVolt: return QStringLiteral("UnitMilliVolt");
    case Unit::UnitVoltAmpere: return QStringLiteral("UnitVoltAmpere");
    case Unit::UnitVoltAmpereReactive: return QStringLiteral("UnitVoltAmpereReactive");
    case Unit::UnitAmpereHour: return QStringLiteral("UnitAmpereHour");
    case Unit::UnitOhm: return QStringLiteral("UnitOhm");
    case Unit::UnitMicroSiemensPerCentimeter: return QStringLiteral("UnitMicroSiemensPerCentimeter");
    case Unit::UnitDuration: return QStringLiteral("UnitDuration");
    case Unit::UnitNewton: return QStringLiteral("UnitNewton");
    case Unit::UnitNewtonMeter: return QStringLiteral("UnitNewtonMeter");
    case Unit::UnitRpm: return QStringLiteral("UnitRpm");
    case Unit::UnitMilligramPerLiter: return QStringLiteral("UnitMilligramPerLiter");
    case Unit::UnitLiter: return QStringLiteral("UnitLiter");
    case Unit::UnitMicroGrammPerCubicalMeter: return QStringLiteral("UnitMicroGrammPerCubicalMeter");
    }
    return QStringLiteral("UnitNone");
}

Unit parseUnit(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("UnitNone")) return Unit::UnitNone;
    if (token == QStringLiteral("UnitMilliSeconds")) return Unit::UnitMilliSeconds;
    if (token == QStringLiteral("UnitSeconds")) return Unit::UnitSeconds;
    if (token == QStringLiteral("UnitMinutes")) return Unit::UnitMinutes;
    if (token == QStringLiteral("UnitHours")) return Unit::UnitHours;
    if (token == QStringLiteral("UnitUnixTime")) return Unit::UnitUnixTime;
    if (token == QStringLiteral("UnitMeterPerSecond")) return Unit::UnitMeterPerSecond;
    if (token == QStringLiteral("UnitKiloMeterPerHour")) return Unit::UnitKiloMeterPerHour;
    if (token == QStringLiteral("UnitDegree")) return Unit::UnitDegree;
    if (token == QStringLiteral("UnitRadiant")) return Unit::UnitRadiant;
    if (token == QStringLiteral("UnitDegreeCelsius")) return Unit::UnitDegreeCelsius;
    if (token == QStringLiteral("UnitDegreeKelvin")) return Unit::UnitDegreeKelvin;
    if (token == QStringLiteral("UnitMired")) return Unit::UnitMired;
    if (token == QStringLiteral("UnitMilliBar")) return Unit::UnitMilliBar;
    if (token == QStringLiteral("UnitBar")) return Unit::UnitBar;
    if (token == QStringLiteral("UnitPascal")) return Unit::UnitPascal;
    if (token == QStringLiteral("UnitHectoPascal")) return Unit::UnitHectoPascal;
    if (token == QStringLiteral("UnitAtmosphere")) return Unit::UnitAtmosphere;
    if (token == QStringLiteral("UnitLumen")) return Unit::UnitLumen;
    if (token == QStringLiteral("UnitLux")) return Unit::UnitLux;
    if (token == QStringLiteral("UnitCandela")) return Unit::UnitCandela;
    if (token == QStringLiteral("UnitMilliMeter")) return Unit::UnitMilliMeter;
    if (token == QStringLiteral("UnitCentiMeter")) return Unit::UnitCentiMeter;
    if (token == QStringLiteral("UnitMeter")) return Unit::UnitMeter;
    if (token == QStringLiteral("UnitKiloMeter")) return Unit::UnitKiloMeter;
    if (token == QStringLiteral("UnitGram")) return Unit::UnitGram;
    if (token == QStringLiteral("UnitKiloGram")) return Unit::UnitKiloGram;
    if (token == QStringLiteral("UnitDezibel")) return Unit::UnitDezibel;
    if (token == QStringLiteral("UnitBpm")) return Unit::UnitBpm;
    if (token == QStringLiteral("UnitKiloByte")) return Unit::UnitKiloByte;
    if (token == QStringLiteral("UnitMegaByte")) return Unit::UnitMegaByte;
    if (token == QStringLiteral("UnitGigaByte")) return Unit::UnitGigaByte;
    if (token == QStringLiteral("UnitTeraByte")) return Unit::UnitTeraByte;
    if (token == QStringLiteral("UnitMilliWatt")) return Unit::UnitMilliWatt;
    if (token == QStringLiteral("UnitWatt")) return Unit::UnitWatt;
    if (token == QStringLiteral("UnitKiloWatt")) return Unit::UnitKiloWatt;
    if (token == QStringLiteral("UnitKiloWattHour")) return Unit::UnitKiloWattHour;
    if (token == QStringLiteral("UnitEuroPerMegaWattHour")) return Unit::UnitEuroPerMegaWattHour;
    if (token == QStringLiteral("UnitEuroCentPerKiloWattHour")) return Unit::UnitEuroCentPerKiloWattHour;
    if (token == QStringLiteral("UnitPercentage")) return Unit::UnitPercentage;
    if (token == QStringLiteral("UnitPartsPerMillion")) return Unit::UnitPartsPerMillion;
    if (token == QStringLiteral("UnitPartsPerBillion")) return Unit::UnitPartsPerBillion;
    if (token == QStringLiteral("UnitEuro")) return Unit::UnitEuro;
    if (token == QStringLiteral("UnitDollar")) return Unit::UnitDollar;
    if (token == QStringLiteral("UnitHertz")) return Unit::UnitHertz;
    if (token == QStringLiteral("UnitAmpere")) return Unit::UnitAmpere;
    if (token == QStringLiteral("UnitMilliAmpere")) return Unit::UnitMilliAmpere;
    if (token == QStringLiteral("UnitVolt")) return Unit::UnitVolt;
    if (token == QStringLiteral("UnitMilliVolt")) return Unit::UnitMilliVolt;
    if (token == QStringLiteral("UnitVoltAmpere")) return Unit::UnitVoltAmpere;
    if (token == QStringLiteral("UnitVoltAmpereReactive")) return Unit::UnitVoltAmpereReactive;
    if (token == QStringLiteral("UnitAmpereHour")) return Unit::UnitAmpereHour;
    if (token == QStringLiteral("UnitOhm")) return Unit::UnitOhm;
    if (token == QStringLiteral("UnitMicroSiemensPerCentimeter")) return Unit::UnitMicroSiemensPerCentimeter;
    if (token == QStringLiteral("UnitDuration")) return Unit::UnitDuration;
    if (token == QStringLiteral("UnitNewton")) return Unit::UnitNewton;
    if (token == QStringLiteral("UnitNewtonMeter")) return Unit::UnitNewtonMeter;
    if (token == QStringLiteral("UnitRpm")) return Unit::UnitRpm;
    if (token == QStringLiteral("UnitMilligramPerLiter")) return Unit::UnitMilligramPerLiter;
    if (token == QStringLiteral("UnitLiter")) return Unit::UnitLiter;
    if (token == QStringLiteral("UnitMicroGrammPerCubicalMeter")) return Unit::UnitMicroGrammPerCubicalMeter;
    return Unit::UnitNone;
}

QString toString(UpdateType value) {
    switch (value) {
    case UpdateType::UpdateTypeNone: return QStringLiteral("UpdateTypeNone");
    case UpdateType::UpdateTypeSystem: return QStringLiteral("UpdateTypeSystem");
    case UpdateType::UpdateTypePackageManager: return QStringLiteral("UpdateTypePackageManager");
    }
    return QStringLiteral("UpdateTypeNone");
}

UpdateType parseUpdateType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("UpdateTypeNone")) return UpdateType::UpdateTypeNone;
    if (token == QStringLiteral("UpdateTypeSystem")) return UpdateType::UpdateTypeSystem;
    if (token == QStringLiteral("UpdateTypePackageManager")) return UpdateType::UpdateTypePackageManager;
    return UpdateType::UpdateTypeNone;
}

QString toString(UserError value) {
    switch (value) {
    case UserError::UserErrorNoError: return QStringLiteral("UserErrorNoError");
    case UserError::UserErrorBackendError: return QStringLiteral("UserErrorBackendError");
    case UserError::UserErrorInvalidUserId: return QStringLiteral("UserErrorInvalidUserId");
    case UserError::UserErrorDuplicateUserId: return QStringLiteral("UserErrorDuplicateUserId");
    case UserError::UserErrorBadPassword: return QStringLiteral("UserErrorBadPassword");
    case UserError::UserErrorTokenNotFound: return QStringLiteral("UserErrorTokenNotFound");
    case UserError::UserErrorPermissionDenied: return QStringLiteral("UserErrorPermissionDenied");
    case UserError::UserErrorInconsistantScopes: return QStringLiteral("UserErrorInconsistantScopes");
    }
    return QStringLiteral("UserErrorNoError");
}

UserError parseUserError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("UserErrorNoError")) return UserError::UserErrorNoError;
    if (token == QStringLiteral("UserErrorBackendError")) return UserError::UserErrorBackendError;
    if (token == QStringLiteral("UserErrorInvalidUserId")) return UserError::UserErrorInvalidUserId;
    if (token == QStringLiteral("UserErrorDuplicateUserId")) return UserError::UserErrorDuplicateUserId;
    if (token == QStringLiteral("UserErrorBadPassword")) return UserError::UserErrorBadPassword;
    if (token == QStringLiteral("UserErrorTokenNotFound")) return UserError::UserErrorTokenNotFound;
    if (token == QStringLiteral("UserErrorPermissionDenied")) return UserError::UserErrorPermissionDenied;
    if (token == QStringLiteral("UserErrorInconsistantScopes")) return UserError::UserErrorInconsistantScopes;
    return UserError::UserErrorNoError;
}

QString toString(ValueOperator value) {
    switch (value) {
    case ValueOperator::ValueOperatorEquals: return QStringLiteral("ValueOperatorEquals");
    case ValueOperator::ValueOperatorNotEquals: return QStringLiteral("ValueOperatorNotEquals");
    case ValueOperator::ValueOperatorLess: return QStringLiteral("ValueOperatorLess");
    case ValueOperator::ValueOperatorGreater: return QStringLiteral("ValueOperatorGreater");
    case ValueOperator::ValueOperatorLessOrEqual: return QStringLiteral("ValueOperatorLessOrEqual");
    case ValueOperator::ValueOperatorGreaterOrEqual: return QStringLiteral("ValueOperatorGreaterOrEqual");
    }
    return QStringLiteral("ValueOperatorEquals");
}

ValueOperator parseValueOperator(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ValueOperatorEquals")) return ValueOperator::ValueOperatorEquals;
    if (token == QStringLiteral("ValueOperatorNotEquals")) return ValueOperator::ValueOperatorNotEquals;
    if (token == QStringLiteral("ValueOperatorLess")) return ValueOperator::ValueOperatorLess;
    if (token == QStringLiteral("ValueOperatorGreater")) return ValueOperator::ValueOperatorGreater;
    if (token == QStringLiteral("ValueOperatorLessOrEqual")) return ValueOperator::ValueOperatorLessOrEqual;
    if (token == QStringLiteral("ValueOperatorGreaterOrEqual")) return ValueOperator::ValueOperatorGreaterOrEqual;
    return ValueOperator::ValueOperatorEquals;
}

QString toString(WiredNetworkConnectionType value) {
    switch (value) {
    case WiredNetworkConnectionType::WiredNetworkConnectionTypeDHCP: return QStringLiteral("WiredNetworkConnectionTypeDHCP");
    case WiredNetworkConnectionType::WiredNetworkConnectionTypeManual: return QStringLiteral("WiredNetworkConnectionTypeManual");
    case WiredNetworkConnectionType::WiredNetworkConnectionTypeShared: return QStringLiteral("WiredNetworkConnectionTypeShared");
    }
    return QStringLiteral("WiredNetworkConnectionTypeDHCP");
}

WiredNetworkConnectionType parseWiredNetworkConnectionType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("WiredNetworkConnectionTypeDHCP")) return WiredNetworkConnectionType::WiredNetworkConnectionTypeDHCP;
    if (token == QStringLiteral("WiredNetworkConnectionTypeManual")) return WiredNetworkConnectionType::WiredNetworkConnectionTypeManual;
    if (token == QStringLiteral("WiredNetworkConnectionTypeShared")) return WiredNetworkConnectionType::WiredNetworkConnectionTypeShared;
    return WiredNetworkConnectionType::WiredNetworkConnectionTypeDHCP;
}

QString toString(WirelessCapability value) {
    switch (value) {
    case WirelessCapability::WirelessCapabilityNone: return QStringLiteral("WirelessCapabilityNone");
    case WirelessCapability::WirelessCapabilityCipherWEP40: return QStringLiteral("WirelessCapabilityCipherWEP40");
    case WirelessCapability::WirelessCapabilityCipherWEP104: return QStringLiteral("WirelessCapabilityCipherWEP104");
    case WirelessCapability::WirelessCapabilityCipherTKIP: return QStringLiteral("WirelessCapabilityCipherTKIP");
    case WirelessCapability::WirelessCapabilityCipherCCMP: return QStringLiteral("WirelessCapabilityCipherCCMP");
    case WirelessCapability::WirelessCapabilityWPA: return QStringLiteral("WirelessCapabilityWPA");
    case WirelessCapability::WirelessCapabilityRSN: return QStringLiteral("WirelessCapabilityRSN");
    case WirelessCapability::WirelessCapabilityAP: return QStringLiteral("WirelessCapabilityAP");
    case WirelessCapability::WirelessCapabilityAdHoc: return QStringLiteral("WirelessCapabilityAdHoc");
    case WirelessCapability::WirelessCapabilityFreqValid: return QStringLiteral("WirelessCapabilityFreqValid");
    case WirelessCapability::WirelessCapability2Ghz: return QStringLiteral("WirelessCapability2Ghz");
    case WirelessCapability::WirelessCapability5Ghz: return QStringLiteral("WirelessCapability5Ghz");
    }
    return QStringLiteral("WirelessCapabilityNone");
}

WirelessCapability parseWirelessCapability(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("WirelessCapabilityNone")) return WirelessCapability::WirelessCapabilityNone;
    if (token == QStringLiteral("WirelessCapabilityCipherWEP40")) return WirelessCapability::WirelessCapabilityCipherWEP40;
    if (token == QStringLiteral("WirelessCapabilityCipherWEP104")) return WirelessCapability::WirelessCapabilityCipherWEP104;
    if (token == QStringLiteral("WirelessCapabilityCipherTKIP")) return WirelessCapability::WirelessCapabilityCipherTKIP;
    if (token == QStringLiteral("WirelessCapabilityCipherCCMP")) return WirelessCapability::WirelessCapabilityCipherCCMP;
    if (token == QStringLiteral("WirelessCapabilityWPA")) return WirelessCapability::WirelessCapabilityWPA;
    if (token == QStringLiteral("WirelessCapabilityRSN")) return WirelessCapability::WirelessCapabilityRSN;
    if (token == QStringLiteral("WirelessCapabilityAP")) return WirelessCapability::WirelessCapabilityAP;
    if (token == QStringLiteral("WirelessCapabilityAdHoc")) return WirelessCapability::WirelessCapabilityAdHoc;
    if (token == QStringLiteral("WirelessCapabilityFreqValid")) return WirelessCapability::WirelessCapabilityFreqValid;
    if (token == QStringLiteral("WirelessCapability2Ghz")) return WirelessCapability::WirelessCapability2Ghz;
    if (token == QStringLiteral("WirelessCapability5Ghz")) return WirelessCapability::WirelessCapability5Ghz;
    return WirelessCapability::WirelessCapabilityNone;
}

QString toString(WirelessMode value) {
    switch (value) {
    case WirelessMode::WirelessModeUnknown: return QStringLiteral("WirelessModeUnknown");
    case WirelessMode::WirelessModeAdhoc: return QStringLiteral("WirelessModeAdhoc");
    case WirelessMode::WirelessModeInfrastructure: return QStringLiteral("WirelessModeInfrastructure");
    case WirelessMode::WirelessModeAccessPoint: return QStringLiteral("WirelessModeAccessPoint");
    }
    return QStringLiteral("WirelessModeUnknown");
}

WirelessMode parseWirelessMode(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("WirelessModeUnknown")) return WirelessMode::WirelessModeUnknown;
    if (token == QStringLiteral("WirelessModeAdhoc")) return WirelessMode::WirelessModeAdhoc;
    if (token == QStringLiteral("WirelessModeInfrastructure")) return WirelessMode::WirelessModeInfrastructure;
    if (token == QStringLiteral("WirelessModeAccessPoint")) return WirelessMode::WirelessModeAccessPoint;
    return WirelessMode::WirelessModeUnknown;
}

QString toString(ZWaveDeviceType value) {
    switch (value) {
    case ZWaveDeviceType::ZWaveDeviceTypeUnknown: return QStringLiteral("ZWaveDeviceTypeUnknown");
    case ZWaveDeviceType::ZWaveDeviceTypeCentralController: return QStringLiteral("ZWaveDeviceTypeCentralController");
    case ZWaveDeviceType::ZWaveDeviceTypeDisplaySimple: return QStringLiteral("ZWaveDeviceTypeDisplaySimple");
    case ZWaveDeviceType::ZWaveDeviceTypeDoorLockKeypad: return QStringLiteral("ZWaveDeviceTypeDoorLockKeypad");
    case ZWaveDeviceType::ZWaveDeviceTypeFanSwitch: return QStringLiteral("ZWaveDeviceTypeFanSwitch");
    case ZWaveDeviceType::ZWaveDeviceTypeGateway: return QStringLiteral("ZWaveDeviceTypeGateway");
    case ZWaveDeviceType::ZWaveDeviceTypeLightDimmerSwitch: return QStringLiteral("ZWaveDeviceTypeLightDimmerSwitch");
    case ZWaveDeviceType::ZWaveDeviceTypeOnOffPowerSwitch: return QStringLiteral("ZWaveDeviceTypeOnOffPowerSwitch");
    case ZWaveDeviceType::ZWaveDeviceTypePowerStrip: return QStringLiteral("ZWaveDeviceTypePowerStrip");
    case ZWaveDeviceType::ZWaveDeviceTypeRemoteControlAV: return QStringLiteral("ZWaveDeviceTypeRemoteControlAV");
    case ZWaveDeviceType::ZWaveDeviceTypeRemoteControlMultiPurpose: return QStringLiteral("ZWaveDeviceTypeRemoteControlMultiPurpose");
    case ZWaveDeviceType::ZWaveDeviceTypeRemoteControlSimple: return QStringLiteral("ZWaveDeviceTypeRemoteControlSimple");
    case ZWaveDeviceType::ZWaveDeviceTypeKeyFob: return QStringLiteral("ZWaveDeviceTypeKeyFob");
    case ZWaveDeviceType::ZWaveDeviceTypeSensorNotification: return QStringLiteral("ZWaveDeviceTypeSensorNotification");
    case ZWaveDeviceType::ZWaveDeviceTypeSmokeAlarmSensor: return QStringLiteral("ZWaveDeviceTypeSmokeAlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeCOAlarmSensor: return QStringLiteral("ZWaveDeviceTypeCOAlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeCO2AlarmSensor: return QStringLiteral("ZWaveDeviceTypeCO2AlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeHeatAlarmSensor: return QStringLiteral("ZWaveDeviceTypeHeatAlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeWaterAlarmSensor: return QStringLiteral("ZWaveDeviceTypeWaterAlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeAccessControlSensor: return QStringLiteral("ZWaveDeviceTypeAccessControlSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeHomeSecuritySensor: return QStringLiteral("ZWaveDeviceTypeHomeSecuritySensor");
    case ZWaveDeviceType::ZWaveDeviceTypePowerManagementSensor: return QStringLiteral("ZWaveDeviceTypePowerManagementSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeSystemSensor: return QStringLiteral("ZWaveDeviceTypeSystemSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeEmergencyAlarmSensor: return QStringLiteral("ZWaveDeviceTypeEmergencyAlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeClockSensor: return QStringLiteral("ZWaveDeviceTypeClockSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeMultiDeviceAlarmSensor: return QStringLiteral("ZWaveDeviceTypeMultiDeviceAlarmSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeMultilevelSensor: return QStringLiteral("ZWaveDeviceTypeMultilevelSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeAirTemperatureSensor: return QStringLiteral("ZWaveDeviceTypeAirTemperatureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeGeneralPurposeSensor: return QStringLiteral("ZWaveDeviceTypeGeneralPurposeSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeLuminanceSensor: return QStringLiteral("ZWaveDeviceTypeLuminanceSensor");
    case ZWaveDeviceType::ZWaveDeviceTypePowerSensor: return QStringLiteral("ZWaveDeviceTypePowerSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeHumiditySensor: return QStringLiteral("ZWaveDeviceTypeHumiditySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeVelocitySensor: return QStringLiteral("ZWaveDeviceTypeVelocitySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeDirectionSensor: return QStringLiteral("ZWaveDeviceTypeDirectionSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeAtmosphericPressureSensor: return QStringLiteral("ZWaveDeviceTypeAtmosphericPressureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeBarometricPressureSensor: return QStringLiteral("ZWaveDeviceTypeBarometricPressureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeSolarRadiationSensor: return QStringLiteral("ZWaveDeviceTypeSolarRadiationSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeDewPointSensor: return QStringLiteral("ZWaveDeviceTypeDewPointSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeRainRateSensor: return QStringLiteral("ZWaveDeviceTypeRainRateSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeTideLevelSensor: return QStringLiteral("ZWaveDeviceTypeTideLevelSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeWeightSensor: return QStringLiteral("ZWaveDeviceTypeWeightSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeVoltageSensor: return QStringLiteral("ZWaveDeviceTypeVoltageSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeCurrentSensor: return QStringLiteral("ZWaveDeviceTypeCurrentSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeCO2LevelSensor: return QStringLiteral("ZWaveDeviceTypeCO2LevelSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeAirFlowSensor: return QStringLiteral("ZWaveDeviceTypeAirFlowSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeTankCapacitySensor: return QStringLiteral("ZWaveDeviceTypeTankCapacitySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeDistanceSensor: return QStringLiteral("ZWaveDeviceTypeDistanceSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeAnglePositionSensor: return QStringLiteral("ZWaveDeviceTypeAnglePositionSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeRotationSensor: return QStringLiteral("ZWaveDeviceTypeRotationSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeWaterTemperatureSensor: return QStringLiteral("ZWaveDeviceTypeWaterTemperatureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeSoilTemperatureSensor: return QStringLiteral("ZWaveDeviceTypeSoilTemperatureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeSeismicIntensitySensor: return QStringLiteral("ZWaveDeviceTypeSeismicIntensitySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeSeismicMagnitudeSensor: return QStringLiteral("ZWaveDeviceTypeSeismicMagnitudeSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeUltraVioletSensor: return QStringLiteral("ZWaveDeviceTypeUltraVioletSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeElectricalResistivitySensor: return QStringLiteral("ZWaveDeviceTypeElectricalResistivitySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeElectricalConductivitySensor: return QStringLiteral("ZWaveDeviceTypeElectricalConductivitySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeLoudnessSensor: return QStringLiteral("ZWaveDeviceTypeLoudnessSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeMoistureSensor: return QStringLiteral("ZWaveDeviceTypeMoistureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeFrequencySensor: return QStringLiteral("ZWaveDeviceTypeFrequencySensor");
    case ZWaveDeviceType::ZWaveDeviceTypeTimeSensor: return QStringLiteral("ZWaveDeviceTypeTimeSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeTargetTemperatureSensor: return QStringLiteral("ZWaveDeviceTypeTargetTemperatureSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeMultiDeviceSensor: return QStringLiteral("ZWaveDeviceTypeMultiDeviceSensor");
    case ZWaveDeviceType::ZWaveDeviceTypeSetTopBox: return QStringLiteral("ZWaveDeviceTypeSetTopBox");
    case ZWaveDeviceType::ZWaveDeviceTypeSiren: return QStringLiteral("ZWaveDeviceTypeSiren");
    case ZWaveDeviceType::ZWaveDeviceTypeSubEnergyMeter: return QStringLiteral("ZWaveDeviceTypeSubEnergyMeter");
    case ZWaveDeviceType::ZWaveDeviceTypeSubSystemController: return QStringLiteral("ZWaveDeviceTypeSubSystemController");
    case ZWaveDeviceType::ZWaveDeviceTypeThermostatHVAC: return QStringLiteral("ZWaveDeviceTypeThermostatHVAC");
    case ZWaveDeviceType::ZWaveDeviceTypeThermostatSetback: return QStringLiteral("ZWaveDeviceTypeThermostatSetback");
    case ZWaveDeviceType::ZWaveDeviceTypeTV: return QStringLiteral("ZWaveDeviceTypeTV");
    case ZWaveDeviceType::ZWaveDeviceTypeValveOpenClose: return QStringLiteral("ZWaveDeviceTypeValveOpenClose");
    case ZWaveDeviceType::ZWaveDeviceTypeWallController: return QStringLiteral("ZWaveDeviceTypeWallController");
    case ZWaveDeviceType::ZWaveDeviceTypeWholeHomeMeterSimple: return QStringLiteral("ZWaveDeviceTypeWholeHomeMeterSimple");
    case ZWaveDeviceType::ZWaveDeviceTypeWindowCoveringNoPosEndpoint: return QStringLiteral("ZWaveDeviceTypeWindowCoveringNoPosEndpoint");
    case ZWaveDeviceType::ZWaveDeviceTypeWindowCoveringEndpointAware: return QStringLiteral("ZWaveDeviceTypeWindowCoveringEndpointAware");
    case ZWaveDeviceType::ZWaveDeviceTypeWindowCoveringPositionEndpointAware: return QStringLiteral("ZWaveDeviceTypeWindowCoveringPositionEndpointAware");
    }
    return QStringLiteral("ZWaveDeviceTypeUnknown");
}

ZWaveDeviceType parseZWaveDeviceType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZWaveDeviceTypeUnknown")) return ZWaveDeviceType::ZWaveDeviceTypeUnknown;
    if (token == QStringLiteral("ZWaveDeviceTypeCentralController")) return ZWaveDeviceType::ZWaveDeviceTypeCentralController;
    if (token == QStringLiteral("ZWaveDeviceTypeDisplaySimple")) return ZWaveDeviceType::ZWaveDeviceTypeDisplaySimple;
    if (token == QStringLiteral("ZWaveDeviceTypeDoorLockKeypad")) return ZWaveDeviceType::ZWaveDeviceTypeDoorLockKeypad;
    if (token == QStringLiteral("ZWaveDeviceTypeFanSwitch")) return ZWaveDeviceType::ZWaveDeviceTypeFanSwitch;
    if (token == QStringLiteral("ZWaveDeviceTypeGateway")) return ZWaveDeviceType::ZWaveDeviceTypeGateway;
    if (token == QStringLiteral("ZWaveDeviceTypeLightDimmerSwitch")) return ZWaveDeviceType::ZWaveDeviceTypeLightDimmerSwitch;
    if (token == QStringLiteral("ZWaveDeviceTypeOnOffPowerSwitch")) return ZWaveDeviceType::ZWaveDeviceTypeOnOffPowerSwitch;
    if (token == QStringLiteral("ZWaveDeviceTypePowerStrip")) return ZWaveDeviceType::ZWaveDeviceTypePowerStrip;
    if (token == QStringLiteral("ZWaveDeviceTypeRemoteControlAV")) return ZWaveDeviceType::ZWaveDeviceTypeRemoteControlAV;
    if (token == QStringLiteral("ZWaveDeviceTypeRemoteControlMultiPurpose")) return ZWaveDeviceType::ZWaveDeviceTypeRemoteControlMultiPurpose;
    if (token == QStringLiteral("ZWaveDeviceTypeRemoteControlSimple")) return ZWaveDeviceType::ZWaveDeviceTypeRemoteControlSimple;
    if (token == QStringLiteral("ZWaveDeviceTypeKeyFob")) return ZWaveDeviceType::ZWaveDeviceTypeKeyFob;
    if (token == QStringLiteral("ZWaveDeviceTypeSensorNotification")) return ZWaveDeviceType::ZWaveDeviceTypeSensorNotification;
    if (token == QStringLiteral("ZWaveDeviceTypeSmokeAlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeSmokeAlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeCOAlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeCOAlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeCO2AlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeCO2AlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeHeatAlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeHeatAlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeWaterAlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeWaterAlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeAccessControlSensor")) return ZWaveDeviceType::ZWaveDeviceTypeAccessControlSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeHomeSecuritySensor")) return ZWaveDeviceType::ZWaveDeviceTypeHomeSecuritySensor;
    if (token == QStringLiteral("ZWaveDeviceTypePowerManagementSensor")) return ZWaveDeviceType::ZWaveDeviceTypePowerManagementSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeSystemSensor")) return ZWaveDeviceType::ZWaveDeviceTypeSystemSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeEmergencyAlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeEmergencyAlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeClockSensor")) return ZWaveDeviceType::ZWaveDeviceTypeClockSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeMultiDeviceAlarmSensor")) return ZWaveDeviceType::ZWaveDeviceTypeMultiDeviceAlarmSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeMultilevelSensor")) return ZWaveDeviceType::ZWaveDeviceTypeMultilevelSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeAirTemperatureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeAirTemperatureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeGeneralPurposeSensor")) return ZWaveDeviceType::ZWaveDeviceTypeGeneralPurposeSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeLuminanceSensor")) return ZWaveDeviceType::ZWaveDeviceTypeLuminanceSensor;
    if (token == QStringLiteral("ZWaveDeviceTypePowerSensor")) return ZWaveDeviceType::ZWaveDeviceTypePowerSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeHumiditySensor")) return ZWaveDeviceType::ZWaveDeviceTypeHumiditySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeVelocitySensor")) return ZWaveDeviceType::ZWaveDeviceTypeVelocitySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeDirectionSensor")) return ZWaveDeviceType::ZWaveDeviceTypeDirectionSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeAtmosphericPressureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeAtmosphericPressureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeBarometricPressureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeBarometricPressureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeSolarRadiationSensor")) return ZWaveDeviceType::ZWaveDeviceTypeSolarRadiationSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeDewPointSensor")) return ZWaveDeviceType::ZWaveDeviceTypeDewPointSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeRainRateSensor")) return ZWaveDeviceType::ZWaveDeviceTypeRainRateSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeTideLevelSensor")) return ZWaveDeviceType::ZWaveDeviceTypeTideLevelSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeWeightSensor")) return ZWaveDeviceType::ZWaveDeviceTypeWeightSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeVoltageSensor")) return ZWaveDeviceType::ZWaveDeviceTypeVoltageSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeCurrentSensor")) return ZWaveDeviceType::ZWaveDeviceTypeCurrentSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeCO2LevelSensor")) return ZWaveDeviceType::ZWaveDeviceTypeCO2LevelSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeAirFlowSensor")) return ZWaveDeviceType::ZWaveDeviceTypeAirFlowSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeTankCapacitySensor")) return ZWaveDeviceType::ZWaveDeviceTypeTankCapacitySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeDistanceSensor")) return ZWaveDeviceType::ZWaveDeviceTypeDistanceSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeAnglePositionSensor")) return ZWaveDeviceType::ZWaveDeviceTypeAnglePositionSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeRotationSensor")) return ZWaveDeviceType::ZWaveDeviceTypeRotationSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeWaterTemperatureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeWaterTemperatureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeSoilTemperatureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeSoilTemperatureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeSeismicIntensitySensor")) return ZWaveDeviceType::ZWaveDeviceTypeSeismicIntensitySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeSeismicMagnitudeSensor")) return ZWaveDeviceType::ZWaveDeviceTypeSeismicMagnitudeSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeUltraVioletSensor")) return ZWaveDeviceType::ZWaveDeviceTypeUltraVioletSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeElectricalResistivitySensor")) return ZWaveDeviceType::ZWaveDeviceTypeElectricalResistivitySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeElectricalConductivitySensor")) return ZWaveDeviceType::ZWaveDeviceTypeElectricalConductivitySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeLoudnessSensor")) return ZWaveDeviceType::ZWaveDeviceTypeLoudnessSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeMoistureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeMoistureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeFrequencySensor")) return ZWaveDeviceType::ZWaveDeviceTypeFrequencySensor;
    if (token == QStringLiteral("ZWaveDeviceTypeTimeSensor")) return ZWaveDeviceType::ZWaveDeviceTypeTimeSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeTargetTemperatureSensor")) return ZWaveDeviceType::ZWaveDeviceTypeTargetTemperatureSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeMultiDeviceSensor")) return ZWaveDeviceType::ZWaveDeviceTypeMultiDeviceSensor;
    if (token == QStringLiteral("ZWaveDeviceTypeSetTopBox")) return ZWaveDeviceType::ZWaveDeviceTypeSetTopBox;
    if (token == QStringLiteral("ZWaveDeviceTypeSiren")) return ZWaveDeviceType::ZWaveDeviceTypeSiren;
    if (token == QStringLiteral("ZWaveDeviceTypeSubEnergyMeter")) return ZWaveDeviceType::ZWaveDeviceTypeSubEnergyMeter;
    if (token == QStringLiteral("ZWaveDeviceTypeSubSystemController")) return ZWaveDeviceType::ZWaveDeviceTypeSubSystemController;
    if (token == QStringLiteral("ZWaveDeviceTypeThermostatHVAC")) return ZWaveDeviceType::ZWaveDeviceTypeThermostatHVAC;
    if (token == QStringLiteral("ZWaveDeviceTypeThermostatSetback")) return ZWaveDeviceType::ZWaveDeviceTypeThermostatSetback;
    if (token == QStringLiteral("ZWaveDeviceTypeTV")) return ZWaveDeviceType::ZWaveDeviceTypeTV;
    if (token == QStringLiteral("ZWaveDeviceTypeValveOpenClose")) return ZWaveDeviceType::ZWaveDeviceTypeValveOpenClose;
    if (token == QStringLiteral("ZWaveDeviceTypeWallController")) return ZWaveDeviceType::ZWaveDeviceTypeWallController;
    if (token == QStringLiteral("ZWaveDeviceTypeWholeHomeMeterSimple")) return ZWaveDeviceType::ZWaveDeviceTypeWholeHomeMeterSimple;
    if (token == QStringLiteral("ZWaveDeviceTypeWindowCoveringNoPosEndpoint")) return ZWaveDeviceType::ZWaveDeviceTypeWindowCoveringNoPosEndpoint;
    if (token == QStringLiteral("ZWaveDeviceTypeWindowCoveringEndpointAware")) return ZWaveDeviceType::ZWaveDeviceTypeWindowCoveringEndpointAware;
    if (token == QStringLiteral("ZWaveDeviceTypeWindowCoveringPositionEndpointAware")) return ZWaveDeviceType::ZWaveDeviceTypeWindowCoveringPositionEndpointAware;
    return ZWaveDeviceType::ZWaveDeviceTypeUnknown;
}

QString toString(ZWaveError value) {
    switch (value) {
    case ZWaveError::ZWaveErrorNoError: return QStringLiteral("ZWaveErrorNoError");
    case ZWaveError::ZWaveErrorInUse: return QStringLiteral("ZWaveErrorInUse");
    case ZWaveError::ZWaveErrorNetworkUuidNotFound: return QStringLiteral("ZWaveErrorNetworkUuidNotFound");
    case ZWaveError::ZWaveErrorNodeIdNotFound: return QStringLiteral("ZWaveErrorNodeIdNotFound");
    case ZWaveError::ZWaveErrorTimeout: return QStringLiteral("ZWaveErrorTimeout");
    case ZWaveError::ZWaveErrorBackendError: return QStringLiteral("ZWaveErrorBackendError");
    }
    return QStringLiteral("ZWaveErrorNoError");
}

ZWaveError parseZWaveError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZWaveErrorNoError")) return ZWaveError::ZWaveErrorNoError;
    if (token == QStringLiteral("ZWaveErrorInUse")) return ZWaveError::ZWaveErrorInUse;
    if (token == QStringLiteral("ZWaveErrorNetworkUuidNotFound")) return ZWaveError::ZWaveErrorNetworkUuidNotFound;
    if (token == QStringLiteral("ZWaveErrorNodeIdNotFound")) return ZWaveError::ZWaveErrorNodeIdNotFound;
    if (token == QStringLiteral("ZWaveErrorTimeout")) return ZWaveError::ZWaveErrorTimeout;
    if (token == QStringLiteral("ZWaveErrorBackendError")) return ZWaveError::ZWaveErrorBackendError;
    return ZWaveError::ZWaveErrorNoError;
}

QString toString(ZWaveNetworkState value) {
    switch (value) {
    case ZWaveNetworkState::ZWaveNetworkStateOffline: return QStringLiteral("ZWaveNetworkStateOffline");
    case ZWaveNetworkState::ZWaveNetworkStateStarting: return QStringLiteral("ZWaveNetworkStateStarting");
    case ZWaveNetworkState::ZWaveNetworkStateOnline: return QStringLiteral("ZWaveNetworkStateOnline");
    case ZWaveNetworkState::ZWaveNetworkStateError: return QStringLiteral("ZWaveNetworkStateError");
    }
    return QStringLiteral("ZWaveNetworkStateOffline");
}

ZWaveNetworkState parseZWaveNetworkState(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZWaveNetworkStateOffline")) return ZWaveNetworkState::ZWaveNetworkStateOffline;
    if (token == QStringLiteral("ZWaveNetworkStateStarting")) return ZWaveNetworkState::ZWaveNetworkStateStarting;
    if (token == QStringLiteral("ZWaveNetworkStateOnline")) return ZWaveNetworkState::ZWaveNetworkStateOnline;
    if (token == QStringLiteral("ZWaveNetworkStateError")) return ZWaveNetworkState::ZWaveNetworkStateError;
    return ZWaveNetworkState::ZWaveNetworkStateOffline;
}

QString toString(ZWaveNodeRole value) {
    switch (value) {
    case ZWaveNodeRole::ZWaveNodeRoleUnknown: return QStringLiteral("ZWaveNodeRoleUnknown");
    case ZWaveNodeRole::ZWaveNodeRoleCentralController: return QStringLiteral("ZWaveNodeRoleCentralController");
    case ZWaveNodeRole::ZWaveNodeRoleSubController: return QStringLiteral("ZWaveNodeRoleSubController");
    case ZWaveNodeRole::ZWaveNodeRolePortableController: return QStringLiteral("ZWaveNodeRolePortableController");
    case ZWaveNodeRole::ZWaveNodeRolePortableReportingController: return QStringLiteral("ZWaveNodeRolePortableReportingController");
    case ZWaveNodeRole::ZWaveNodeRolePortableSlave: return QStringLiteral("ZWaveNodeRolePortableSlave");
    case ZWaveNodeRole::ZWaveNodeRoleAlwaysOnSlabe: return QStringLiteral("ZWaveNodeRoleAlwaysOnSlabe");
    case ZWaveNodeRole::ZWaveNodeRoleReportingSleepingSlave: return QStringLiteral("ZWaveNodeRoleReportingSleepingSlave");
    case ZWaveNodeRole::ZWaveNodeRoleListeningSleepingSlave: return QStringLiteral("ZWaveNodeRoleListeningSleepingSlave");
    }
    return QStringLiteral("ZWaveNodeRoleUnknown");
}

ZWaveNodeRole parseZWaveNodeRole(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZWaveNodeRoleUnknown")) return ZWaveNodeRole::ZWaveNodeRoleUnknown;
    if (token == QStringLiteral("ZWaveNodeRoleCentralController")) return ZWaveNodeRole::ZWaveNodeRoleCentralController;
    if (token == QStringLiteral("ZWaveNodeRoleSubController")) return ZWaveNodeRole::ZWaveNodeRoleSubController;
    if (token == QStringLiteral("ZWaveNodeRolePortableController")) return ZWaveNodeRole::ZWaveNodeRolePortableController;
    if (token == QStringLiteral("ZWaveNodeRolePortableReportingController")) return ZWaveNodeRole::ZWaveNodeRolePortableReportingController;
    if (token == QStringLiteral("ZWaveNodeRolePortableSlave")) return ZWaveNodeRole::ZWaveNodeRolePortableSlave;
    if (token == QStringLiteral("ZWaveNodeRoleAlwaysOnSlabe")) return ZWaveNodeRole::ZWaveNodeRoleAlwaysOnSlabe;
    if (token == QStringLiteral("ZWaveNodeRoleReportingSleepingSlave")) return ZWaveNodeRole::ZWaveNodeRoleReportingSleepingSlave;
    if (token == QStringLiteral("ZWaveNodeRoleListeningSleepingSlave")) return ZWaveNodeRole::ZWaveNodeRoleListeningSleepingSlave;
    return ZWaveNodeRole::ZWaveNodeRoleUnknown;
}

QString toString(ZWaveNodeType value) {
    switch (value) {
    case ZWaveNodeType::ZWaveNodeTypeUnknown: return QStringLiteral("ZWaveNodeTypeUnknown");
    case ZWaveNodeType::ZWaveNodeTypeController: return QStringLiteral("ZWaveNodeTypeController");
    case ZWaveNodeType::ZWaveNodeTypeStaticController: return QStringLiteral("ZWaveNodeTypeStaticController");
    case ZWaveNodeType::ZWaveNodeTypeSlave: return QStringLiteral("ZWaveNodeTypeSlave");
    case ZWaveNodeType::ZWaveNodeTypeRoutingSlave: return QStringLiteral("ZWaveNodeTypeRoutingSlave");
    }
    return QStringLiteral("ZWaveNodeTypeUnknown");
}

ZWaveNodeType parseZWaveNodeType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZWaveNodeTypeUnknown")) return ZWaveNodeType::ZWaveNodeTypeUnknown;
    if (token == QStringLiteral("ZWaveNodeTypeController")) return ZWaveNodeType::ZWaveNodeTypeController;
    if (token == QStringLiteral("ZWaveNodeTypeStaticController")) return ZWaveNodeType::ZWaveNodeTypeStaticController;
    if (token == QStringLiteral("ZWaveNodeTypeSlave")) return ZWaveNodeType::ZWaveNodeTypeSlave;
    if (token == QStringLiteral("ZWaveNodeTypeRoutingSlave")) return ZWaveNodeType::ZWaveNodeTypeRoutingSlave;
    return ZWaveNodeType::ZWaveNodeTypeUnknown;
}

QString toString(ZigbeeClusterDirection value) {
    switch (value) {
    case ZigbeeClusterDirection::ZigbeeClusterDirectionServer: return QStringLiteral("ZigbeeClusterDirectionServer");
    case ZigbeeClusterDirection::ZigbeeClusterDirectionClient: return QStringLiteral("ZigbeeClusterDirectionClient");
    }
    return QStringLiteral("ZigbeeClusterDirectionServer");
}

ZigbeeClusterDirection parseZigbeeClusterDirection(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeClusterDirectionServer")) return ZigbeeClusterDirection::ZigbeeClusterDirectionServer;
    if (token == QStringLiteral("ZigbeeClusterDirectionClient")) return ZigbeeClusterDirection::ZigbeeClusterDirectionClient;
    return ZigbeeClusterDirection::ZigbeeClusterDirectionServer;
}

QString toString(ZigbeeError value) {
    switch (value) {
    case ZigbeeError::ZigbeeErrorNoError: return QStringLiteral("ZigbeeErrorNoError");
    case ZigbeeError::ZigbeeErrorAdapterNotAvailable: return QStringLiteral("ZigbeeErrorAdapterNotAvailable");
    case ZigbeeError::ZigbeeErrorAdapterAlreadyInUse: return QStringLiteral("ZigbeeErrorAdapterAlreadyInUse");
    case ZigbeeError::ZigbeeErrorNetworkUuidNotFound: return QStringLiteral("ZigbeeErrorNetworkUuidNotFound");
    case ZigbeeError::ZigbeeErrorDurationOutOfRange: return QStringLiteral("ZigbeeErrorDurationOutOfRange");
    case ZigbeeError::ZigbeeErrorNetworkOffline: return QStringLiteral("ZigbeeErrorNetworkOffline");
    case ZigbeeError::ZigbeeErrorUnknownBackend: return QStringLiteral("ZigbeeErrorUnknownBackend");
    case ZigbeeError::ZigbeeErrorNodeNotFound: return QStringLiteral("ZigbeeErrorNodeNotFound");
    case ZigbeeError::ZigbeeErrorForbidden: return QStringLiteral("ZigbeeErrorForbidden");
    case ZigbeeError::ZigbeeErrorInvalidChannel: return QStringLiteral("ZigbeeErrorInvalidChannel");
    case ZigbeeError::ZigbeeErrorNetworkError: return QStringLiteral("ZigbeeErrorNetworkError");
    case ZigbeeError::ZigbeeErrorTimeoutError: return QStringLiteral("ZigbeeErrorTimeoutError");
    case ZigbeeError::ZigbeeErrorNotSupported: return QStringLiteral("ZigbeeErrorNotSupported");
    }
    return QStringLiteral("ZigbeeErrorNoError");
}

ZigbeeError parseZigbeeError(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeErrorNoError")) return ZigbeeError::ZigbeeErrorNoError;
    if (token == QStringLiteral("ZigbeeErrorAdapterNotAvailable")) return ZigbeeError::ZigbeeErrorAdapterNotAvailable;
    if (token == QStringLiteral("ZigbeeErrorAdapterAlreadyInUse")) return ZigbeeError::ZigbeeErrorAdapterAlreadyInUse;
    if (token == QStringLiteral("ZigbeeErrorNetworkUuidNotFound")) return ZigbeeError::ZigbeeErrorNetworkUuidNotFound;
    if (token == QStringLiteral("ZigbeeErrorDurationOutOfRange")) return ZigbeeError::ZigbeeErrorDurationOutOfRange;
    if (token == QStringLiteral("ZigbeeErrorNetworkOffline")) return ZigbeeError::ZigbeeErrorNetworkOffline;
    if (token == QStringLiteral("ZigbeeErrorUnknownBackend")) return ZigbeeError::ZigbeeErrorUnknownBackend;
    if (token == QStringLiteral("ZigbeeErrorNodeNotFound")) return ZigbeeError::ZigbeeErrorNodeNotFound;
    if (token == QStringLiteral("ZigbeeErrorForbidden")) return ZigbeeError::ZigbeeErrorForbidden;
    if (token == QStringLiteral("ZigbeeErrorInvalidChannel")) return ZigbeeError::ZigbeeErrorInvalidChannel;
    if (token == QStringLiteral("ZigbeeErrorNetworkError")) return ZigbeeError::ZigbeeErrorNetworkError;
    if (token == QStringLiteral("ZigbeeErrorTimeoutError")) return ZigbeeError::ZigbeeErrorTimeoutError;
    if (token == QStringLiteral("ZigbeeErrorNotSupported")) return ZigbeeError::ZigbeeErrorNotSupported;
    return ZigbeeError::ZigbeeErrorNoError;
}

QString toString(ZigbeeNetworkState value) {
    switch (value) {
    case ZigbeeNetworkState::ZigbeeNetworkStateOffline: return QStringLiteral("ZigbeeNetworkStateOffline");
    case ZigbeeNetworkState::ZigbeeNetworkStateStarting: return QStringLiteral("ZigbeeNetworkStateStarting");
    case ZigbeeNetworkState::ZigbeeNetworkStateUpdating: return QStringLiteral("ZigbeeNetworkStateUpdating");
    case ZigbeeNetworkState::ZigbeeNetworkStateOnline: return QStringLiteral("ZigbeeNetworkStateOnline");
    case ZigbeeNetworkState::ZigbeeNetworkStateError: return QStringLiteral("ZigbeeNetworkStateError");
    }
    return QStringLiteral("ZigbeeNetworkStateOffline");
}

ZigbeeNetworkState parseZigbeeNetworkState(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeNetworkStateOffline")) return ZigbeeNetworkState::ZigbeeNetworkStateOffline;
    if (token == QStringLiteral("ZigbeeNetworkStateStarting")) return ZigbeeNetworkState::ZigbeeNetworkStateStarting;
    if (token == QStringLiteral("ZigbeeNetworkStateUpdating")) return ZigbeeNetworkState::ZigbeeNetworkStateUpdating;
    if (token == QStringLiteral("ZigbeeNetworkStateOnline")) return ZigbeeNetworkState::ZigbeeNetworkStateOnline;
    if (token == QStringLiteral("ZigbeeNetworkStateError")) return ZigbeeNetworkState::ZigbeeNetworkStateError;
    return ZigbeeNetworkState::ZigbeeNetworkStateOffline;
}

QString toString(ZigbeeNodeRelationship value) {
    switch (value) {
    case ZigbeeNodeRelationship::ZigbeeNodeRelationshipParent: return QStringLiteral("ZigbeeNodeRelationshipParent");
    case ZigbeeNodeRelationship::ZigbeeNodeRelationshipChild: return QStringLiteral("ZigbeeNodeRelationshipChild");
    case ZigbeeNodeRelationship::ZigbeeNodeRelationshipSibling: return QStringLiteral("ZigbeeNodeRelationshipSibling");
    case ZigbeeNodeRelationship::ZigbeeNodeRelationshipNone: return QStringLiteral("ZigbeeNodeRelationshipNone");
    case ZigbeeNodeRelationship::ZigbeeNodeRelationshipPreviousChild: return QStringLiteral("ZigbeeNodeRelationshipPreviousChild");
    }
    return QStringLiteral("ZigbeeNodeRelationshipParent");
}

ZigbeeNodeRelationship parseZigbeeNodeRelationship(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeNodeRelationshipParent")) return ZigbeeNodeRelationship::ZigbeeNodeRelationshipParent;
    if (token == QStringLiteral("ZigbeeNodeRelationshipChild")) return ZigbeeNodeRelationship::ZigbeeNodeRelationshipChild;
    if (token == QStringLiteral("ZigbeeNodeRelationshipSibling")) return ZigbeeNodeRelationship::ZigbeeNodeRelationshipSibling;
    if (token == QStringLiteral("ZigbeeNodeRelationshipNone")) return ZigbeeNodeRelationship::ZigbeeNodeRelationshipNone;
    if (token == QStringLiteral("ZigbeeNodeRelationshipPreviousChild")) return ZigbeeNodeRelationship::ZigbeeNodeRelationshipPreviousChild;
    return ZigbeeNodeRelationship::ZigbeeNodeRelationshipParent;
}

QString toString(ZigbeeNodeRouteStatus value) {
    switch (value) {
    case ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusActive: return QStringLiteral("ZigbeeNodeRouteStatusActive");
    case ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusDiscoveryUnderway: return QStringLiteral("ZigbeeNodeRouteStatusDiscoveryUnderway");
    case ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusDiscoveryFailed: return QStringLiteral("ZigbeeNodeRouteStatusDiscoveryFailed");
    case ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusInactive: return QStringLiteral("ZigbeeNodeRouteStatusInactive");
    case ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusValidationUnderway: return QStringLiteral("ZigbeeNodeRouteStatusValidationUnderway");
    }
    return QStringLiteral("ZigbeeNodeRouteStatusActive");
}

ZigbeeNodeRouteStatus parseZigbeeNodeRouteStatus(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeNodeRouteStatusActive")) return ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusActive;
    if (token == QStringLiteral("ZigbeeNodeRouteStatusDiscoveryUnderway")) return ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusDiscoveryUnderway;
    if (token == QStringLiteral("ZigbeeNodeRouteStatusDiscoveryFailed")) return ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusDiscoveryFailed;
    if (token == QStringLiteral("ZigbeeNodeRouteStatusInactive")) return ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusInactive;
    if (token == QStringLiteral("ZigbeeNodeRouteStatusValidationUnderway")) return ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusValidationUnderway;
    return ZigbeeNodeRouteStatus::ZigbeeNodeRouteStatusActive;
}

QString toString(ZigbeeNodeState value) {
    switch (value) {
    case ZigbeeNodeState::ZigbeeNodeStateUninitialized: return QStringLiteral("ZigbeeNodeStateUninitialized");
    case ZigbeeNodeState::ZigbeeNodeStateInitializing: return QStringLiteral("ZigbeeNodeStateInitializing");
    case ZigbeeNodeState::ZigbeeNodeStateInitialized: return QStringLiteral("ZigbeeNodeStateInitialized");
    case ZigbeeNodeState::ZigbeeNodeStateHandled: return QStringLiteral("ZigbeeNodeStateHandled");
    }
    return QStringLiteral("ZigbeeNodeStateUninitialized");
}

ZigbeeNodeState parseZigbeeNodeState(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeNodeStateUninitialized")) return ZigbeeNodeState::ZigbeeNodeStateUninitialized;
    if (token == QStringLiteral("ZigbeeNodeStateInitializing")) return ZigbeeNodeState::ZigbeeNodeStateInitializing;
    if (token == QStringLiteral("ZigbeeNodeStateInitialized")) return ZigbeeNodeState::ZigbeeNodeStateInitialized;
    if (token == QStringLiteral("ZigbeeNodeStateHandled")) return ZigbeeNodeState::ZigbeeNodeStateHandled;
    return ZigbeeNodeState::ZigbeeNodeStateUninitialized;
}

QString toString(ZigbeeNodeType value) {
    switch (value) {
    case ZigbeeNodeType::ZigbeeNodeTypeCoordinator: return QStringLiteral("ZigbeeNodeTypeCoordinator");
    case ZigbeeNodeType::ZigbeeNodeTypeRouter: return QStringLiteral("ZigbeeNodeTypeRouter");
    case ZigbeeNodeType::ZigbeeNodeTypeEndDevice: return QStringLiteral("ZigbeeNodeTypeEndDevice");
    }
    return QStringLiteral("ZigbeeNodeTypeCoordinator");
}

ZigbeeNodeType parseZigbeeNodeType(const QJsonValue &value) {
    const QString token = value.toString();
    if (token == QStringLiteral("ZigbeeNodeTypeCoordinator")) return ZigbeeNodeType::ZigbeeNodeTypeCoordinator;
    if (token == QStringLiteral("ZigbeeNodeTypeRouter")) return ZigbeeNodeType::ZigbeeNodeTypeRouter;
    if (token == QStringLiteral("ZigbeeNodeTypeEndDevice")) return ZigbeeNodeType::ZigbeeNodeTypeEndDevice;
    return ZigbeeNodeType::ZigbeeNodeTypeCoordinator;
}

} // namespace nymea::api
