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

#include "config.h"

#include <glib.h>

#include "fwupd-enums-struct.h"

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

/**
 * fwupd_status_to_string:
 * @val: value, e.g. %FWUPD_STATUS_IDLE
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 0.1.1
 **/
const gchar *
fwupd_status_to_string(FwupdStatus val)
{
    if (val == FWUPD_STATUS_IDLE)
        return "idle";
    if (val == FWUPD_STATUS_LOADING)
        return "loading";
    if (val == FWUPD_STATUS_DECOMPRESSING)
        return "decompressing";
    if (val == FWUPD_STATUS_DEVICE_RESTART)
        return "device-restart";
    if (val == FWUPD_STATUS_DEVICE_WRITE)
        return "device-write";
    if (val == FWUPD_STATUS_DEVICE_VERIFY)
        return "device-verify";
    if (val == FWUPD_STATUS_SCHEDULING)
        return "scheduling";
    if (val == FWUPD_STATUS_DOWNLOADING)
        return "downloading";
    if (val == FWUPD_STATUS_DEVICE_READ)
        return "device-read";
    if (val == FWUPD_STATUS_DEVICE_ERASE)
        return "device-erase";
    if (val == FWUPD_STATUS_WAITING_FOR_AUTH)
        return "waiting-for-auth";
    if (val == FWUPD_STATUS_DEVICE_BUSY)
        return "device-busy";
    if (val == FWUPD_STATUS_SHUTDOWN)
        return "shutdown";
    if (val == FWUPD_STATUS_WAITING_FOR_USER)
        return "waiting-for-user";
    return NULL;
}
/**
 * fwupd_status_from_string:
 * @val: (nullable): a string, e.g. `idle`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 0.1.1
 **/
FwupdStatus
fwupd_status_from_string(const gchar *val)
{
    if (g_strcmp0(val, "idle") == 0)
        return FWUPD_STATUS_IDLE;
    if (g_strcmp0(val, "loading") == 0)
        return FWUPD_STATUS_LOADING;
    if (g_strcmp0(val, "decompressing") == 0)
        return FWUPD_STATUS_DECOMPRESSING;
    if (g_strcmp0(val, "device-restart") == 0)
        return FWUPD_STATUS_DEVICE_RESTART;
    if (g_strcmp0(val, "device-write") == 0)
        return FWUPD_STATUS_DEVICE_WRITE;
    if (g_strcmp0(val, "device-verify") == 0)
        return FWUPD_STATUS_DEVICE_VERIFY;
    if (g_strcmp0(val, "scheduling") == 0)
        return FWUPD_STATUS_SCHEDULING;
    if (g_strcmp0(val, "downloading") == 0)
        return FWUPD_STATUS_DOWNLOADING;
    if (g_strcmp0(val, "device-read") == 0)
        return FWUPD_STATUS_DEVICE_READ;
    if (g_strcmp0(val, "device-erase") == 0)
        return FWUPD_STATUS_DEVICE_ERASE;
    if (g_strcmp0(val, "waiting-for-auth") == 0)
        return FWUPD_STATUS_WAITING_FOR_AUTH;
    if (g_strcmp0(val, "device-busy") == 0)
        return FWUPD_STATUS_DEVICE_BUSY;
    if (g_strcmp0(val, "shutdown") == 0)
        return FWUPD_STATUS_SHUTDOWN;
    if (g_strcmp0(val, "waiting-for-user") == 0)
        return FWUPD_STATUS_WAITING_FOR_USER;
    return FWUPD_STATUS_UNKNOWN;
}

/**
 * fwupd_feature_flag_to_string:
 * @val: value, e.g. %FWUPD_FEATURE_FLAG_CAN_REPORT
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.4.5
 **/
const gchar *
fwupd_feature_flag_to_string(FwupdFeatureFlags val)
{
    if (val == FWUPD_FEATURE_FLAG_NONE)
        return "none";
    if (val == FWUPD_FEATURE_FLAG_CAN_REPORT)
        return "can-report";
    if (val == FWUPD_FEATURE_FLAG_DETACH_ACTION)
        return "detach-action";
    if (val == FWUPD_FEATURE_FLAG_UPDATE_ACTION)
        return "update-action";
    if (val == FWUPD_FEATURE_FLAG_SWITCH_BRANCH)
        return "switch-branch";
    if (val == FWUPD_FEATURE_FLAG_REQUESTS)
        return "requests";
    if (val == FWUPD_FEATURE_FLAG_FDE_WARNING)
        return "fde-warning";
    if (val == FWUPD_FEATURE_FLAG_COMMUNITY_TEXT)
        return "community-text";
    if (val == FWUPD_FEATURE_FLAG_SHOW_PROBLEMS)
        return "show-problems";
    if (val == FWUPD_FEATURE_FLAG_ALLOW_AUTHENTICATION)
        return "allow-authentication";
    if (val == FWUPD_FEATURE_FLAG_REQUESTS_NON_GENERIC)
        return "requests-non-generic";
    return NULL;
}
/**
 * fwupd_feature_flag_from_string:
 * @val: (nullable): a string, e.g. `can-report`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.4.5
 **/
