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

#include "config.h"

#include <glib.h>

#include "fwupd-release-struct.h"

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

/**
 * fwupd_release_flag_to_string:
 * @val: value, e.g. %FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.2.6
 **/
const gchar *
fwupd_release_flag_to_string(FwupdReleaseFlags val)
{
    if (val == FWUPD_RELEASE_FLAG_NONE)
        return "none";
    if (val == FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD)
        return "trusted-payload";
    if (val == FWUPD_RELEASE_FLAG_TRUSTED_METADATA)
        return "trusted-metadata";
    if (val == FWUPD_RELEASE_FLAG_IS_UPGRADE)
        return "is-upgrade";
    if (val == FWUPD_RELEASE_FLAG_IS_DOWNGRADE)
        return "is-downgrade";
    if (val == FWUPD_RELEASE_FLAG_BLOCKED_VERSION)
        return "blocked-version";
    if (val == FWUPD_RELEASE_FLAG_BLOCKED_APPROVAL)
        return "blocked-approval";
    if (val == FWUPD_RELEASE_FLAG_IS_ALTERNATE_BRANCH)
        return "is-alternate-branch";
    if (val == FWUPD_RELEASE_FLAG_IS_COMMUNITY)
        return "is-community";
    if (val == FWUPD_RELEASE_FLAG_TRUSTED_REPORT)
        return "trusted-report";
    return NULL;
}
/**
 * fwupd_release_flag_from_string:
 * @val: (nullable): a string, e.g. `trusted-payload`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.2.6
 **/
FwupdReleaseFlags
fwupd_release_flag_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_RELEASE_FLAG_NONE;
    if (g_strcmp0(val, "trusted-payload") == 0)
        return FWUPD_RELEASE_FLAG_TRUSTED_PAYLOAD;
    if (g_strcmp0(val, "trusted-metadata") == 0)
        return FWUPD_RELEASE_FLAG_TRUSTED_METADATA;
    if (g_strcmp0(val, "is-upgrade") == 0)
        return FWUPD_RELEASE_FLAG_IS_UPGRADE;
    if (g_strcmp0(val, "is-downgrade") == 0)
        return FWUPD_RELEASE_FLAG_IS_DOWNGRADE;
    if (g_strcmp0(val, "blocked-version") == 0)
        return FWUPD_RELEASE_FLAG_BLOCKED_VERSION;
    if (g_strcmp0(val, "blocked-approval") == 0)
        return FWUPD_RELEASE_FLAG_BLOCKED_APPROVAL;
    if (g_strcmp0(val, "is-alternate-branch") == 0)
        return FWUPD_RELEASE_FLAG_IS_ALTERNATE_BRANCH;
    if (g_strcmp0(val, "is-community") == 0)
        return FWUPD_RELEASE_FLAG_IS_COMMUNITY;
    if (g_strcmp0(val, "trusted-report") == 0)
        return FWUPD_RELEASE_FLAG_TRUSTED_REPORT;
    return FWUPD_RELEASE_FLAG_UNKNOWN;
}

/**
 * fwupd_release_urgency_to_string:
 * @val: value, e.g. %FWUPD_RELEASE_URGENCY_LOW
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.4.0
 **/
const gchar *
fwupd_release_urgency_to_string(FwupdReleaseUrgency val)
{
    if (val == FWUPD_RELEASE_URGENCY_LOW)
        return "low";
    if (val == FWUPD_RELEASE_URGENCY_MEDIUM)
        return "medium";
    if (val == FWUPD_RELEASE_URGENCY_HIGH)
        return "high";
    if (val == FWUPD_RELEASE_URGENCY_CRITICAL)
        return "critical";
    return NULL;
}
/**
 * fwupd_release_urgency_from_string:
 * @val: (nullable): a string, e.g. `low`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.4.0
 **/
FwupdReleaseUrgency
fwupd_release_urgency_from_string(const gchar *val)
{
    if (g_strcmp0(val, "low") == 0)
        return FWUPD_RELEASE_URGENCY_LOW;
    if (g_strcmp0(val, "medium") == 0)
        return FWUPD_RELEASE_URGENCY_MEDIUM;
    if (g_strcmp0(val, "high") == 0)
        return FWUPD_RELEASE_URGENCY_HIGH;
    if (g_strcmp0(val, "critical") == 0)
        return FWUPD_RELEASE_URGENCY_CRITICAL;
    return FWUPD_RELEASE_URGENCY_UNKNOWN;
}
