/*
 * This file is auto-generated, do not modify!
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "config.h"

#include <glib.h>

#include "fwupd-device-struct.h"

#ifdef G_LOG_DOMAIN
  #undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "FuStruct"

/**
 * fwupd_device_flag_to_string:
 * @val: value, e.g. %FWUPD_DEVICE_FLAG_INTERNAL
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 0.7.0
 **/
const gchar *
fwupd_device_flag_to_string(FwupdDeviceFlags val)
{
    if (val == FWUPD_DEVICE_FLAG_NONE)
        return "none";
    if (val == FWUPD_DEVICE_FLAG_INTERNAL)
        return "internal";
    if (val == FWUPD_DEVICE_FLAG_UPDATABLE)
        return "updatable";
    if (val == FWUPD_DEVICE_FLAG_REQUIRE_AC)
        return "require-ac";
    if (val == FWUPD_DEVICE_FLAG_LOCKED)
        return "locked";
    if (val == FWUPD_DEVICE_FLAG_SUPPORTED)
        return "supported";
    if (val == FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER)
        return "needs-bootloader";
    if (val == FWUPD_DEVICE_FLAG_NEEDS_REBOOT)
        return "needs-reboot";
    if (val == FWUPD_DEVICE_FLAG_REPORTED)
        return "reported";
    if (val == FWUPD_DEVICE_FLAG_NOTIFIED)
        return "notified";
    if (val == FWUPD_DEVICE_FLAG_IS_BOOTLOADER)
        return "is-bootloader";
    if (val == FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG)
        return "wait-for-replug";
    if (val == FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN)
        return "needs-shutdown";
    if (val == FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED)
        return "another-write-required";
    if (val == FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION)
        return "needs-activation";
    if (val == FWUPD_DEVICE_FLAG_HISTORICAL)
        return "historical";
    if (val == FWUPD_DEVICE_FLAG_WILL_DISAPPEAR)
        return "will-disappear";
    if (val == FWUPD_DEVICE_FLAG_CAN_VERIFY)
        return "can-verify";
    if (val == FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE)
        return "can-verify-image";
    if (val == FWUPD_DEVICE_FLAG_DUAL_IMAGE)
        return "dual-image";
    if (val == FWUPD_DEVICE_FLAG_SELF_RECOVERY)
        return "self-recovery";
    if (val == FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE)
        return "usable-during-update";
    if (val == FWUPD_DEVICE_FLAG_VERSION_CHECK_REQUIRED)
        return "version-check-required";
    if (val == FWUPD_DEVICE_FLAG_INSTALL_ALL_RELEASES)
        return "install-all-releases";
    if (val == FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN)
        return "updatable-hidden";
    if (val == FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES)
        return "has-multiple-branches";
    if (val == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL)
        return "backup-before-install";
    if (val == FWUPD_DEVICE_FLAG_WILDCARD_INSTALL)
        return "wildcard-install";
    if (val == FWUPD_DEVICE_FLAG_ONLY_VERSION_UPGRADE)
        return "only-version-upgrade";
    if (val == FWUPD_DEVICE_FLAG_UNREACHABLE)
        return "unreachable";
    if (val == FWUPD_DEVICE_FLAG_AFFECTS_FDE)
        return "affects-fde";
    if (val == FWUPD_DEVICE_FLAG_END_OF_LIFE)
        return "end-of-life";
    if (val == FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD)
        return "signed-payload";
    if (val == FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD)
        return "unsigned-payload";
    if (val == FWUPD_DEVICE_FLAG_EMULATED)
        return "emulated";
    if (val == FWUPD_DEVICE_FLAG_EMULATION_TAG)
        return "emulation-tag";
    if (val == FWUPD_DEVICE_FLAG_ONLY_EXPLICIT_UPDATES)
        return "only-explicit-updates";
    if (val == FWUPD_DEVICE_FLAG_CAN_EMULATION_TAG)
        return "can-emulation-tag";
    if (val == FWUPD_DEVICE_FLAG_INSTALL_SKIP_VERSION_CHECK)
        return "install-skip-version-check";
    return NULL;
}
/**
 * fwupd_device_flag_from_string:
 * @val: (nullable): a string, e.g. `internal`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 0.7.0
 **/
