/* auto-generated, do not modify */
#include "config.h"

#include "fu-engine-struct.h"
#include "fu-byte-array.h"
#include "fu-mem-private.h"
#include "fu-string.h"

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

FuReleasePriority
fu_release_priority_from_string(const gchar *val)
{
    if (g_strcmp0(val, "none") == 0)
        return FU_RELEASE_PRIORITY_NONE;
    if (g_strcmp0(val, "local") == 0)
        return FU_RELEASE_PRIORITY_LOCAL;
    if (g_strcmp0(val, "remote") == 0)
        return FU_RELEASE_PRIORITY_REMOTE;
    return FU_RELEASE_PRIORITY_NONE;
}

FuP2pPolicy
fu_p2p_policy_from_string(const gchar *val)
{
    if (g_strcmp0(val, "nothing") == 0)
        return FU_P2P_POLICY_NOTHING;
    if (g_strcmp0(val, "metadata") == 0)
        return FU_P2P_POLICY_METADATA;
    if (g_strcmp0(val, "firmware") == 0)
        return FU_P2P_POLICY_FIRMWARE;
    return FU_P2P_POLICY_NOTHING;
}

const gchar *
fu_engine_install_phase_to_string(FuEngineInstallPhase val)
{
    if (val == FU_ENGINE_INSTALL_PHASE_SETUP)
        return "setup";
    if (val == FU_ENGINE_INSTALL_PHASE_INSTALL)
        return "install";
    if (val == FU_ENGINE_INSTALL_PHASE_ATTACH)
        return "attach";
    if (val == FU_ENGINE_INSTALL_PHASE_DETACH)
        return "detach";
    if (val == FU_ENGINE_INSTALL_PHASE_PREPARE)
        return "prepare";
    if (val == FU_ENGINE_INSTALL_PHASE_CLEANUP)
        return "cleanup";
    if (val == FU_ENGINE_INSTALL_PHASE_RELOAD)
        return "reload";
    if (val == FU_ENGINE_INSTALL_PHASE_COMPOSITE_PREPARE)
        return "composite-prepare";
    if (val == FU_ENGINE_INSTALL_PHASE_COMPOSITE_CLEANUP)
        return "composite-cleanup";
    if (val == FU_ENGINE_INSTALL_PHASE_LAST)
        return "last";
    return NULL;
}

gchar *
fu_engine_request_flag_to_string(FuEngineRequestFlag val)
{
    const gchar *data[3] = {0};
    guint idx = 0;
    if (val == FU_ENGINE_REQUEST_FLAG_NONE)
        return g_strdup("none");
    if (val & FU_ENGINE_REQUEST_FLAG_NO_REQUIREMENTS)
        data[idx++] = "no-requirements";
    if (val & FU_ENGINE_REQUEST_FLAG_ANY_RELEASE)
        data[idx++] = "any-release";
    return g_strjoinv(",", (gchar **)data);
}

gchar *
fu_idle_inhibit_to_string(FuIdleInhibit val)
{
    const gchar *data[3] = {0};
    guint idx = 0;
    if (val == FU_IDLE_INHIBIT_NONE)
        return g_strdup("none");
    if (val & FU_IDLE_INHIBIT_TIMEOUT)
        data[idx++] = "timeout";
    if (val & FU_IDLE_INHIBIT_SIGNALS)
        data[idx++] = "signals";
    return g_strjoinv(",", (gchar **)data);
}

