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

#include "config.h"

#include <glib.h>

#include "fwupd-remote-struct.h"

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

/**
 * fwupd_remote_kind_to_string:
 * @val: value, e.g. %FWUPD_REMOTE_KIND_DOWNLOAD
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 0.9.6
 **/
const gchar *
fwupd_remote_kind_to_string(FwupdRemoteKind val)
{
    if (val == FWUPD_REMOTE_KIND_DOWNLOAD)
        return "download";
    if (val == FWUPD_REMOTE_KIND_LOCAL)
        return "local";
    if (val == FWUPD_REMOTE_KIND_DIRECTORY)
        return "directory";
    return NULL;
}
/**
 * fwupd_remote_kind_from_string:
 * @val: (nullable): a string, e.g. `download`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 0.9.6
 **/
FwupdRemoteKind
fwupd_remote_kind_from_string(const gchar *val)
{
    if (g_strcmp0(val, "download") == 0)
        return FWUPD_REMOTE_KIND_DOWNLOAD;
    if (g_strcmp0(val, "local") == 0)
        return FWUPD_REMOTE_KIND_LOCAL;
    if (g_strcmp0(val, "directory") == 0)
        return FWUPD_REMOTE_KIND_DIRECTORY;
    return FWUPD_REMOTE_KIND_UNKNOWN;
}

/**
 * fwupd_remote_flag_to_string:
 * @val: value, e.g. %FWUPD_REMOTE_FLAG_ENABLED
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.9.4
 **/
const gchar *
fwupd_remote_flag_to_string(FwupdRemoteFlags val)
{
    if (val == FWUPD_REMOTE_FLAG_NONE)
        return "none";
    if (val == FWUPD_REMOTE_FLAG_ENABLED)
        return "enabled";
    if (val == FWUPD_REMOTE_FLAG_APPROVAL_REQUIRED)
        return "approval-required";
    if (val == FWUPD_REMOTE_FLAG_AUTOMATIC_REPORTS)
        return "automatic-reports";
    if (val == FWUPD_REMOTE_FLAG_AUTOMATIC_SECURITY_REPORTS)
        return "automatic-security-reports";
    if (val == FWUPD_REMOTE_FLAG_ALLOW_P2P_METADATA)
        return "allow-p2p-metadata";
    if (val == FWUPD_REMOTE_FLAG_ALLOW_P2P_FIRMWARE)
        return "allow-p2p-firmware";
    if (val == FWUPD_REMOTE_FLAG_NO_PHASED_UPDATES)
        return "no-phased-updates";
    return NULL;
}
/**
 * fwupd_remote_flag_from_string:
 * @val: (nullable): a string, e.g. `enabled`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.9.4
 **/
FwupdRemoteFlags
fwupd_remote_flag_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_REMOTE_FLAG_NONE;
    if (g_strcmp0(val, "enabled") == 0)
        return FWUPD_REMOTE_FLAG_ENABLED;
    if (g_strcmp0(val, "approval-required") == 0)
        return FWUPD_REMOTE_FLAG_APPROVAL_REQUIRED;
    if (g_strcmp0(val, "automatic-reports") == 0)
        return FWUPD_REMOTE_FLAG_AUTOMATIC_REPORTS;
    if (g_strcmp0(val, "automatic-security-reports") == 0)
        return FWUPD_REMOTE_FLAG_AUTOMATIC_SECURITY_REPORTS;
    if (g_strcmp0(val, "allow-p2p-metadata") == 0)
        return FWUPD_REMOTE_FLAG_ALLOW_P2P_METADATA;
    if (g_strcmp0(val, "allow-p2p-firmware") == 0)
        return FWUPD_REMOTE_FLAG_ALLOW_P2P_FIRMWARE;
    if (g_strcmp0(val, "no-phased-updates") == 0)
        return FWUPD_REMOTE_FLAG_NO_PHASED_UPDATES;
    return FWUPD_REMOTE_FLAG_NONE;
}