FwupdFeatureFlags
fwupd_feature_flag_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_FEATURE_FLAG_NONE;
    if (g_strcmp0(val, "can-report") == 0)
        return FWUPD_FEATURE_FLAG_CAN_REPORT;
    if (g_strcmp0(val, "detach-action") == 0)
        return FWUPD_FEATURE_FLAG_DETACH_ACTION;
    if (g_strcmp0(val, "update-action") == 0)
        return FWUPD_FEATURE_FLAG_UPDATE_ACTION;
    if (g_strcmp0(val, "switch-branch") == 0)
        return FWUPD_FEATURE_FLAG_SWITCH_BRANCH;
    if (g_strcmp0(val, "requests") == 0)
        return FWUPD_FEATURE_FLAG_REQUESTS;
    if (g_strcmp0(val, "fde-warning") == 0)
        return FWUPD_FEATURE_FLAG_FDE_WARNING;
    if (g_strcmp0(val, "community-text") == 0)
        return FWUPD_FEATURE_FLAG_COMMUNITY_TEXT;
    if (g_strcmp0(val, "show-problems") == 0)
        return FWUPD_FEATURE_FLAG_SHOW_PROBLEMS;
    if (g_strcmp0(val, "allow-authentication") == 0)
        return FWUPD_FEATURE_FLAG_ALLOW_AUTHENTICATION;
    if (g_strcmp0(val, "requests-non-generic") == 0)
        return FWUPD_FEATURE_FLAG_REQUESTS_NON_GENERIC;
    return FWUPD_FEATURE_FLAG_UNKNOWN;
}

/**
 * fwupd_install_flags_to_string:
 * @val: value, e.g. %FWUPD_INSTALL_FLAG_ALLOW_REINSTALL
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 2.0.0
 **/
const gchar *
fwupd_install_flags_to_string(FwupdInstallFlags val)
{
    if (val == FWUPD_INSTALL_FLAG_NONE)
        return "none";
    if (val == FWUPD_INSTALL_FLAG_ALLOW_REINSTALL)
        return "allow-reinstall";
    if (val == FWUPD_INSTALL_FLAG_ALLOW_OLDER)
        return "allow-older";
    if (val == FWUPD_INSTALL_FLAG_FORCE)
        return "force";
    if (val == FWUPD_INSTALL_FLAG_NO_HISTORY)
        return "no-history";
    if (val == FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH)
        return "allow-branch-switch";
    if (val == FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM)
        return "ignore-checksum";
    if (val == FWUPD_INSTALL_FLAG_IGNORE_VID_PID)
        return "ignore-vid-pid";
    if (val == FWUPD_INSTALL_FLAG_NO_SEARCH)
        return "no-search";
    if (val == FWUPD_INSTALL_FLAG_IGNORE_REQUIREMENTS)
        return "ignore-requirements";
    if (val == FWUPD_INSTALL_FLAG_ONLY_EMULATED)
        return "only-emulated";
    return NULL;
}
/**
 * fwupd_install_flags_from_string:
 * @val: (nullable): a string, e.g. `allow-reinstall`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 2.0.4
 **/
FwupdInstallFlags
fwupd_install_flags_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_INSTALL_FLAG_NONE;
    if (g_strcmp0(val, "allow-reinstall") == 0)
        return FWUPD_INSTALL_FLAG_ALLOW_REINSTALL;
    if (g_strcmp0(val, "allow-older") == 0)
        return FWUPD_INSTALL_FLAG_ALLOW_OLDER;
    if (g_strcmp0(val, "force") == 0)
        return FWUPD_INSTALL_FLAG_FORCE;
    if (g_strcmp0(val, "no-history") == 0)
        return FWUPD_INSTALL_FLAG_NO_HISTORY;
    if (g_strcmp0(val, "allow-branch-switch") == 0)
        return FWUPD_INSTALL_FLAG_ALLOW_BRANCH_SWITCH;
    if (g_strcmp0(val, "ignore-checksum") == 0)
        return FWUPD_INSTALL_FLAG_IGNORE_CHECKSUM;
    if (g_strcmp0(val, "ignore-vid-pid") == 0)
        return FWUPD_INSTALL_FLAG_IGNORE_VID_PID;
    if (g_strcmp0(val, "no-search") == 0)
        return FWUPD_INSTALL_FLAG_NO_SEARCH;
    if (g_strcmp0(val, "ignore-requirements") == 0)
        return FWUPD_INSTALL_FLAG_IGNORE_REQUIREMENTS;
    if (g_strcmp0(val, "only-emulated") == 0)
        return FWUPD_INSTALL_FLAG_ONLY_EMULATED;
    return FWUPD_INSTALL_FLAG_UNKNOWN;
}


/**
 * fwupd_update_state_to_string:
 * @val: value, e.g. %FWUPD_UPDATE_STATE_PENDING
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 0.7.0
 **/
