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

#include "config.h"

#include <glib.h>

#include "fu-common-struct.h"

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


/**
 * fu_power_state_to_string:
 * @val: value, e.g. %FU_POWER_STATE_AC
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.8.11
 **/
const gchar *
fu_power_state_to_string(FuPowerState val)
{
    if (val == FU_POWER_STATE_AC)
        return "ac";
    if (val == FU_POWER_STATE_BATTERY)
        return "battery";
    return NULL;
}

/**
 * fu_lid_state_to_string:
 * @val: value, e.g. %FU_LID_STATE_OPEN
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.7.4
 **/
const gchar *
fu_lid_state_to_string(FuLidState val)
{
    if (val == FU_LID_STATE_OPEN)
        return "open";
    if (val == FU_LID_STATE_CLOSED)
        return "closed";
    return NULL;
}

/**
 * fu_display_state_to_string:
 * @val: value, e.g. %FU_DISPLAY_STATE_CONNECTED
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 *
 * Since: 1.9.6
 **/
const gchar *
fu_display_state_to_string(FuDisplayState val)
{
    if (val == FU_DISPLAY_STATE_CONNECTED)
        return "connected";
    if (val == FU_DISPLAY_STATE_DISCONNECTED)
        return "disconnected";
    return NULL;
}
/**
 * fu_display_state_from_string:
 * @val: (nullable): a string, e.g. `connected`
 *
 * Converts a string to an enumerated value.
 *
 * Returns: enumerated value
 *
 * Since: 1.9.6
 **/
FuDisplayState
fu_display_state_from_string(const gchar *val)
{
    if (g_strcmp0(val, "connected") == 0)
        return FU_DISPLAY_STATE_CONNECTED;
    if (g_strcmp0(val, "disconnected") == 0)
        return FU_DISPLAY_STATE_DISCONNECTED;
    return FU_DISPLAY_STATE_UNKNOWN;
}