FwupdDeviceFlags
fwupd_device_flag_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_DEVICE_FLAG_NONE;
    if (g_strcmp0(val, "internal") == 0)
        return FWUPD_DEVICE_FLAG_INTERNAL;
    if (g_strcmp0(val, "updatable") == 0)
        return FWUPD_DEVICE_FLAG_UPDATABLE;
    if (g_strcmp0(val, "require-ac") == 0)
        return FWUPD_DEVICE_FLAG_REQUIRE_AC;
    if (g_strcmp0(val, "locked") == 0)
        return FWUPD_DEVICE_FLAG_LOCKED;
    if (g_strcmp0(val, "supported") == 0)
        return FWUPD_DEVICE_FLAG_SUPPORTED;
    if (g_strcmp0(val, "needs-bootloader") == 0)
        return FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER;
    if (g_strcmp0(val, "needs-reboot") == 0)
        return FWUPD_DEVICE_FLAG_NEEDS_REBOOT;
    if (g_strcmp0(val, "reported") == 0)
        return FWUPD_DEVICE_FLAG_REPORTED;
    if (g_strcmp0(val, "notified") == 0)
        return FWUPD_DEVICE_FLAG_NOTIFIED;
    if (g_strcmp0(val, "is-bootloader") == 0)
        return FWUPD_DEVICE_FLAG_IS_BOOTLOADER;
    if (g_strcmp0(val, "wait-for-replug") == 0)
        return FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG;
    if (g_strcmp0(val, "needs-shutdown") == 0)
        return FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN;
    if (g_strcmp0(val, "another-write-required") == 0)
        return FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED;
    if (g_strcmp0(val, "needs-activation") == 0)
        return FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION;
    if (g_strcmp0(val, "historical") == 0)
        return FWUPD_DEVICE_FLAG_HISTORICAL;
    if (g_strcmp0(val, "will-disappear") == 0)
        return FWUPD_DEVICE_FLAG_WILL_DISAPPEAR;
    if (g_strcmp0(val, "can-verify") == 0)
        return FWUPD_DEVICE_FLAG_CAN_VERIFY;
    if (g_strcmp0(val, "can-verify-image") == 0)
        return FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE;
    if (g_strcmp0(val, "dual-image") == 0)
        return FWUPD_DEVICE_FLAG_DUAL_IMAGE;
    if (g_strcmp0(val, "self-recovery") == 0)
        return FWUPD_DEVICE_FLAG_SELF_RECOVERY;
    if (g_strcmp0(val, "usable-during-update") == 0)
        return FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE;
    if (g_strcmp0(val, "version-check-required") == 0)
        return FWUPD_DEVICE_FLAG_VERSION_CHECK_REQUIRED;
    if (g_strcmp0(val, "install-all-releases") == 0)
        return FWUPD_DEVICE_FLAG_INSTALL_ALL_RELEASES;
    if (g_strcmp0(val, "updatable-hidden") == 0)
        return FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN;
    if (g_strcmp0(val, "has-multiple-branches") == 0)
        return FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES;
    if (g_strcmp0(val, "backup-before-install") == 0)
        return FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL;
    if (g_strcmp0(val, "wildcard-install") == 0)
        return FWUPD_DEVICE_FLAG_WILDCARD_INSTALL;
    if (g_strcmp0(val, "only-version-upgrade") == 0)
        return FWUPD_DEVICE_FLAG_ONLY_VERSION_UPGRADE;
    if (g_strcmp0(val, "unreachable") == 0)
        return FWUPD_DEVICE_FLAG_UNREACHABLE;
    if (g_strcmp0(val, "affects-fde") == 0)
        return FWUPD_DEVICE_FLAG_AFFECTS_FDE;
    if (g_strcmp0(val, "end-of-life") == 0)
        return FWUPD_DEVICE_FLAG_END_OF_LIFE;
    if (g_strcmp0(val, "signed-payload") == 0)
        return FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD;
    if (g_strcmp0(val, "unsigned-payload") == 0)
        return FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD;
    if (g_strcmp0(val, "emulated") == 0)
        return FWUPD_DEVICE_FLAG_EMULATED;
    if (g_strcmp0(val, "emulation-tag") == 0)
        return FWUPD_DEVICE_FLAG_EMULATION_TAG;
    if (g_strcmp0(val, "only-explicit-updates") == 0)
        return FWUPD_DEVICE_FLAG_ONLY_EXPLICIT_UPDATES;
    if (g_strcmp0(val, "can-emulation-tag") == 0)
        return FWUPD_DEVICE_FLAG_CAN_EMULATION_TAG;
    if (g_strcmp0(val, "install-skip-version-check") == 0)
        return FWUPD_DEVICE_FLAG_INSTALL_SKIP_VERSION_CHECK;
    return FWUPD_DEVICE_FLAG_UNKNOWN;
}

/**
 * fwupd_device_problem_to_string:
 * @val: value, e.g. %FWUPD_DEVICE_PROBLEM_SYSTEM_POWER_TOO_LOW
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.8.1
 **/