const gchar *
fwupd_update_state_to_string(FwupdUpdateState val)
{
    if (val == FWUPD_UPDATE_STATE_PENDING)
        return "pending";
    if (val == FWUPD_UPDATE_STATE_SUCCESS)
        return "success";
    if (val == FWUPD_UPDATE_STATE_FAILED)
        return "failed";
    if (val == FWUPD_UPDATE_STATE_NEEDS_REBOOT)
        return "needs-reboot";
    if (val == FWUPD_UPDATE_STATE_FAILED_TRANSIENT)
        return "failed-transient";
    return NULL;
}
/**
 * fwupd_update_state_from_string:
 * @val: (nullable): a string, e.g. `pending`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 0.7.0
 **/
FwupdUpdateState
fwupd_update_state_from_string(const gchar *val)
{
    if (g_strcmp0(val, "pending") == 0)
        return FWUPD_UPDATE_STATE_PENDING;
    if (g_strcmp0(val, "success") == 0)
        return FWUPD_UPDATE_STATE_SUCCESS;
    if (g_strcmp0(val, "failed") == 0)
        return FWUPD_UPDATE_STATE_FAILED;
    if (g_strcmp0(val, "needs-reboot") == 0)
        return FWUPD_UPDATE_STATE_NEEDS_REBOOT;
    if (g_strcmp0(val, "failed-transient") == 0)
        return FWUPD_UPDATE_STATE_FAILED_TRANSIENT;
    return FWUPD_UPDATE_STATE_UNKNOWN;
}

/**
 * fwupd_version_format_to_string:
 * @val: value, e.g. %FWUPD_VERSION_FORMAT_PLAIN
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.2.9
 **/
const gchar *
fwupd_version_format_to_string(FwupdVersionFormat val)
{
    if (val == FWUPD_VERSION_FORMAT_PLAIN)
        return "plain";
    if (val == FWUPD_VERSION_FORMAT_NUMBER)
        return "number";
    if (val == FWUPD_VERSION_FORMAT_PAIR)
        return "pair";
    if (val == FWUPD_VERSION_FORMAT_TRIPLET)
        return "triplet";
    if (val == FWUPD_VERSION_FORMAT_QUAD)
        return "quad";
    if (val == FWUPD_VERSION_FORMAT_BCD)
        return "bcd";
    if (val == FWUPD_VERSION_FORMAT_INTEL_ME)
        return "intel-me";
    if (val == FWUPD_VERSION_FORMAT_INTEL_ME2)
        return "intel-me2";
    if (val == FWUPD_VERSION_FORMAT_SURFACE_LEGACY)
        return "surface-legacy";
    if (val == FWUPD_VERSION_FORMAT_SURFACE)
        return "surface";
    if (val == FWUPD_VERSION_FORMAT_DELL_BIOS)
        return "dell-bios";
    if (val == FWUPD_VERSION_FORMAT_HEX)
        return "hex";
    if (val == FWUPD_VERSION_FORMAT_DELL_BIOS_MSB)
        return "dell-bios-msb";
    if (val == FWUPD_VERSION_FORMAT_INTEL_CSME19)
        return "intel-csme19";
    return NULL;
}
/**
 * fwupd_version_format_from_string:
 * @val: (nullable): a string, e.g. `plain`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.2.9
 **/
FwupdVersionFormat
fwupd_version_format_from_string(const gchar *val)
{
    if (g_strcmp0(val, "plain") == 0)
        return FWUPD_VERSION_FORMAT_PLAIN;
    if (g_strcmp0(val, "number") == 0)
        return FWUPD_VERSION_FORMAT_NUMBER;
    if (g_strcmp0(val, "pair") == 0)
        return FWUPD_VERSION_FORMAT_PAIR;
    if (g_strcmp0(val, "triplet") == 0)
        return FWUPD_VERSION_FORMAT_TRIPLET;
    if (g_strcmp0(val, "quad") == 0)
        return FWUPD_VERSION_FORMAT_QUAD;
    if (g_strcmp0(val, "bcd") == 0)
        return FWUPD_VERSION_FORMAT_BCD;
    if (g_strcmp0(val, "intel-me") == 0)
        return FWUPD_VERSION_FORMAT_INTEL_ME;
    if (g_strcmp0(val, "intel-me2") == 0)
        return FWUPD_VERSION_FORMAT_INTEL_ME2;
    if (g_strcmp0(val, "surface-legacy") == 0)
        return FWUPD_VERSION_FORMAT_SURFACE_LEGACY;
    if (g_strcmp0(val, "surface") == 0)
        return FWUPD_VERSION_FORMAT_SURFACE;
    if (g_strcmp0(val, "dell-bios") == 0)
        return FWUPD_VERSION_FORMAT_DELL_BIOS;
    if (g_strcmp0(val, "hex") == 0)
        return FWUPD_VERSION_FORMAT_HEX;
    if (g_strcmp0(val, "dell-bios-msb") == 0)
        return FWUPD_VERSION_FORMAT_DELL_BIOS_MSB;
    if (g_strcmp0(val, "intel-csme19") == 0)
        return FWUPD_VERSION_FORMAT_INTEL_CSME19;
    return FWUPD_VERSION_FORMAT_UNKNOWN;
}
