/* release-page-result.c generated by valac 0.56.19, the Vala compiler
 * generated from release-page-result.vala, do not modify */

#include "protonplus_core.h"
#include <glib-object.h>
#include <glib.h>
#include <string.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

enum  {
	PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_0_PROPERTY,
	PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_CODE_PROPERTY,
	PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_PAGE_PROPERTY,
	PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_SUCCEEDED_PROPERTY,
	PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_tools_release_page_result_properties[PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ProtonPlusModelsToolsReleasePageResultPrivate {
	ProtonPlusReturnCode _code;
	ProtonPlusModelsToolsReleasePage* _page;
};

static gint ProtonPlusModelsToolsReleasePageResult_private_offset;
static gpointer proton_plus_models_tools_release_page_result_parent_class = NULL;

static ProtonPlusModelsToolsReleasePageResult* proton_plus_models_tools_release_page_result_new (ProtonPlusReturnCode code,
                                                                                          ProtonPlusModelsToolsReleasePage* page);
static ProtonPlusModelsToolsReleasePageResult* proton_plus_models_tools_release_page_result_construct (GType object_type,
                                                                                                ProtonPlusReturnCode code,
                                                                                                ProtonPlusModelsToolsReleasePage* page);
static void proton_plus_models_tools_release_page_result_finalize (GObject * obj);
static GType proton_plus_models_tools_release_page_result_get_type_once (void);
static void _vala_proton_plus_models_tools_release_page_result_get_property (GObject * object,
                                                                      guint property_id,
                                                                      GValue * value,
                                                                      GParamSpec * pspec);
static void _vala_proton_plus_models_tools_release_page_result_set_property (GObject * object,
                                                                      guint property_id,
                                                                      const GValue * value,
                                                                      GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_models_tools_release_page_result_get_instance_private (ProtonPlusModelsToolsReleasePageResult* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsToolsReleasePageResult_private_offset);
}

static ProtonPlusModelsToolsReleasePageResult*
proton_plus_models_tools_release_page_result_construct (GType object_type,
                                                        ProtonPlusReturnCode code,
                                                        ProtonPlusModelsToolsReleasePage* page)
{
	ProtonPlusModelsToolsReleasePageResult * self = NULL;
	self = (ProtonPlusModelsToolsReleasePageResult*) g_object_new (object_type, "code", code, "page", page, NULL);
	return self;
}

static ProtonPlusModelsToolsReleasePageResult*
proton_plus_models_tools_release_page_result_new (ProtonPlusReturnCode code,
                                                  ProtonPlusModelsToolsReleasePage* page)
{
	return proton_plus_models_tools_release_page_result_construct (PROTON_PLUS_MODELS_TOOLS_TYPE_RELEASE_PAGE_RESULT, code, page);
}

ProtonPlusModelsToolsReleasePageResult*
proton_plus_models_tools_release_page_result_success (ProtonPlusModelsToolsReleasePage* page)
{
	ProtonPlusModelsToolsReleasePageResult* _tmp0_;
	ProtonPlusModelsToolsReleasePageResult* result;
	g_return_val_if_fail (page != NULL, NULL);
	_tmp0_ = proton_plus_models_tools_release_page_result_new (PROTON_PLUS_RETURN_CODE_RELEASES_LOADED, page);
	result = _tmp0_;
	return result;
}

ProtonPlusModelsToolsReleasePageResult*
proton_plus_models_tools_release_page_result_failure (ProtonPlusReturnCode code)
{
	ProtonPlusModelsToolsReleasePageResult* _tmp0_;
	ProtonPlusModelsToolsReleasePageResult* result;
	_vala_assert (code != PROTON_PLUS_RETURN_CODE_RELEASES_LOADED, "code != ReturnCode.RELEASES_LOADED");
	_tmp0_ = proton_plus_models_tools_release_page_result_new (code, NULL);
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

ProtonPlusModelsToolsReleasePage*
proton_plus_models_tools_release_page_result_require_page (ProtonPlusModelsToolsReleasePageResult* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	ProtonPlusModelsToolsReleasePage* _tmp4_;
	ProtonPlusModelsToolsReleasePage* _tmp5_;
	ProtonPlusModelsToolsReleasePage* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = proton_plus_models_tools_release_page_result_get_succeeded (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		ProtonPlusModelsToolsReleasePage* _tmp3_;
		_tmp3_ = self->priv->_page;
		_tmp0_ = _tmp3_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	_vala_assert (_tmp0_, "succeeded && page != null");
	_tmp4_ = self->priv->_page;
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, PROTON_PLUS_MODELS_TOOLS_TYPE_RELEASE_PAGE, ProtonPlusModelsToolsReleasePage));
	result = _tmp5_;
	return result;
}

ProtonPlusReturnCode
proton_plus_models_tools_release_page_result_get_code (ProtonPlusModelsToolsReleasePageResult* self)
{
	ProtonPlusReturnCode result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_code;
	return result;
}

static void
proton_plus_models_tools_release_page_result_set_code (ProtonPlusModelsToolsReleasePageResult* self,
                                                       ProtonPlusReturnCode value)
{
	ProtonPlusReturnCode old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_tools_release_page_result_get_code (self);
	if (old_value != value) {
		self->priv->_code = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_tools_release_page_result_properties[PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_CODE_PROPERTY]);
	}
}

ProtonPlusModelsToolsReleasePage*
proton_plus_models_tools_release_page_result_get_page (ProtonPlusModelsToolsReleasePageResult* self)
{
	ProtonPlusModelsToolsReleasePage* result;
	ProtonPlusModelsToolsReleasePage* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_page;
	result = _tmp0_;
	return result;
}

static void
proton_plus_models_tools_release_page_result_set_page (ProtonPlusModelsToolsReleasePageResult* self,
                                                       ProtonPlusModelsToolsReleasePage* value)
{
	ProtonPlusModelsToolsReleasePage* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_tools_release_page_result_get_page (self);
	if (old_value != value) {
		ProtonPlusModelsToolsReleasePage* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_page);
		self->priv->_page = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_tools_release_page_result_properties[PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_PAGE_PROPERTY]);
	}
}

