/* priority.c generated by valac 0.56.19, the Vala compiler
 * generated from priority.vala, do not modify */

/*
 * Copyright (c) 2024-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

gchar*
ft_priority_to_string (FtPriority self)
{
	gchar* result;
	switch (self) {
		case FT_PRIORITY_LOW:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("low");
			result = _tmp0_;
			return result;
		}
		case FT_PRIORITY_DEFAULT:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("default");
			result = _tmp1_;
			return result;
		}
		case FT_PRIORITY_HIGH:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("high");
			result = _tmp2_;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

FtPriority
ft_priority_from_string (const gchar* priority)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	FtPriority result;
	_tmp0_ = priority;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("low")))) {
		switch (0) {
			default:
			{
				result = FT_PRIORITY_LOW;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("default")))) {
		switch (0) {
			default:
			{
				result = FT_PRIORITY_DEFAULT;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("high")))) {
		switch (0) {
			default:
			{
				result = FT_PRIORITY_HIGH;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = FT_PRIORITY_DEFAULT;
				return result;
			}
		}
	}
}

static GType
ft_priority_get_type_once (void)
{
	static const GEnumValue values[] = {{FT_PRIORITY_LOW, "FT_PRIORITY_LOW", "low"}, {FT_PRIORITY_DEFAULT, "FT_PRIORITY_DEFAULT", "default"}, {FT_PRIORITY_HIGH, "FT_PRIORITY_HIGH", "high"}, {0, NULL, NULL}};
	GType ft_priority_type_id;
	ft_priority_type_id = g_enum_register_static ("FtPriority", values);
	return ft_priority_type_id;
}

GType
ft_priority_get_type (void)
{
	static volatile gsize ft_priority_type_id__once = 0;
	if (g_once_init_enter (&ft_priority_type_id__once)) {
		GType ft_priority_type_id;
		ft_priority_type_id = ft_priority_get_type_once ();
		g_once_init_leave (&ft_priority_type_id__once, ft_priority_type_id);
	}
	return ft_priority_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

