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

#include "config.h"

#include <glib.h>

#include "fwupd-request-struct.h"

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

/**
 * fwupd_request_kind_to_string:
 * @val: value, e.g. %FWUPD_REQUEST_KIND_POST
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.6.2
 **/
const gchar *
fwupd_request_kind_to_string(FwupdRequestKind val)
{
    if (val == FWUPD_REQUEST_KIND_POST)
        return "post";
    if (val == FWUPD_REQUEST_KIND_IMMEDIATE)
        return "immediate";
    return NULL;
}
/**
 * fwupd_request_kind_from_string:
 * @val: (nullable): a string, e.g. `post`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.6.2
 **/
FwupdRequestKind
fwupd_request_kind_from_string(const gchar *val)
{
    if (g_strcmp0(val, "post") == 0)
        return FWUPD_REQUEST_KIND_POST;
    if (g_strcmp0(val, "immediate") == 0)
        return FWUPD_REQUEST_KIND_IMMEDIATE;
    return FWUPD_REQUEST_KIND_UNKNOWN;
}

/**
 * fwupd_request_flag_to_string:
 * @val: value, e.g. %FWUPD_REQUEST_FLAG_ALLOW_GENERIC_MESSAGE
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.8.6
 **/
const gchar *
fwupd_request_flag_to_string(FwupdRequestFlags val)
{
    if (val == FWUPD_REQUEST_FLAG_NONE)
        return "none";
    if (val == FWUPD_REQUEST_FLAG_ALLOW_GENERIC_MESSAGE)
        return "allow-generic-message";
    if (val == FWUPD_REQUEST_FLAG_ALLOW_GENERIC_IMAGE)
        return "allow-generic-image";
    if (val == FWUPD_REQUEST_FLAG_NON_GENERIC_MESSAGE)
        return "non-generic-message";
    if (val == FWUPD_REQUEST_FLAG_NON_GENERIC_IMAGE)
        return "non-generic-image";
    return NULL;
}
/**
 * fwupd_request_flag_from_string:
 * @val: (nullable): a string, e.g. `allow-generic-message`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.8.6
 **/
FwupdRequestFlags
fwupd_request_flag_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FWUPD_REQUEST_FLAG_NONE;
    if (g_strcmp0(val, "allow-generic-message") == 0)
        return FWUPD_REQUEST_FLAG_ALLOW_GENERIC_MESSAGE;
    if (g_strcmp0(val, "allow-generic-image") == 0)
        return FWUPD_REQUEST_FLAG_ALLOW_GENERIC_IMAGE;
    if (g_strcmp0(val, "non-generic-message") == 0)
        return FWUPD_REQUEST_FLAG_NON_GENERIC_MESSAGE;
    if (g_strcmp0(val, "non-generic-image") == 0)
        return FWUPD_REQUEST_FLAG_NON_GENERIC_IMAGE;
    return FWUPD_REQUEST_FLAG_UNKNOWN;
}