gboolean
proton_plus_models_tools_release_page_result_get_succeeded (ProtonPlusModelsToolsReleasePageResult* self)
{
	gboolean result;
	ProtonPlusReturnCode _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_code;
	result = _tmp0_ == PROTON_PLUS_RETURN_CODE_RELEASES_LOADED;
	return result;
}

static void
proton_plus_models_tools_release_page_result_class_init (ProtonPlusModelsToolsReleasePageResultClass * klass,
                                                         gpointer klass_data)
{
	proton_plus_models_tools_release_page_result_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsToolsReleasePageResult_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_tools_release_page_result_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_models_tools_release_page_result_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_tools_release_page_result_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_CODE_PROPERTY, proton_plus_models_tools_release_page_result_properties[PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_CODE_PROPERTY] = g_param_spec_enum ("code", "code", "code", PROTON_PLUS_TYPE_RETURN_CODE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_PAGE_PROPERTY, proton_plus_models_tools_release_page_result_properties[PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_PAGE_PROPERTY] = g_param_spec_object ("page", "page", "page", PROTON_PLUS_MODELS_TOOLS_TYPE_RELEASE_PAGE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_SUCCEEDED_PROPERTY, proton_plus_models_tools_release_page_result_properties[PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_SUCCEEDED_PROPERTY] = g_param_spec_boolean ("succeeded", "succeeded", "succeeded", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_models_tools_release_page_result_instance_init (ProtonPlusModelsToolsReleasePageResult * self,
                                                            gpointer klass)
{
	self->priv = proton_plus_models_tools_release_page_result_get_instance_private (self);
}

static void
proton_plus_models_tools_release_page_result_finalize (GObject * obj)
{
	ProtonPlusModelsToolsReleasePageResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_TOOLS_TYPE_RELEASE_PAGE_RESULT, ProtonPlusModelsToolsReleasePageResult);
	_g_object_unref0 (self->priv->_page);
	G_OBJECT_CLASS (proton_plus_models_tools_release_page_result_parent_class)->finalize (obj);
}

static GType
proton_plus_models_tools_release_page_result_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsToolsReleasePageResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_tools_release_page_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsToolsReleasePageResult), 0, (GInstanceInitFunc) proton_plus_models_tools_release_page_result_instance_init, NULL };
	GType proton_plus_models_tools_release_page_result_type_id;
	proton_plus_models_tools_release_page_result_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsToolsReleasePageResult", &g_define_type_info, 0);
	ProtonPlusModelsToolsReleasePageResult_private_offset = g_type_add_instance_private (proton_plus_models_tools_release_page_result_type_id, sizeof (ProtonPlusModelsToolsReleasePageResultPrivate));
	return proton_plus_models_tools_release_page_result_type_id;
}

GType
proton_plus_models_tools_release_page_result_get_type (void)
{
	static volatile gsize proton_plus_models_tools_release_page_result_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_tools_release_page_result_type_id__once)) {
		GType proton_plus_models_tools_release_page_result_type_id;
		proton_plus_models_tools_release_page_result_type_id = proton_plus_models_tools_release_page_result_get_type_once ();
		g_once_init_leave (&proton_plus_models_tools_release_page_result_type_id__once, proton_plus_models_tools_release_page_result_type_id);
	}
	return proton_plus_models_tools_release_page_result_type_id__once;
}

static void
_vala_proton_plus_models_tools_release_page_result_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec)
{
	ProtonPlusModelsToolsReleasePageResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TOOLS_TYPE_RELEASE_PAGE_RESULT, ProtonPlusModelsToolsReleasePageResult);
	switch (property_id) {
		case PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_CODE_PROPERTY:
		g_value_set_enum (value, proton_plus_models_tools_release_page_result_get_code (self));
		break;
		case PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_PAGE_PROPERTY:
		g_value_set_object (value, proton_plus_models_tools_release_page_result_get_page (self));
		break;
		case PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_SUCCEEDED_PROPERTY:
		g_value_set_boolean (value, proton_plus_models_tools_release_page_result_get_succeeded (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_models_tools_release_page_result_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec)
{
	ProtonPlusModelsToolsReleasePageResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_TOOLS_TYPE_RELEASE_PAGE_RESULT, ProtonPlusModelsToolsReleasePageResult);
	switch (property_id) {
		case PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_CODE_PROPERTY:
		proton_plus_models_tools_release_page_result_set_code (self, g_value_get_enum (value));
		break;
		case PROTON_PLUS_MODELS_TOOLS_RELEASE_PAGE_RESULT_PAGE_PROPERTY:
		proton_plus_models_tools_release_page_result_set_page (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