const gchar *
fwupd_device_problem_to_string(FwupdDeviceProblem val)
{
    if (val == FWUPD_DEVICE_PROBLEM_NONE)
        return "none";
    if (val == FWUPD_DEVICE_PROBLEM_SYSTEM_POWER_TOO_LOW)
        return "system-power-too-low";
    if (val == FWUPD_DEVICE_PROBLEM_UNREACHABLE)
        return "unreachable";
    if (val == FWUPD_DEVICE_PROBLEM_POWER_TOO_LOW)
        return "power-too-low";
    if (val == FWUPD_DEVICE_PROBLEM_UPDATE_PENDING)
        return "update-pending";
    if (val == FWUPD_DEVICE_PROBLEM_REQUIRE_AC_POWER)
        return "require-ac-power";
    if (val == FWUPD_DEVICE_PROBLEM_LID_IS_CLOSED)
        return "lid-is-closed";
    if (val == FWUPD_DEVICE_PROBLEM_IS_EMULATED)
        return "is-emulated";
    if (val == FWUPD_DEVICE_PROBLEM_MISSING_LICENSE)
        return "missing-license";
    if (val == FWUPD_DEVICE_PROBLEM_SYSTEM_INHIBIT)
        return "system-inhibit";
    if (val == FWUPD_DEVICE_PROBLEM_UPDATE_IN_PROGRESS)
        return "update-in-progress";
    if (val == FWUPD_DEVICE_PROBLEM_IN_USE)
        return "in-use";
    if (val == FWUPD_DEVICE_PROBLEM_DISPLAY_REQUIRED)
        return "display-required";
    if (val == FWUPD_DEVICE_PROBLEM_LOWER_PRIORITY)
        return "lower-priority";
    if (val == FWUPD_DEVICE_PROBLEM_INSECURE_PLATFORM)
        return "insecure-platform";
    if (val == FWUPD_DEVICE_PROBLEM_FIRMWARE_LOCKED)
        return "firmware-locked";
    return NULL;
}
/**
 * fwupd_device_problem_from_string:
 * @val: (nullable): a string, e.g. `system-power-too-low`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.8.1
 **/
FwupdDeviceProblem
fwupd_device_problem_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_DEVICE_PROBLEM_NONE;
    if (g_strcmp0(val, "system-power-too-low") == 0)
        return FWUPD_DEVICE_PROBLEM_SYSTEM_POWER_TOO_LOW;
    if (g_strcmp0(val, "unreachable") == 0)
        return FWUPD_DEVICE_PROBLEM_UNREACHABLE;
    if (g_strcmp0(val, "power-too-low") == 0)
        return FWUPD_DEVICE_PROBLEM_POWER_TOO_LOW;
    if (g_strcmp0(val, "update-pending") == 0)
        return FWUPD_DEVICE_PROBLEM_UPDATE_PENDING;
    if (g_strcmp0(val, "require-ac-power") == 0)
        return FWUPD_DEVICE_PROBLEM_REQUIRE_AC_POWER;
    if (g_strcmp0(val, "lid-is-closed") == 0)
        return FWUPD_DEVICE_PROBLEM_LID_IS_CLOSED;
    if (g_strcmp0(val, "is-emulated") == 0)
        return FWUPD_DEVICE_PROBLEM_IS_EMULATED;
    if (g_strcmp0(val, "missing-license") == 0)
        return FWUPD_DEVICE_PROBLEM_MISSING_LICENSE;
    if (g_strcmp0(val, "system-inhibit") == 0)
        return FWUPD_DEVICE_PROBLEM_SYSTEM_INHIBIT;
    if (g_strcmp0(val, "update-in-progress") == 0)
        return FWUPD_DEVICE_PROBLEM_UPDATE_IN_PROGRESS;
    if (g_strcmp0(val, "in-use") == 0)
        return FWUPD_DEVICE_PROBLEM_IN_USE;
    if (g_strcmp0(val, "display-required") == 0)
        return FWUPD_DEVICE_PROBLEM_DISPLAY_REQUIRED;
    if (g_strcmp0(val, "lower-priority") == 0)
        return FWUPD_DEVICE_PROBLEM_LOWER_PRIORITY;
    if (g_strcmp0(val, "insecure-platform") == 0)
        return FWUPD_DEVICE_PROBLEM_INSECURE_PLATFORM;
    if (g_strcmp0(val, "firmware-locked") == 0)
        return FWUPD_DEVICE_PROBLEM_FIRMWARE_LOCKED;
    return FWUPD_DEVICE_PROBLEM_UNKNOWN;
}
