/* steam-restart-state-store.c generated by valac 0.56.19, the Vala compiler
 * generated from steam-restart-state-store.vala, do not modify */

#include "protonplus_core.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <json-glib/json-glib.h>
#include <gio/gio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>

#define PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_SCHEMA_VERSION 2
#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_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_0_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_RECORDS_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_ERROR_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_steam_restart_state_load_result_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_0_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_PATH_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_LAST_ERROR_PROPERTY,
	PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_steam_restart_state_store_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _json_array_unref0(var) ((var == NULL) ? NULL : (var = (json_array_unref (var), NULL)))

struct _ProtonPlusServicesSteamRestartStateLoadResultPrivate {
	GeeList* _records;
	gchar* _error;
};

struct _ProtonPlusServicesSteamRestartStateStorePrivate {
	gchar* _path;
	gchar* _last_error;
};

static gint ProtonPlusServicesSteamRestartStateLoadResult_private_offset;
static gpointer proton_plus_services_steam_restart_state_load_result_parent_class = NULL;
static gint ProtonPlusServicesSteamRestartStateStore_private_offset;
static gpointer proton_plus_services_steam_restart_state_store_parent_class = NULL;

static void proton_plus_services_steam_restart_state_load_result_set_records (ProtonPlusServicesSteamRestartStateLoadResult* self,
                                                                       GeeList* value);
static void proton_plus_services_steam_restart_state_load_result_set_error (ProtonPlusServicesSteamRestartStateLoadResult* self,
                                                                     const gchar* value);
static void proton_plus_services_steam_restart_state_load_result_finalize (GObject * obj);
static GType proton_plus_services_steam_restart_state_load_result_get_type_once (void);
static void _vala_proton_plus_services_steam_restart_state_load_result_get_property (GObject * object,
                                                                              guint property_id,
                                                                              GValue * value,
                                                                              GParamSpec * pspec);
static void _vala_proton_plus_services_steam_restart_state_load_result_set_property (GObject * object,
                                                                              guint property_id,
                                                                              const GValue * value,
                                                                              GParamSpec * pspec);
static void proton_plus_services_steam_restart_state_store_set_path (ProtonPlusServicesSteamRestartStateStore* self,
                                                              const gchar* value);
static void proton_plus_services_steam_restart_state_store_set_last_error (ProtonPlusServicesSteamRestartStateStore* self,
                                                                    const gchar* value);
static void _vala_JsonNode_free (JsonNode* self);
static JsonNode* _vala_JsonNode_copy (JsonNode* self);
static ProtonPlusModelsSteamRestartPendingRecord* proton_plus_services_steam_restart_state_store_record_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                                                            JsonObject* object,
                                                                                                            gint schema_version);
static gboolean proton_plus_services_steam_restart_state_store_real_save (ProtonPlusServicesSteamRestartStateStore* self,
                                                                   GeeCollection* records);
static JsonObject* proton_plus_services_steam_restart_state_store_record_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                           ProtonPlusModelsSteamRestartPendingRecord* record);
static JsonObject* proton_plus_services_steam_restart_state_store_target_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                           ProtonPlusModelsSteamRestartTarget* target);
static JsonObject* proton_plus_services_steam_restart_state_store_session_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                            ProtonPlusModelsSteamSessionIdentity* session);
static JsonObject* proton_plus_services_steam_restart_state_store_intent_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                           ProtonPlusModelsSteamConfigurationIntent* intent);
static ProtonPlusModelsSteamRestartTarget* proton_plus_services_steam_restart_state_store_target_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                                                     JsonObject* object);
static ProtonPlusModelsSteamSessionIdentity* proton_plus_services_steam_restart_state_store_session_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                                                        JsonObject* object);
static ProtonPlusModelsSteamConfigurationIntent* proton_plus_services_steam_restart_state_store_intent_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                                                           JsonObject* object,
                                                                                                           gint schema_version,
                                                                                                           ProtonPlusModelsSteamRestartTarget* target,
                                                                                                           const gchar* resource_key,
                                                                                                           ProtonPlusModelsSteamChangeKind kind);
static gchar* proton_plus_services_steam_restart_state_store_optional_string (ProtonPlusServicesSteamRestartStateStore* self,
                                                                       JsonObject* object,
                                                                       const gchar* member);
static gchar* proton_plus_services_steam_restart_state_store_installation_kind_to_identifier (ProtonPlusModelsSteamInstallationKind kind);
static gboolean proton_plus_services_steam_restart_state_store_is_valid_intent (ProtonPlusServicesSteamRestartStateStore* self,
                                                                         ProtonPlusModelsSteamRestartTarget* target,
                                                                         ProtonPlusModelsSteamChangeKind kind,
                                                                         ProtonPlusModelsSteamConfigurationFile file,
                                                                         ProtonPlusModelsSteamConfigurationOperation operation,
                                                                         const gchar* path,
                                                                         const gchar* field_id,
                                                                         const gchar* resource_key);
static gboolean proton_plus_services_steam_restart_state_store_path_resolves_inside (ProtonPlusServicesSteamRestartStateStore* self,
                                                                              const gchar* path,
                                                                              const gchar* expected);
static gboolean proton_plus_services_steam_restart_state_store_is_uint (ProtonPlusServicesSteamRestartStateStore* self,
                                                                 const gchar* value);
static gboolean proton_plus_services_steam_restart_state_store_directory_is_expected_or_missing (ProtonPlusServicesSteamRestartStateStore* self,
                                                                                          const gchar* path,
                                                                                          const gchar* expected);
static gboolean proton_plus_services_steam_restart_state_store_try_installation_kind_from_identifier (const gchar* value,
                                                                                               ProtonPlusModelsSteamInstallationKind* kind);
static void proton_plus_services_steam_restart_state_store_finalize (GObject * obj);
static GType proton_plus_services_steam_restart_state_store_get_type_once (void);
static void _vala_proton_plus_services_steam_restart_state_store_get_property (GObject * object,
                                                                        guint property_id,
                                                                        GValue * value,
                                                                        GParamSpec * pspec);
static void _vala_proton_plus_services_steam_restart_state_store_set_property (GObject * object,
                                                                        guint property_id,
                                                                        const GValue * value,
                                                                        GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_services_steam_restart_state_load_result_get_instance_private (ProtonPlusServicesSteamRestartStateLoadResult* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusServicesSteamRestartStateLoadResult_private_offset);
}

ProtonPlusServicesSteamRestartStateLoadResult*
proton_plus_services_steam_restart_state_load_result_construct (GType object_type,
                                                                GeeList* records,
                                                                const gchar* _error_)
{
	ProtonPlusServicesSteamRestartStateLoadResult * self = NULL;
	g_return_val_if_fail (records != NULL, NULL);
	self = (ProtonPlusServicesSteamRestartStateLoadResult*) g_object_new (object_type, NULL);
	proton_plus_services_steam_restart_state_load_result_set_records (self, records);
	proton_plus_services_steam_restart_state_load_result_set_error (self, _error_);
	return self;
}

ProtonPlusServicesSteamRestartStateLoadResult*
proton_plus_services_steam_restart_state_load_result_new (GeeList* records,
                                                          const gchar* _error_)
{
	return proton_plus_services_steam_restart_state_load_result_construct (PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_LOAD_RESULT, records, _error_);
}

GeeList*
proton_plus_services_steam_restart_state_load_result_get_records (ProtonPlusServicesSteamRestartStateLoadResult* self)
{
	GeeList* result;
	GeeList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_records;
	result = _tmp0_;
	return result;
}

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

static void
proton_plus_services_steam_restart_state_load_result_set_records (ProtonPlusServicesSteamRestartStateLoadResult* self,
                                                                  GeeList* value)
{
	GeeList* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_services_steam_restart_state_load_result_get_records (self);
	if (old_value != value) {
		GeeList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_records);
		self->priv->_records = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_services_steam_restart_state_load_result_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_RECORDS_PROPERTY]);
	}
}

const gchar*
proton_plus_services_steam_restart_state_load_result_get_error (ProtonPlusServicesSteamRestartStateLoadResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_error;
	result = _tmp0_;
	return result;
}

static void
proton_plus_services_steam_restart_state_load_result_set_error (ProtonPlusServicesSteamRestartStateLoadResult* self,
                                                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_services_steam_restart_state_load_result_get_error (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_error);
		self->priv->_error = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_services_steam_restart_state_load_result_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_ERROR_PROPERTY]);
	}
}

static void
proton_plus_services_steam_restart_state_load_result_class_init (ProtonPlusServicesSteamRestartStateLoadResultClass * klass,
                                                                 gpointer klass_data)
{
	proton_plus_services_steam_restart_state_load_result_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusServicesSteamRestartStateLoadResult_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_services_steam_restart_state_load_result_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_services_steam_restart_state_load_result_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_services_steam_restart_state_load_result_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_RECORDS_PROPERTY, proton_plus_services_steam_restart_state_load_result_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_RECORDS_PROPERTY] = g_param_spec_object ("records", "records", "records", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_ERROR_PROPERTY, proton_plus_services_steam_restart_state_load_result_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_ERROR_PROPERTY] = g_param_spec_string ("error", "error", "error", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_services_steam_restart_state_load_result_instance_init (ProtonPlusServicesSteamRestartStateLoadResult * self,
                                                                    gpointer klass)
{
	self->priv = proton_plus_services_steam_restart_state_load_result_get_instance_private (self);
}

static void
proton_plus_services_steam_restart_state_load_result_finalize (GObject * obj)
{
	ProtonPlusServicesSteamRestartStateLoadResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_LOAD_RESULT, ProtonPlusServicesSteamRestartStateLoadResult);
	_g_object_unref0 (self->priv->_records);
	_g_free0 (self->priv->_error);
	G_OBJECT_CLASS (proton_plus_services_steam_restart_state_load_result_parent_class)->finalize (obj);
}

static GType
proton_plus_services_steam_restart_state_load_result_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesSteamRestartStateLoadResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_steam_restart_state_load_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesSteamRestartStateLoadResult), 0, (GInstanceInitFunc) proton_plus_services_steam_restart_state_load_result_instance_init, NULL };
	GType proton_plus_services_steam_restart_state_load_result_type_id;
	proton_plus_services_steam_restart_state_load_result_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusServicesSteamRestartStateLoadResult", &g_define_type_info, 0);
	ProtonPlusServicesSteamRestartStateLoadResult_private_offset = g_type_add_instance_private (proton_plus_services_steam_restart_state_load_result_type_id, sizeof (ProtonPlusServicesSteamRestartStateLoadResultPrivate));
	return proton_plus_services_steam_restart_state_load_result_type_id;
}

GType
proton_plus_services_steam_restart_state_load_result_get_type (void)
{
	static volatile gsize proton_plus_services_steam_restart_state_load_result_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_steam_restart_state_load_result_type_id__once)) {
		GType proton_plus_services_steam_restart_state_load_result_type_id;
		proton_plus_services_steam_restart_state_load_result_type_id = proton_plus_services_steam_restart_state_load_result_get_type_once ();
		g_once_init_leave (&proton_plus_services_steam_restart_state_load_result_type_id__once, proton_plus_services_steam_restart_state_load_result_type_id);
	}
	return proton_plus_services_steam_restart_state_load_result_type_id__once;
}

static void
_vala_proton_plus_services_steam_restart_state_load_result_get_property (GObject * object,
                                                                         guint property_id,
                                                                         GValue * value,
                                                                         GParamSpec * pspec)
{
	ProtonPlusServicesSteamRestartStateLoadResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_LOAD_RESULT, ProtonPlusServicesSteamRestartStateLoadResult);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_RECORDS_PROPERTY:
		g_value_set_object (value, proton_plus_services_steam_restart_state_load_result_get_records (self));
		break;
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_ERROR_PROPERTY:
		g_value_set_string (value, proton_plus_services_steam_restart_state_load_result_get_error (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_services_steam_restart_state_load_result_set_property (GObject * object,
                                                                         guint property_id,
                                                                         const GValue * value,
                                                                         GParamSpec * pspec)
{
	ProtonPlusServicesSteamRestartStateLoadResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_LOAD_RESULT, ProtonPlusServicesSteamRestartStateLoadResult);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_RECORDS_PROPERTY:
		proton_plus_services_steam_restart_state_load_result_set_records (self, g_value_get_object (value));
		break;
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_LOAD_RESULT_ERROR_PROPERTY:
		proton_plus_services_steam_restart_state_load_result_set_error (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
proton_plus_services_steam_restart_state_store_get_instance_private (ProtonPlusServicesSteamRestartStateStore* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusServicesSteamRestartStateStore_private_offset);
}

ProtonPlusServicesSteamRestartStateStore*
proton_plus_services_steam_restart_state_store_construct (GType object_type,
                                                          const gchar* path)
{
	ProtonPlusServicesSteamRestartStateStore * self = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	self = (ProtonPlusServicesSteamRestartStateStore*) g_object_new (object_type, NULL);
	_tmp1_ = g_strdup (path);
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = g_get_user_state_dir ();
		_tmp3_ = g_build_filename (_tmp2_, "ProtonPlus", "steam-restart-state.json", NULL);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp3_;
	}
	proton_plus_services_steam_restart_state_store_set_path (self, _tmp0_);
	_g_free0 (_tmp0_);
	return self;
}

ProtonPlusServicesSteamRestartStateStore*
proton_plus_services_steam_restart_state_store_new (const gchar* path)
{
	return proton_plus_services_steam_restart_state_store_construct (PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_STORE, path);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

static gpointer
_json_object_ref0 (gpointer self)
{
	return self ? json_object_ref (self) : NULL;
}

static JsonNode*
_vala_JsonNode_copy (JsonNode* self)
{
	return g_boxed_copy (json_node_get_type (), self);
}

static gpointer
__vala_JsonNode_copy0 (gpointer self)
{
	return self ? _vala_JsonNode_copy (self) : NULL;
}

static gpointer
_json_array_ref0 (gpointer self)
{
	return self ? json_array_ref (self) : NULL;
}

ProtonPlusServicesSteamRestartStateLoadResult*
proton_plus_services_steam_restart_state_store_load (ProtonPlusServicesSteamRestartStateStore* self)
{
	GeeArrayList* records = NULL;
	GeeArrayList* _tmp0_;
	const gchar* _tmp1_;
	gchar* content = NULL;
	JsonNode* root = NULL;
	gboolean _tmp20_ = FALSE;
	JsonNode* _tmp21_;
	JsonObject* object = NULL;
	JsonNode* _tmp26_;
	JsonObject* _tmp27_;
	JsonObject* _tmp28_;
	gint64 version = 0LL;
	JsonObject* _tmp29_;
	gboolean _tmp30_ = FALSE;
	JsonNode* entries = NULL;
	JsonObject* _tmp34_;
	JsonNode* _tmp35_;
	JsonNode* _tmp36_;
	gboolean _tmp37_ = FALSE;
	JsonNode* _tmp38_;
	JsonArray* array = NULL;
	JsonNode* _tmp43_;
	JsonArray* _tmp44_;
	JsonArray* _tmp45_;
	GeeArrayList* _tmp55_;
	const gchar* _tmp56_;
	ProtonPlusServicesSteamRestartStateLoadResult* _tmp57_;
	GError* _inner_error0_ = NULL;
	ProtonPlusServicesSteamRestartStateLoadResult* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_MODELS_TYPE_STEAM_RESTART_PENDING_RECORD, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	records = _tmp0_;
	proton_plus_services_steam_restart_state_store_set_last_error (self, NULL);
	_tmp1_ = self->priv->_path;
	if (!g_file_test (_tmp1_, G_FILE_TEST_EXISTS)) {
		GeeArrayList* _tmp2_;
		ProtonPlusServicesSteamRestartStateLoadResult* _tmp3_;
		_tmp2_ = records;
		_tmp3_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp2_, NULL);
		result = _tmp3_;
		_g_object_unref0 (records);
		return result;
	}
	{
		const gchar* _tmp4_;
		gchar* _tmp5_ = NULL;
		_tmp4_ = self->priv->_path;
		g_file_get_contents (_tmp4_, &_tmp5_, NULL, &_inner_error0_);
		_g_free0 (content);
		content = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_FILE_ERROR) {
				goto __catch0_g_file_error;
			}
			_g_free0 (content);
			_g_object_unref0 (records);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	goto __finally0;
	__catch0_g_file_error:
	{
		GError* e = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		GeeArrayList* _tmp10_;
		const gchar* _tmp11_;
		ProtonPlusServicesSteamRestartStateLoadResult* _tmp12_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		_tmp8_ = g_strdup_printf ("Unable to read Steam restart state: %s", _tmp7_);
		_tmp9_ = _tmp8_;
		proton_plus_services_steam_restart_state_store_set_last_error (self, _tmp9_);
		_g_free0 (_tmp9_);
		_tmp10_ = records;
		_tmp11_ = self->priv->_last_error;
		_tmp12_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp10_, _tmp11_);
		result = _tmp12_;
		_g_error_free0 (e);
		_g_free0 (content);
		_g_object_unref0 (records);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (content);
		_g_object_unref0 (records);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	{
		JsonNode* _tmp13_ = NULL;
		const gchar* _tmp14_;
		JsonNode* _tmp15_;
		JsonNode* _tmp16_;
		_tmp14_ = content;
		_tmp15_ = json_from_string (_tmp14_, &_inner_error0_);
		_tmp13_ = _tmp15_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_tmp16_ = _tmp13_;
		_tmp13_ = NULL;
		__vala_JsonNode_free0 (root);
		root = _tmp16_;
		__vala_JsonNode_free0 (_tmp13_);
	}
	goto __finally1;
	__catch1_g_error:
	{
		GeeArrayList* _tmp17_;
		const gchar* _tmp18_;
		ProtonPlusServicesSteamRestartStateLoadResult* _tmp19_;
		g_clear_error (&_inner_error0_);
		proton_plus_services_steam_restart_state_store_set_last_error (self, "Steam restart state is malformed JSON.");
		_tmp17_ = records;
		_tmp18_ = self->priv->_last_error;
		_tmp19_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp17_, _tmp18_);
		result = _tmp19_;
		__vala_JsonNode_free0 (root);
		_g_free0 (content);
		_g_object_unref0 (records);
		return result;
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		__vala_JsonNode_free0 (root);
		_g_free0 (content);
		_g_object_unref0 (records);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	_tmp21_ = root;
	if (_tmp21_ == NULL) {
		_tmp20_ = TRUE;
	} else {
		JsonNode* _tmp22_;
		_tmp22_ = root;
		_tmp20_ = json_node_get_node_type (_tmp22_) != JSON_NODE_OBJECT;
	}
	if (_tmp20_) {
		GeeArrayList* _tmp23_;
		const gchar* _tmp24_;
		ProtonPlusServicesSteamRestartStateLoadResult* _tmp25_;
		proton_plus_services_steam_restart_state_store_set_last_error (self, "Steam restart state has an invalid root object.");
		_tmp23_ = records;
		_tmp24_ = self->priv->_last_error;
		_tmp25_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp23_, _tmp24_);
		result = _tmp25_;
		__vala_JsonNode_free0 (root);
		_g_free0 (content);
		_g_object_unref0 (records);
		return result;
	}
	_tmp26_ = root;
	_tmp27_ = json_node_get_object (_tmp26_);
	_tmp28_ = _json_object_ref0 (_tmp27_);
	object = _tmp28_;
	_tmp29_ = object;
	version = json_object_get_int_member_with_default (_tmp29_, "schema_version", (gint64) 0);
	if (version != ((gint64) 1)) {
		_tmp30_ = version != ((gint64) PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_SCHEMA_VERSION);
	} else {
		_tmp30_ = FALSE;
	}
	if (_tmp30_) {
		GeeArrayList* _tmp31_;
		const gchar* _tmp32_;
		ProtonPlusServicesSteamRestartStateLoadResult* _tmp33_;
		proton_plus_services_steam_restart_state_store_set_last_error (self, "Steam restart state uses an unsupported schema version.");
		_tmp31_ = records;
		_tmp32_ = self->priv->_last_error;
		_tmp33_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp31_, _tmp32_);
		result = _tmp33_;
		_json_object_unref0 (object);
		__vala_JsonNode_free0 (root);
		_g_free0 (content);
		_g_object_unref0 (records);
		return result;
	}
	_tmp34_ = object;
	_tmp35_ = json_object_get_member (_tmp34_, "records");
	_tmp36_ = __vala_JsonNode_copy0 (_tmp35_);
	entries = _tmp36_;
	_tmp38_ = entries;
	if (_tmp38_ == NULL) {
		_tmp37_ = TRUE;
	} else {
		JsonNode* _tmp39_;
		_tmp39_ = entries;
		_tmp37_ = json_node_get_node_type (_tmp39_) != JSON_NODE_ARRAY;
	}
	if (_tmp37_) {
		GeeArrayList* _tmp40_;
		const gchar* _tmp41_;
		ProtonPlusServicesSteamRestartStateLoadResult* _tmp42_;
		proton_plus_services_steam_restart_state_store_set_last_error (self, "Steam restart state has no valid records array.");
		_tmp40_ = records;
		_tmp41_ = self->priv->_last_error;
		_tmp42_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp40_, _tmp41_);
		result = _tmp42_;
		__vala_JsonNode_free0 (entries);
		_json_object_unref0 (object);
		__vala_JsonNode_free0 (root);
		_g_free0 (content);
		_g_object_unref0 (records);
		return result;
	}
	_tmp43_ = entries;
	_tmp44_ = json_node_get_array (_tmp43_);
	_tmp45_ = _json_array_ref0 (_tmp44_);
	array = _tmp45_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp46_ = FALSE;
			_tmp46_ = TRUE;
			while (TRUE) {
				JsonArray* _tmp48_;
				ProtonPlusModelsSteamRestartPendingRecord* record = NULL;
				JsonArray* _tmp49_;
				JsonObject* _tmp50_;
				ProtonPlusModelsSteamRestartPendingRecord* _tmp51_;
				ProtonPlusModelsSteamRestartPendingRecord* _tmp52_;
				if (!_tmp46_) {
					gint _tmp47_;
					_tmp47_ = i;
					i = _tmp47_ + 1;
				}
				_tmp46_ = FALSE;
				_tmp48_ = array;
				if (!(((guint) i) < json_array_get_length (_tmp48_))) {
					break;
				}
				_tmp49_ = array;
				_tmp50_ = json_array_get_object_element (_tmp49_, (guint) i);
				_tmp51_ = proton_plus_services_steam_restart_state_store_record_from_json (self, _tmp50_, (gint) version);
				record = _tmp51_;
				_tmp52_ = record;
				if (_tmp52_ != NULL) {
					GeeArrayList* _tmp53_;
					ProtonPlusModelsSteamRestartPendingRecord* _tmp54_;
					_tmp53_ = records;
					_tmp54_ = record;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp53_, _tmp54_);
				} else {
					proton_plus_services_steam_restart_state_store_set_last_error (self, "Some Steam restart records were rejected for safety.");
				}
				_g_object_unref0 (record);
			}
		}
	}
	_tmp55_ = records;
	_tmp56_ = self->priv->_last_error;
	_tmp57_ = proton_plus_services_steam_restart_state_load_result_new ((GeeList*) _tmp55_, _tmp56_);
	result = _tmp57_;
	_json_array_unref0 (array);
	__vala_JsonNode_free0 (entries);
	_json_object_unref0 (object);
	__vala_JsonNode_free0 (root);
	_g_free0 (content);
	_g_object_unref0 (records);
	return result;
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static gboolean
proton_plus_services_steam_restart_state_store_real_save (ProtonPlusServicesSteamRestartStateStore* self,
                                                          GeeCollection* records)
{
	GFile* parent = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	JsonObject* root = NULL;
	JsonObject* _tmp12_;
	JsonObject* _tmp13_;
	JsonArray* array = NULL;
	JsonArray* _tmp14_;
	JsonObject* _tmp22_;
	JsonArray* _tmp23_;
	JsonArray* _tmp24_;
	JsonNode* node = NULL;
	JsonNode* _tmp25_;
	JsonNode* _tmp26_;
	JsonObject* _tmp27_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp28_;
	JsonGenerator* _tmp29_;
	JsonNode* _tmp30_;
	gchar* data = NULL;
	JsonGenerator* _tmp31_;
	gchar* _tmp32_;
	gboolean _tmp48_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (records != NULL, FALSE);
	proton_plus_services_steam_restart_state_store_set_last_error (self, NULL);
	_tmp0_ = self->priv->_path;
	_tmp1_ = g_path_get_dirname (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_file_new_for_path (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	parent = _tmp4_;
	{
		GFile* _tmp5_;
		_tmp5_ = parent;
		g_file_make_directory_with_parents (_tmp5_, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GFile* _tmp6_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = parent;
		if (!g_file_query_exists (_tmp6_, NULL)) {
			GError* _tmp7_;
			const gchar* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp7_ = e;
			_tmp8_ = _tmp7_->message;
			_tmp9_ = g_strdup_printf ("Unable to create Steam restart state directory: %s", _tmp8_);
			_tmp10_ = _tmp9_;
			proton_plus_services_steam_restart_state_store_set_last_error (self, _tmp10_);
			_g_free0 (_tmp10_);
			result = FALSE;
			_g_error_free0 (e);
			_g_object_unref0 (parent);
			return result;
		}
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp11_ = FALSE;
		_g_object_unref0 (parent);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp11_;
	}
	_tmp12_ = json_object_new ();
	root = _tmp12_;
	_tmp13_ = root;
	json_object_set_int_member (_tmp13_, "schema_version", (gint64) PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_SCHEMA_VERSION);
	_tmp14_ = json_array_new ();
	array = _tmp14_;
	{
		GeeIterator* _record_it = NULL;
		GeeIterator* _tmp15_;
		_tmp15_ = gee_iterable_iterator ((GeeIterable*) records);
		_record_it = _tmp15_;
		while (TRUE) {
			GeeIterator* _tmp16_;
			ProtonPlusModelsSteamRestartPendingRecord* record = NULL;
			GeeIterator* _tmp17_;
			gpointer _tmp18_;
			JsonArray* _tmp19_;
			ProtonPlusModelsSteamRestartPendingRecord* _tmp20_;
			JsonObject* _tmp21_;
			_tmp16_ = _record_it;
			if (!gee_iterator_next (_tmp16_)) {
				break;
			}
			_tmp17_ = _record_it;
			_tmp18_ = gee_iterator_get (_tmp17_);
			record = (ProtonPlusModelsSteamRestartPendingRecord*) _tmp18_;
			_tmp19_ = array;
			_tmp20_ = record;
			_tmp21_ = proton_plus_services_steam_restart_state_store_record_to_json (self, _tmp20_);
			json_array_add_object_element (_tmp19_, _tmp21_);
			_g_object_unref0 (record);
		}
		_g_object_unref0 (_record_it);
	}
	_tmp22_ = root;
	_tmp23_ = array;
	_tmp24_ = _json_array_ref0 (_tmp23_);
	json_object_set_array_member (_tmp22_, "records", _tmp24_);
	_tmp25_ = json_node_new (JSON_NODE_OBJECT);
	node = _tmp25_;
	_tmp26_ = node;
	_tmp27_ = root;
	json_node_set_object (_tmp26_, _tmp27_);
	_tmp28_ = json_generator_new ();
	generator = _tmp28_;
	_tmp29_ = generator;
	_tmp30_ = node;
	json_generator_set_root (_tmp29_, _tmp30_);
	_tmp31_ = generator;
	_tmp32_ = json_generator_to_data (_tmp31_, NULL);
	data = _tmp32_;
	{
		gboolean _tmp33_ = FALSE;
		const gchar* _tmp34_;
		gchar* etag = NULL;
		const gchar* _tmp36_;
		GFile* _tmp37_;
		GFile* _tmp38_;
		const gchar* _tmp39_;
		guint8* _tmp40_;
		gint _tmp40__length1;
		gint _tmp41_ = 0;
		guint8* _tmp42_;
		gint _tmp42__length1;
		gchar* _tmp43_ = NULL;
		_tmp34_ = self->priv->_path;
		if (g_file_test (_tmp34_, G_FILE_TEST_EXISTS)) {
			const gchar* _tmp35_;
			_tmp35_ = self->priv->_path;
			_tmp33_ = chmod (_tmp35_, (mode_t) 0600) != 0;
		} else {
			_tmp33_ = FALSE;
		}
		if (_tmp33_) {
			proton_plus_services_steam_restart_state_store_set_last_error (self, "Unable to secure Steam restart state file.");
			result = FALSE;
			_g_free0 (data);
			_g_object_unref0 (generator);
			__vala_JsonNode_free0 (node);
			_json_array_unref0 (array);
			_json_object_unref0 (root);
			_g_object_unref0 (parent);
			return result;
		}
		_tmp36_ = self->priv->_path;
		_tmp37_ = g_file_new_for_path (_tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = data;
		_tmp40_ = string_get_data (_tmp39_, &_tmp41_);
		_tmp40__length1 = _tmp41_;
		_tmp42_ = _tmp40_;
		_tmp42__length1 = _tmp40__length1;
		g_file_replace_contents (_tmp38_, (const char*) _tmp42_, (gsize) _tmp42__length1, NULL, FALSE, G_FILE_CREATE_PRIVATE, &_tmp43_, NULL, &_inner_error0_);
		_g_free0 (etag);
		etag = _tmp43_;
		_g_object_unref0 (_tmp38_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (etag);
			goto __catch1_g_error;
		}
		result = TRUE;
		_g_free0 (etag);
		_g_free0 (data);
		_g_object_unref0 (generator);
		__vala_JsonNode_free0 (node);
		_json_array_unref0 (array);
		_json_object_unref0 (root);
		_g_object_unref0 (parent);
		return result;
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		GError* _tmp44_;
		const gchar* _tmp45_;
		gchar* _tmp46_;
		gchar* _tmp47_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp44_ = e;
		_tmp45_ = _tmp44_->message;
		_tmp46_ = g_strdup_printf ("Unable to save Steam restart state: %s", _tmp45_);
		_tmp47_ = _tmp46_;
		proton_plus_services_steam_restart_state_store_set_last_error (self, _tmp47_);
		_g_free0 (_tmp47_);
		result = FALSE;
		_g_error_free0 (e);
		_g_free0 (data);
		_g_object_unref0 (generator);
		__vala_JsonNode_free0 (node);
		_json_array_unref0 (array);
		_json_object_unref0 (root);
		_g_object_unref0 (parent);
		return result;
	}
	__finally1:
	_g_free0 (data);
	_g_object_unref0 (generator);
	__vala_JsonNode_free0 (node);
	_json_array_unref0 (array);
	_json_object_unref0 (root);
	_g_object_unref0 (parent);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp48_;
}

gboolean
proton_plus_services_steam_restart_state_store_save (ProtonPlusServicesSteamRestartStateStore* self,
                                                     GeeCollection* records)
{
	ProtonPlusServicesSteamRestartStateStoreClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_GET_CLASS (self);
	if (_klass_->save) {
		return _klass_->save (self, records);
	}
	return FALSE;
}

static JsonObject*
proton_plus_services_steam_restart_state_store_record_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                               ProtonPlusModelsSteamRestartPendingRecord* record)
{
	JsonObject* object = NULL;
	JsonObject* _tmp0_;
	JsonObject* _tmp1_;
	ProtonPlusModelsSteamChangeReceipt* _tmp2_;
	ProtonPlusModelsSteamChangeReceipt* _tmp3_;
	ProtonPlusModelsSteamRestartTarget* _tmp4_;
	ProtonPlusModelsSteamRestartTarget* _tmp5_;
	JsonObject* _tmp6_;
	JsonObject* _tmp7_;
	ProtonPlusModelsSteamChangeReceipt* _tmp8_;
	ProtonPlusModelsSteamChangeReceipt* _tmp9_;
	ProtonPlusModelsSteamChangeKind _tmp10_;
	ProtonPlusModelsSteamChangeKind _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	JsonObject* _tmp14_;
	ProtonPlusModelsSteamChangeReceipt* _tmp15_;
	ProtonPlusModelsSteamChangeReceipt* _tmp16_;
	ProtonPlusModelsSteamRestartRequirement _tmp17_;
	ProtonPlusModelsSteamRestartRequirement _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	JsonObject* _tmp21_;
	ProtonPlusModelsSteamChangeReceipt* _tmp22_;
	ProtonPlusModelsSteamChangeReceipt* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	JsonObject* _tmp26_;
	ProtonPlusModelsSteamChangeReceipt* _tmp27_;
	ProtonPlusModelsSteamChangeReceipt* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	ProtonPlusModelsSteamChangeReceipt* _tmp31_;
	ProtonPlusModelsSteamChangeReceipt* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	ProtonPlusModelsSteamChangeReceipt* _tmp40_;
	ProtonPlusModelsSteamChangeReceipt* _tmp41_;
	const gchar* _tmp42_;
	const gchar* _tmp43_;
	JsonObject* _tmp49_;
	const gchar* _tmp50_;
	const gchar* _tmp51_;
	JsonObject* _tmp52_;
	const gchar* _tmp53_;
	const gchar* _tmp54_;
	JsonObject* _tmp55_;
	guint _tmp56_;
	guint _tmp57_;
	JsonObject* _tmp58_;
	gboolean _tmp59_;
	gboolean _tmp60_;
	ProtonPlusModelsSteamSessionIdentity* _tmp61_;
	ProtonPlusModelsSteamSessionIdentity* _tmp62_;
	ProtonPlusModelsSteamChangeReceipt* _tmp67_;
	ProtonPlusModelsSteamChangeReceipt* _tmp68_;
	ProtonPlusModelsSteamConfigurationIntent* _tmp69_;
	ProtonPlusModelsSteamConfigurationIntent* _tmp70_;
	JsonObject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (record != NULL, NULL);
	_tmp0_ = json_object_new ();
	object = _tmp0_;
	_tmp1_ = object;
	_tmp2_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_models_steam_change_receipt_get_target (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = proton_plus_services_steam_restart_state_store_target_to_json (self, _tmp5_);
	json_object_set_object_member (_tmp1_, "target", _tmp6_);
	_tmp7_ = object;
	_tmp8_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp9_ = _tmp8_;
	_tmp10_ = proton_plus_models_steam_change_receipt_get_kind (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = proton_plus_models_steam_change_receipt_kind_to_identifier (_tmp11_);
	_tmp13_ = _tmp12_;
	json_object_set_string_member (_tmp7_, "kind", _tmp13_);
	_g_free0 (_tmp13_);
	_tmp14_ = object;
	_tmp15_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp16_ = _tmp15_;
	_tmp17_ = proton_plus_models_steam_change_receipt_get_restart_requirement (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = proton_plus_models_steam_change_receipt_requirement_to_identifier (_tmp18_);
	_tmp20_ = _tmp19_;
	json_object_set_string_member (_tmp14_, "requirement", _tmp20_);
	_g_free0 (_tmp20_);
	_tmp21_ = object;
	_tmp22_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp23_ = _tmp22_;
	_tmp24_ = proton_plus_models_steam_change_receipt_get_resource_key (_tmp23_);
	_tmp25_ = _tmp24_;
	json_object_set_string_member (_tmp21_, "resource_key", _tmp25_);
	_tmp26_ = object;
	_tmp27_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp28_ = _tmp27_;
	_tmp29_ = proton_plus_models_steam_change_receipt_get_changed_at (_tmp28_);
	_tmp30_ = _tmp29_;
	json_object_set_string_member (_tmp26_, "changed_at", _tmp30_);
	_tmp31_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp32_ = _tmp31_;
	_tmp33_ = proton_plus_models_steam_change_receipt_get_subject_id (_tmp32_);
	_tmp34_ = _tmp33_;
	if (_tmp34_ != NULL) {
		JsonObject* _tmp35_;
		ProtonPlusModelsSteamChangeReceipt* _tmp36_;
		ProtonPlusModelsSteamChangeReceipt* _tmp37_;
		const gchar* _tmp38_;
		const gchar* _tmp39_;
		_tmp35_ = object;
		_tmp36_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
		_tmp37_ = _tmp36_;
		_tmp38_ = proton_plus_models_steam_change_receipt_get_subject_id (_tmp37_);
		_tmp39_ = _tmp38_;
		json_object_set_string_member (_tmp35_, "subject_id", (const gchar*) _tmp39_);
	}
	_tmp40_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp41_ = _tmp40_;
	_tmp42_ = proton_plus_models_steam_change_receipt_get_subject_label (_tmp41_);
	_tmp43_ = _tmp42_;
	if (_tmp43_ != NULL) {
		JsonObject* _tmp44_;
		ProtonPlusModelsSteamChangeReceipt* _tmp45_;
		ProtonPlusModelsSteamChangeReceipt* _tmp46_;
		const gchar* _tmp47_;
		const gchar* _tmp48_;
		_tmp44_ = object;
		_tmp45_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
		_tmp46_ = _tmp45_;
		_tmp47_ = proton_plus_models_steam_change_receipt_get_subject_label (_tmp46_);
		_tmp48_ = _tmp47_;
		json_object_set_string_member (_tmp44_, "subject_label", (const gchar*) _tmp48_);
	}
	_tmp49_ = object;
	_tmp50_ = proton_plus_models_steam_restart_pending_record_get_first_recorded_at (record);
	_tmp51_ = _tmp50_;
	json_object_set_string_member (_tmp49_, "first_recorded_at", _tmp51_);
	_tmp52_ = object;
	_tmp53_ = proton_plus_models_steam_restart_pending_record_get_last_updated_at (record);
	_tmp54_ = _tmp53_;
	json_object_set_string_member (_tmp52_, "last_updated_at", _tmp54_);
	_tmp55_ = object;
	_tmp56_ = proton_plus_models_steam_restart_pending_record_get_occurrence_count (record);
	_tmp57_ = _tmp56_;
	json_object_set_int_member (_tmp55_, "occurrence_count", (gint64) _tmp57_);
	_tmp58_ = object;
	_tmp59_ = proton_plus_models_steam_restart_pending_record_get_stop_observed (record);
	_tmp60_ = _tmp59_;
	json_object_set_boolean_member (_tmp58_, "stop_observed", _tmp60_);
	_tmp61_ = proton_plus_models_steam_restart_pending_record_get_observed_session (record);
	_tmp62_ = _tmp61_;
	if (_tmp62_ != NULL) {
		JsonObject* _tmp63_;
		ProtonPlusModelsSteamSessionIdentity* _tmp64_;
		ProtonPlusModelsSteamSessionIdentity* _tmp65_;
		JsonObject* _tmp66_;
		_tmp63_ = object;
		_tmp64_ = proton_plus_models_steam_restart_pending_record_get_observed_session (record);
		_tmp65_ = _tmp64_;
		_tmp66_ = proton_plus_services_steam_restart_state_store_session_to_json (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp65_, PROTON_PLUS_MODELS_TYPE_STEAM_SESSION_IDENTITY, ProtonPlusModelsSteamSessionIdentity));
		json_object_set_object_member (_tmp63_, "observed_session", _tmp66_);
	}
	_tmp67_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
	_tmp68_ = _tmp67_;
	_tmp69_ = proton_plus_models_steam_change_receipt_get_configuration_intent (_tmp68_);
	_tmp70_ = _tmp69_;
	if (_tmp70_ != NULL) {
		JsonObject* _tmp71_;
		ProtonPlusModelsSteamChangeReceipt* _tmp72_;
		ProtonPlusModelsSteamChangeReceipt* _tmp73_;
		ProtonPlusModelsSteamConfigurationIntent* _tmp74_;
		ProtonPlusModelsSteamConfigurationIntent* _tmp75_;
		JsonObject* _tmp76_;
		_tmp71_ = object;
		_tmp72_ = proton_plus_models_steam_restart_pending_record_get_receipt (record);
		_tmp73_ = _tmp72_;
		_tmp74_ = proton_plus_models_steam_change_receipt_get_configuration_intent (_tmp73_);
		_tmp75_ = _tmp74_;
		_tmp76_ = proton_plus_services_steam_restart_state_store_intent_to_json (self, G_TYPE_CHECK_INSTANCE_CAST (_tmp75_, PROTON_PLUS_MODELS_TYPE_STEAM_CONFIGURATION_INTENT, ProtonPlusModelsSteamConfigurationIntent));
		json_object_set_object_member (_tmp71_, "configuration_intent", _tmp76_);
	}
	result = object;
	return result;
}

static ProtonPlusModelsSteamRestartPendingRecord*
proton_plus_services_steam_restart_state_store_record_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                 JsonObject* object,
                                                                 gint schema_version)
{
	JsonNode* target_node = NULL;
	JsonNode* _tmp0_;
	JsonNode* _tmp1_;
	gboolean _tmp2_ = FALSE;
	JsonNode* _tmp3_;
	ProtonPlusModelsSteamRestartTarget* target = NULL;
	JsonNode* _tmp5_;
	JsonObject* _tmp6_;
	ProtonPlusModelsSteamRestartTarget* _tmp7_;
	ProtonPlusModelsSteamRestartTarget* _tmp8_;
	ProtonPlusModelsSteamChangeKind kind = 0;
	ProtonPlusModelsSteamRestartRequirement requirement = 0;
	gchar* resource_key = NULL;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* changed_at = NULL;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* first_recorded_at = NULL;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* last_updated_at = NULL;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gboolean _tmp17_ = FALSE;
	gboolean _tmp18_ = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	const gchar* _tmp22_;
	gint64 count = 0LL;
	gboolean _tmp32_ = FALSE;
	ProtonPlusModelsSteamSessionIdentity* session = NULL;
	JsonNode* session_node = NULL;
	JsonNode* _tmp33_;
	JsonNode* _tmp34_;
	JsonNode* _tmp35_;
	ProtonPlusModelsSteamConfigurationIntent* intent = NULL;
	JsonNode* intent_node = NULL;
	JsonNode* _tmp41_;
	JsonNode* _tmp42_;
	JsonNode* _tmp43_;
	ProtonPlusModelsSteamChangeReceipt* receipt = NULL;
	ProtonPlusModelsSteamRestartTarget* _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	gchar* _tmp55_;
	gchar* _tmp56_;
	const gchar* _tmp57_;
	ProtonPlusModelsSteamConfigurationIntent* _tmp58_;
	ProtonPlusModelsSteamChangeReceipt* _tmp59_;
	ProtonPlusModelsSteamChangeReceipt* _tmp60_;
	ProtonPlusModelsSteamChangeReceipt* _tmp61_;
	const gchar* _tmp62_;
	const gchar* _tmp63_;
	ProtonPlusModelsSteamSessionIdentity* _tmp64_;
	ProtonPlusModelsSteamRestartPendingRecord* _tmp65_;
	ProtonPlusModelsSteamRestartPendingRecord* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (object == NULL) {
		result = NULL;
		return result;
	}
	_tmp0_ = json_object_get_member (object, "target");
	_tmp1_ = __vala_JsonNode_copy0 (_tmp0_);
	target_node = _tmp1_;
	_tmp3_ = target_node;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		JsonNode* _tmp4_;
		_tmp4_ = target_node;
		_tmp2_ = json_node_get_node_type (_tmp4_) != JSON_NODE_OBJECT;
	}
	if (_tmp2_) {
		result = NULL;
		__vala_JsonNode_free0 (target_node);
		return result;
	}
	_tmp5_ = target_node;
	_tmp6_ = json_node_get_object (_tmp5_);
	_tmp7_ = proton_plus_services_steam_restart_state_store_target_from_json (self, _tmp6_);
	target = _tmp7_;
	_tmp8_ = target;
	if (_tmp8_ == NULL) {
		result = NULL;
		_g_object_unref0 (target);
		__vala_JsonNode_free0 (target_node);
		return result;
	}
	kind = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_DEFAULT_COMPATIBILITY_TOOL_CHANGED;
	requirement = PROTON_PLUS_MODELS_STEAM_RESTART_REQUIREMENT_CONSERVATIVE;
	_tmp9_ = json_object_get_string_member_with_default (object, "resource_key", "");
	_tmp10_ = g_strdup (_tmp9_);
	resource_key = _tmp10_;
	_tmp11_ = json_object_get_string_member_with_default (object, "changed_at", "");
	_tmp12_ = g_strdup (_tmp11_);
	changed_at = _tmp12_;
	_tmp13_ = json_object_get_string_member_with_default (object, "first_recorded_at", "");
	_tmp14_ = g_strdup (_tmp13_);
	first_recorded_at = _tmp14_;
	_tmp15_ = json_object_get_string_member_with_default (object, "last_updated_at", "");
	_tmp16_ = g_strdup (_tmp15_);
	last_updated_at = _tmp16_;
	_tmp22_ = resource_key;
	if (g_strcmp0 (_tmp22_, "") == 0) {
		_tmp21_ = TRUE;
	} else {
		const gchar* _tmp23_;
		_tmp23_ = changed_at;
		_tmp21_ = g_strcmp0 (_tmp23_, "") == 0;
	}
	if (_tmp21_) {
		_tmp20_ = TRUE;
	} else {
		const gchar* _tmp24_;
		_tmp24_ = first_recorded_at;
		_tmp20_ = g_strcmp0 (_tmp24_, "") == 0;
	}
	if (_tmp20_) {
		_tmp19_ = TRUE;
	} else {
		const gchar* _tmp25_;
		_tmp25_ = last_updated_at;
		_tmp19_ = g_strcmp0 (_tmp25_, "") == 0;
	}
	if (_tmp19_) {
		_tmp18_ = TRUE;
	} else {
		const gchar* _tmp26_;
		ProtonPlusModelsSteamChangeKind _tmp27_ = 0;
		gboolean _tmp28_;
		_tmp26_ = json_object_get_string_member_with_default (object, "kind", "");
		_tmp28_ = proton_plus_models_steam_change_receipt_try_kind_from_identifier (_tmp26_, &_tmp27_);
		kind = _tmp27_;
		_tmp18_ = !_tmp28_;
	}
	if (_tmp18_) {
		_tmp17_ = TRUE;
	} else {
		const gchar* _tmp29_;
		ProtonPlusModelsSteamRestartRequirement _tmp30_ = 0;
		gboolean _tmp31_;
		_tmp29_ = json_object_get_string_member_with_default (object, "requirement", "");
		_tmp31_ = proton_plus_models_steam_change_receipt_try_requirement_from_identifier (_tmp29_, &_tmp30_);
		requirement = _tmp30_;
		_tmp17_ = !_tmp31_;
	}
	if (_tmp17_) {
		result = NULL;
		_g_free0 (last_updated_at);
		_g_free0 (first_recorded_at);
		_g_free0 (changed_at);
		_g_free0 (resource_key);
		_g_object_unref0 (target);
		__vala_JsonNode_free0 (target_node);
		return result;
	}
	count = json_object_get_int_member_with_default (object, "occurrence_count", (gint64) 0);
	if (count < ((gint64) 1)) {
		_tmp32_ = TRUE;
	} else {
		_tmp32_ = count > ((gint64) G_MAXUINT);
	}
	if (_tmp32_) {
		result = NULL;
		_g_free0 (last_updated_at);
		_g_free0 (first_recorded_at);
		_g_free0 (changed_at);
		_g_free0 (resource_key);
		_g_object_unref0 (target);
		__vala_JsonNode_free0 (target_node);
		return result;
	}
	session = NULL;
	_tmp33_ = json_object_get_member (object, "observed_session");
	_tmp34_ = __vala_JsonNode_copy0 (_tmp33_);
	session_node = _tmp34_;
	_tmp35_ = session_node;
	if (_tmp35_ != NULL) {
		JsonNode* _tmp36_;
		JsonNode* _tmp37_;
		JsonObject* _tmp38_;
		ProtonPlusModelsSteamSessionIdentity* _tmp39_;
		ProtonPlusModelsSteamSessionIdentity* _tmp40_;
		_tmp36_ = session_node;
		if (json_node_get_node_type (_tmp36_) != JSON_NODE_OBJECT) {
			result = NULL;
			__vala_JsonNode_free0 (session_node);
			_g_object_unref0 (session);
			_g_free0 (last_updated_at);
			_g_free0 (first_recorded_at);
			_g_free0 (changed_at);
			_g_free0 (resource_key);
			_g_object_unref0 (target);
			__vala_JsonNode_free0 (target_node);
			return result;
		}
		_tmp37_ = session_node;
		_tmp38_ = json_node_get_object (_tmp37_);
		_tmp39_ = proton_plus_services_steam_restart_state_store_session_from_json (self, _tmp38_);
		_g_object_unref0 (session);
		session = _tmp39_;
		_tmp40_ = session;
		if (_tmp40_ == NULL) {
			result = NULL;
			__vala_JsonNode_free0 (session_node);
			_g_object_unref0 (session);
			_g_free0 (last_updated_at);
			_g_free0 (first_recorded_at);
			_g_free0 (changed_at);
			_g_free0 (resource_key);
			_g_object_unref0 (target);
			__vala_JsonNode_free0 (target_node);
			return result;
		}
	}
	intent = NULL;
	_tmp41_ = json_object_get_member (object, "configuration_intent");
	_tmp42_ = __vala_JsonNode_copy0 (_tmp41_);
	intent_node = _tmp42_;
	_tmp43_ = intent_node;
	if (_tmp43_ != NULL) {
		JsonNode* _tmp44_;
		JsonNode* _tmp45_;
		JsonObject* _tmp46_;
		ProtonPlusModelsSteamRestartTarget* _tmp47_;
		const gchar* _tmp48_;
		ProtonPlusModelsSteamConfigurationIntent* _tmp49_;
		ProtonPlusModelsSteamConfigurationIntent* _tmp50_;
		_tmp44_ = intent_node;
		if (json_node_get_node_type (_tmp44_) != JSON_NODE_OBJECT) {
			result = NULL;
			__vala_JsonNode_free0 (intent_node);
			_g_object_unref0 (intent);
			__vala_JsonNode_free0 (session_node);
			_g_object_unref0 (session);
			_g_free0 (last_updated_at);
			_g_free0 (first_recorded_at);
			_g_free0 (changed_at);
			_g_free0 (resource_key);
			_g_object_unref0 (target);
			__vala_JsonNode_free0 (target_node);
			return result;
		}
		_tmp45_ = intent_node;
		_tmp46_ = json_node_get_object (_tmp45_);
		_tmp47_ = target;
		_tmp48_ = resource_key;
		_tmp49_ = proton_plus_services_steam_restart_state_store_intent_from_json (self, _tmp46_, schema_version, _tmp47_, _tmp48_, kind);
		_g_object_unref0 (intent);
		intent = _tmp49_;
		_tmp50_ = intent;
		if (_tmp50_ == NULL) {
			result = NULL;
			__vala_JsonNode_free0 (intent_node);
			_g_object_unref0 (intent);
			__vala_JsonNode_free0 (session_node);
			_g_object_unref0 (session);
			_g_free0 (last_updated_at);
			_g_free0 (first_recorded_at);
			_g_free0 (changed_at);
			_g_free0 (resource_key);
			_g_object_unref0 (target);
			__vala_JsonNode_free0 (target_node);
			return result;
		}
	}
	_tmp51_ = target;
	_tmp52_ = resource_key;
	_tmp53_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "subject_id");
	_tmp54_ = _tmp53_;
	_tmp55_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "subject_label");
	_tmp56_ = _tmp55_;
	_tmp57_ = changed_at;
	_tmp58_ = intent;
	_tmp59_ = proton_plus_models_steam_change_receipt_new (_tmp51_, kind, requirement, _tmp52_, _tmp54_, _tmp56_, _tmp57_, _tmp58_);
	_tmp60_ = _tmp59_;
	_g_free0 (_tmp56_);
	_g_free0 (_tmp54_);
	receipt = _tmp60_;
	_tmp61_ = receipt;
	_tmp62_ = first_recorded_at;
	_tmp63_ = last_updated_at;
	_tmp64_ = session;
	_tmp65_ = proton_plus_models_steam_restart_pending_record_new (_tmp61_, _tmp62_, _tmp63_, (guint) count, _tmp64_, json_object_get_boolean_member_with_default (object, "stop_observed", FALSE));
	result = _tmp65_;
	_g_object_unref0 (receipt);
	__vala_JsonNode_free0 (intent_node);
	_g_object_unref0 (intent);
	__vala_JsonNode_free0 (session_node);
	_g_object_unref0 (session);
	_g_free0 (last_updated_at);
	_g_free0 (first_recorded_at);
	_g_free0 (changed_at);
	_g_free0 (resource_key);
	_g_object_unref0 (target);
	__vala_JsonNode_free0 (target_node);
	return result;
}

static JsonObject*
proton_plus_services_steam_restart_state_store_target_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                               ProtonPlusModelsSteamRestartTarget* target)
{
	JsonObject* object = NULL;
	JsonObject* _tmp0_;
	JsonObject* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	JsonObject* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	JsonObject* _tmp7_;
	ProtonPlusModelsSteamInstallationKind _tmp8_;
	ProtonPlusModelsSteamInstallationKind _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	JsonObject* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	JsonObject* _tmp30_;
	gboolean _tmp31_;
	gboolean _tmp32_;
	JsonObject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (target != NULL, NULL);
	_tmp0_ = json_object_new ();
	object = _tmp0_;
	_tmp1_ = object;
	_tmp2_ = proton_plus_models_steam_restart_target_get_id (target);
	_tmp3_ = _tmp2_;
	json_object_set_string_member (_tmp1_, "id", _tmp3_);
	_tmp4_ = object;
	_tmp5_ = proton_plus_models_steam_restart_target_get_data_root (target);
	_tmp6_ = _tmp5_;
	json_object_set_string_member (_tmp4_, "data_root", _tmp6_);
	_tmp7_ = object;
	_tmp8_ = proton_plus_models_steam_restart_target_get_installation_kind (target);
	_tmp9_ = _tmp8_;
	_tmp10_ = proton_plus_services_steam_restart_state_store_installation_kind_to_identifier (_tmp9_);
	_tmp11_ = _tmp10_;
	json_object_set_string_member (_tmp7_, "installation_kind", _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = object;
	_tmp13_ = proton_plus_models_steam_restart_target_get_display_name (target);
	_tmp14_ = _tmp13_;
	json_object_set_string_member (_tmp12_, "display_name", _tmp14_);
	_tmp15_ = proton_plus_models_steam_restart_target_get_flatpak_application_id (target);
	_tmp16_ = _tmp15_;
	if (_tmp16_ != NULL) {
		JsonObject* _tmp17_;
		const gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp17_ = object;
		_tmp18_ = proton_plus_models_steam_restart_target_get_flatpak_application_id (target);
		_tmp19_ = _tmp18_;
		json_object_set_string_member (_tmp17_, "flatpak_application_id", (const gchar*) _tmp19_);
	}
	_tmp20_ = proton_plus_models_steam_restart_target_get_executable_hint (target);
	_tmp21_ = _tmp20_;
	if (_tmp21_ != NULL) {
		JsonObject* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		_tmp22_ = object;
		_tmp23_ = proton_plus_models_steam_restart_target_get_executable_hint (target);
		_tmp24_ = _tmp23_;
		json_object_set_string_member (_tmp22_, "executable_hint", (const gchar*) _tmp24_);
	}
	_tmp25_ = proton_plus_models_steam_restart_target_get_desktop_entry_id (target);
	_tmp26_ = _tmp25_;
	if (_tmp26_ != NULL) {
		JsonObject* _tmp27_;
		const gchar* _tmp28_;
		const gchar* _tmp29_;
		_tmp27_ = object;
		_tmp28_ = proton_plus_models_steam_restart_target_get_desktop_entry_id (target);
		_tmp29_ = _tmp28_;
		json_object_set_string_member (_tmp27_, "desktop_entry_id", (const gchar*) _tmp29_);
	}
	_tmp30_ = object;
	_tmp31_ = proton_plus_models_steam_restart_target_get_storage_only (target);
	_tmp32_ = _tmp31_;
	json_object_set_boolean_member (_tmp30_, "storage_only", _tmp32_);
	result = object;
	return result;
}

static JsonObject*
proton_plus_services_steam_restart_state_store_intent_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                               ProtonPlusModelsSteamConfigurationIntent* intent)
{
	JsonObject* object = NULL;
	JsonObject* _tmp0_;
	ProtonPlusModelsSteamConfigurationFile _tmp1_;
	ProtonPlusModelsSteamConfigurationFile _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	ProtonPlusModelsSteamConfigurationOperation _tmp5_;
	ProtonPlusModelsSteamConfigurationOperation _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gboolean _tmp15_;
	gboolean _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gboolean _tmp19_;
	gboolean _tmp20_;
	JsonObject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (intent != NULL, NULL);
	_tmp0_ = json_object_new ();
	object = _tmp0_;
	_tmp1_ = proton_plus_models_steam_configuration_intent_get_file (intent);
	_tmp2_ = _tmp1_;
	_tmp3_ = proton_plus_models_steam_configuration_intent_file_to_identifier (_tmp2_);
	_tmp4_ = _tmp3_;
	json_object_set_string_member (object, "file", _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = proton_plus_models_steam_configuration_intent_get_operation (intent);
	_tmp6_ = _tmp5_;
	_tmp7_ = proton_plus_models_steam_configuration_intent_operation_to_identifier (_tmp6_);
	_tmp8_ = _tmp7_;
	json_object_set_string_member (object, "operation", _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = proton_plus_models_steam_configuration_intent_get_path (intent);
	_tmp10_ = _tmp9_;
	json_object_set_string_member (object, "path", _tmp10_);
	_tmp11_ = proton_plus_models_steam_configuration_intent_get_field_id (intent);
	_tmp12_ = _tmp11_;
	json_object_set_string_member (object, "field_id", _tmp12_);
	_tmp13_ = proton_plus_models_steam_configuration_intent_get_baseline_fingerprint (intent);
	_tmp14_ = _tmp13_;
	json_object_set_string_member (object, "baseline_fingerprint", _tmp14_);
	_tmp15_ = proton_plus_models_steam_configuration_intent_get_baseline_present (intent);
	_tmp16_ = _tmp15_;
	json_object_set_boolean_member (object, "baseline_present", _tmp16_);
	_tmp17_ = proton_plus_models_steam_configuration_intent_get_desired (intent);
	_tmp18_ = _tmp17_;
	json_object_set_string_member (object, "desired", _tmp18_);
	_tmp19_ = proton_plus_models_steam_configuration_intent_get_desired_present (intent);
	_tmp20_ = _tmp19_;
	json_object_set_boolean_member (object, "desired_present", _tmp20_);
	result = object;
	return result;
}

static ProtonPlusModelsSteamConfigurationIntent*
proton_plus_services_steam_restart_state_store_intent_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                 JsonObject* object,
                                                                 gint schema_version,
                                                                 ProtonPlusModelsSteamRestartTarget* target,
                                                                 const gchar* resource_key,
                                                                 ProtonPlusModelsSteamChangeKind kind)
{
	ProtonPlusModelsSteamConfigurationFile file = 0;
	ProtonPlusModelsSteamConfigurationOperation operation = 0;
	gchar* path = NULL;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* field_id = NULL;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp16_ = FALSE;
	const gchar* _tmp17_;
	gchar* desired = NULL;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* fingerprint = NULL;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	ProtonPlusModelsSteamConfigurationIntent* _tmp41_;
	ProtonPlusModelsSteamConfigurationIntent* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	g_return_val_if_fail (target != NULL, NULL);
	g_return_val_if_fail (resource_key != NULL, NULL);
	file = PROTON_PLUS_MODELS_STEAM_CONFIGURATION_FILE_CONFIG;
	operation = PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_COMPATIBILITY_MAPPING;
	if (schema_version == 1) {
		gint64 legacy_file = 0LL;
		gint64 legacy_operation = 0LL;
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_ = FALSE;
		gboolean _tmp2_ = FALSE;
		legacy_file = json_object_get_int_member_with_default (object, "file", (gint64) -1);
		legacy_operation = json_object_get_int_member_with_default (object, "operation", (gint64) -1);
		if (legacy_file < ((gint64) ((gint) PROTON_PLUS_MODELS_STEAM_CONFIGURATION_FILE_CONFIG))) {
			_tmp2_ = TRUE;
		} else {
			_tmp2_ = legacy_file > ((gint64) ((gint) PROTON_PLUS_MODELS_STEAM_CONFIGURATION_FILE_SHORTCUTS));
		}
		if (_tmp2_) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = legacy_operation < ((gint64) ((gint) PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_COMPATIBILITY_MAPPING));
		}
		if (_tmp1_) {
			_tmp0_ = TRUE;
		} else {
			_tmp0_ = legacy_operation > ((gint64) ((gint) PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_SHORTCUTS_FILE_PRESENT));
		}
		if (_tmp0_) {
			result = NULL;
			return result;
		}
		file = (ProtonPlusModelsSteamConfigurationFile) legacy_file;
		operation = (ProtonPlusModelsSteamConfigurationOperation) legacy_operation;
	} else {
		gboolean _tmp3_ = FALSE;
		const gchar* _tmp4_;
		ProtonPlusModelsSteamConfigurationFile _tmp5_ = 0;
		gboolean _tmp6_;
		_tmp4_ = json_object_get_string_member_with_default (object, "file", "");
		_tmp6_ = proton_plus_models_steam_configuration_intent_try_file_from_identifier (_tmp4_, &_tmp5_);
		file = _tmp5_;
		if (!_tmp6_) {
			_tmp3_ = TRUE;
		} else {
			const gchar* _tmp7_;
			ProtonPlusModelsSteamConfigurationOperation _tmp8_ = 0;
			gboolean _tmp9_;
			_tmp7_ = json_object_get_string_member_with_default (object, "operation", "");
			_tmp9_ = proton_plus_models_steam_configuration_intent_try_operation_from_identifier (_tmp7_, &_tmp8_);
			operation = _tmp8_;
			_tmp3_ = !_tmp9_;
		}
		if (_tmp3_) {
			result = NULL;
			return result;
		}
	}
	_tmp10_ = json_object_get_string_member_with_default (object, "path", "");
	_tmp11_ = g_strdup (_tmp10_);
	path = _tmp11_;
	_tmp12_ = json_object_get_string_member_with_default (object, "field_id", "");
	_tmp13_ = g_strdup (_tmp12_);
	field_id = _tmp13_;
	_tmp17_ = path;
	if (g_strcmp0 (_tmp17_, "") == 0) {
		_tmp16_ = TRUE;
	} else {
		const gchar* _tmp18_;
		_tmp18_ = field_id;
		_tmp16_ = g_strcmp0 (_tmp18_, "") == 0;
	}
	if (_tmp16_) {
		_tmp15_ = TRUE;
	} else {
		_tmp15_ = !json_object_has_member (object, "desired");
	}
	if (_tmp15_) {
		_tmp14_ = TRUE;
	} else {
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		_tmp19_ = path;
		_tmp20_ = field_id;
		_tmp14_ = !proton_plus_services_steam_restart_state_store_is_valid_intent (self, target, kind, file, operation, _tmp19_, _tmp20_, resource_key);
	}
	if (_tmp14_) {
		result = NULL;
		_g_free0 (field_id);
		_g_free0 (path);
		return result;
	}
	_tmp21_ = json_object_get_string_member (object, "desired");
	_tmp22_ = g_strdup (_tmp21_);
	desired = _tmp22_;
	if (schema_version == 1) {
		gchar* baseline = NULL;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		static const char legacy_absent[] = "\u001eprotonplus-absent";
		gboolean baseline_present = FALSE;
		const gchar* _tmp25_;
		gboolean desired_present = FALSE;
		const gchar* _tmp26_;
		const gchar* _tmp27_ = NULL;
		const gchar* _tmp29_ = NULL;
		const gchar* _tmp31_;
		const gchar* _tmp32_;
		ProtonPlusModelsSteamConfigurationIntent* _tmp33_;
		if (!json_object_has_member (object, "baseline")) {
			result = NULL;
			_g_free0 (desired);
			_g_free0 (field_id);
			_g_free0 (path);
			return result;
		}
		_tmp23_ = json_object_get_string_member (object, "baseline");
		_tmp24_ = g_strdup (_tmp23_);
		baseline = _tmp24_;
		_tmp25_ = baseline;
		baseline_present = g_strcmp0 (_tmp25_, legacy_absent) != 0;
		_tmp26_ = desired;
		desired_present = g_strcmp0 (_tmp26_, legacy_absent) != 0;
		if (baseline_present) {
			const gchar* _tmp28_;
			_tmp28_ = baseline;
			_tmp27_ = _tmp28_;
		} else {
			_tmp27_ = "";
		}
		if (desired_present) {
			const gchar* _tmp30_;
			_tmp30_ = desired;
			_tmp29_ = _tmp30_;
		} else {
			_tmp29_ = "";
		}
		_tmp31_ = path;
		_tmp32_ = field_id;
		_tmp33_ = proton_plus_models_steam_configuration_intent_new (file, operation, _tmp31_, _tmp32_, _tmp27_, _tmp29_, baseline_present, desired_present, NULL);
		result = _tmp33_;
		_g_free0 (baseline);
		_g_free0 (desired);
		_g_free0 (field_id);
		_g_free0 (path);
		return result;
	}
	_tmp34_ = json_object_get_string_member_with_default (object, "baseline_fingerprint", "");
	_tmp35_ = g_strdup (_tmp34_);
	fingerprint = _tmp35_;
	_tmp36_ = fingerprint;
	if (g_strcmp0 (_tmp36_, "") == 0) {
		result = NULL;
		_g_free0 (fingerprint);
		_g_free0 (desired);
		_g_free0 (field_id);
		_g_free0 (path);
		return result;
	}
	_tmp37_ = path;
	_tmp38_ = field_id;
	_tmp39_ = desired;
	_tmp40_ = fingerprint;
	_tmp41_ = proton_plus_models_steam_configuration_intent_new (file, operation, _tmp37_, _tmp38_, "", _tmp39_, json_object_get_boolean_member_with_default (object, "baseline_present", TRUE), json_object_get_boolean_member_with_default (object, "desired_present", TRUE), _tmp40_);
	result = _tmp41_;
	_g_free0 (fingerprint);
	_g_free0 (desired);
	_g_free0 (field_id);
	_g_free0 (path);
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gboolean
proton_plus_services_steam_restart_state_store_is_valid_intent (ProtonPlusServicesSteamRestartStateStore* self,
                                                                ProtonPlusModelsSteamRestartTarget* target,
                                                                ProtonPlusModelsSteamChangeKind kind,
                                                                ProtonPlusModelsSteamConfigurationFile file,
                                                                ProtonPlusModelsSteamConfigurationOperation operation,
                                                                const gchar* path,
                                                                const gchar* field_id,
                                                                const gchar* resource_key)
{
	gchar* canonical = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* config = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* prefix = NULL;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* tail = NULL;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	gchar* _tmp28_;
	gchar** parts = NULL;
	const gchar* _tmp29_;
	gchar** _tmp30_;
	gchar** _tmp31_;
	gint parts_length1;
	gint _parts_size_;
	gboolean _tmp32_ = FALSE;
	gboolean _tmp33_ = FALSE;
	gchar** _tmp34_;
	gint _tmp34__length1;
	gchar* profile_config = NULL;
	const gchar* _tmp39_;
	const gchar* _tmp40_;
	gchar** _tmp41_;
	gint _tmp41__length1;
	const gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	const gchar* _tmp46_;
	gboolean _tmp47_;
	gboolean _tmp56_ = FALSE;
	gboolean _tmp67_ = FALSE;
	gboolean _tmp68_ = FALSE;
	gboolean _tmp69_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (target != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (field_id != NULL, FALSE);
	g_return_val_if_fail (resource_key != NULL, FALSE);
	_tmp0_ = g_canonicalize_filename (path, NULL);
	canonical = _tmp0_;
	_tmp1_ = canonical;
	if (g_strcmp0 (_tmp1_, path) != 0) {
		result = FALSE;
		_g_free0 (canonical);
		return result;
	}
	_tmp2_ = proton_plus_models_steam_restart_target_get_data_root (target);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_build_filename (_tmp3_, "config", "config.vdf", NULL);
	config = _tmp4_;
	if (file == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_FILE_CONFIG) {
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		gboolean _tmp9_ = FALSE;
		if (operation == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_COMPATIBILITY_MAPPING) {
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp10_ = canonical;
			_tmp11_ = config;
			_tmp9_ = g_strcmp0 (_tmp10_, _tmp11_) == 0;
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			const gchar* _tmp12_;
			_tmp12_ = config;
			_tmp8_ = proton_plus_services_steam_restart_state_store_path_resolves_inside (self, path, _tmp12_);
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			_tmp7_ = proton_plus_services_steam_restart_state_store_is_uint (self, field_id);
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp13_ = g_strdup_printf ("%s#CompatToolMapping/%s", path, field_id);
			_tmp14_ = _tmp13_;
			_tmp6_ = g_strcmp0 (resource_key, _tmp14_) == 0;
			_g_free0 (_tmp14_);
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			gboolean _tmp15_ = FALSE;
			if (kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_DEFAULT_COMPATIBILITY_TOOL_CHANGED) {
				_tmp15_ = TRUE;
			} else {
				_tmp15_ = kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_GAME_COMPATIBILITY_TOOL_CHANGED;
			}
			_tmp5_ = _tmp15_;
		} else {
			_tmp5_ = FALSE;
		}
		result = _tmp5_;
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	_tmp16_ = proton_plus_models_steam_restart_target_get_data_root (target);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_build_filename (_tmp17_, "userdata", NULL);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strconcat (_tmp19_, "/", NULL);
	_tmp21_ = _tmp20_;
	_g_free0 (_tmp19_);
	prefix = _tmp21_;
	_tmp22_ = canonical;
	_tmp23_ = prefix;
	if (!g_str_has_prefix (_tmp22_, _tmp23_)) {
		result = FALSE;
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	_tmp24_ = canonical;
	_tmp25_ = prefix;
	_tmp26_ = strlen (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = string_substring (_tmp24_, (glong) _tmp27_, (glong) -1);
	tail = _tmp28_;
	_tmp29_ = tail;
	_tmp31_ = _tmp30_ = g_strsplit (_tmp29_, "/", 0);
	parts = _tmp31_;
	parts_length1 = _vala_array_length (_tmp30_);
	_parts_size_ = parts_length1;
	_tmp34_ = parts;
	_tmp34__length1 = parts_length1;
	if (_tmp34__length1 != 3) {
		_tmp33_ = TRUE;
	} else {
		gchar** _tmp35_;
		gint _tmp35__length1;
		const gchar* _tmp36_;
		_tmp35_ = parts;
		_tmp35__length1 = parts_length1;
		_tmp36_ = _tmp35_[0];
		_tmp33_ = !proton_plus_services_steam_restart_state_store_is_uint (self, _tmp36_);
	}
	if (_tmp33_) {
		_tmp32_ = TRUE;
	} else {
		gchar** _tmp37_;
		gint _tmp37__length1;
		const gchar* _tmp38_;
		_tmp37_ = parts;
		_tmp37__length1 = parts_length1;
		_tmp38_ = _tmp37_[1];
		_tmp32_ = g_strcmp0 (_tmp38_, "config") != 0;
	}
	if (_tmp32_) {
		result = FALSE;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (tail);
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	_tmp39_ = proton_plus_models_steam_restart_target_get_data_root (target);
	_tmp40_ = _tmp39_;
	_tmp41_ = parts;
	_tmp41__length1 = parts_length1;
	_tmp42_ = _tmp41_[0];
	_tmp43_ = g_build_filename (_tmp40_, "userdata", _tmp42_, "config", NULL);
	profile_config = _tmp43_;
	_tmp44_ = g_path_get_dirname (path);
	_tmp45_ = _tmp44_;
	_tmp46_ = profile_config;
	_tmp47_ = !proton_plus_services_steam_restart_state_store_directory_is_expected_or_missing (self, _tmp45_, _tmp46_);
	_g_free0 (_tmp45_);
	if (_tmp47_) {
		result = FALSE;
		_g_free0 (profile_config);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (tail);
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	if (file == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_FILE_LOCALCONFIG) {
		gboolean _tmp48_ = FALSE;
		gboolean _tmp49_ = FALSE;
		gboolean _tmp50_ = FALSE;
		gboolean _tmp51_ = FALSE;
		if (operation == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_LAUNCH_OPTIONS) {
			gchar** _tmp52_;
			gint _tmp52__length1;
			const gchar* _tmp53_;
			_tmp52_ = parts;
			_tmp52__length1 = parts_length1;
			_tmp53_ = _tmp52_[2];
			_tmp51_ = g_strcmp0 (_tmp53_, "localconfig.vdf") == 0;
		} else {
			_tmp51_ = FALSE;
		}
		if (_tmp51_) {
			_tmp50_ = proton_plus_services_steam_restart_state_store_is_uint (self, field_id);
		} else {
			_tmp50_ = FALSE;
		}
		if (_tmp50_) {
			gchar* _tmp54_;
			gchar* _tmp55_;
			_tmp54_ = g_strdup_printf ("%s#%s/LaunchOptions", path, field_id);
			_tmp55_ = _tmp54_;
			_tmp49_ = g_strcmp0 (resource_key, _tmp55_) == 0;
			_g_free0 (_tmp55_);
		} else {
			_tmp49_ = FALSE;
		}
		if (_tmp49_) {
			_tmp48_ = kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_STEAM_GAME_LAUNCH_OPTIONS_CHANGED;
		} else {
			_tmp48_ = FALSE;
		}
		result = _tmp48_;
		_g_free0 (profile_config);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (tail);
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	if (file != PROTON_PLUS_MODELS_STEAM_CONFIGURATION_FILE_SHORTCUTS) {
		_tmp56_ = TRUE;
	} else {
		gchar** _tmp57_;
		gint _tmp57__length1;
		const gchar* _tmp58_;
		_tmp57_ = parts;
		_tmp57__length1 = parts_length1;
		_tmp58_ = _tmp57_[2];
		_tmp56_ = g_strcmp0 (_tmp58_, "shortcuts.vdf") != 0;
	}
	if (_tmp56_) {
		result = FALSE;
		_g_free0 (profile_config);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (tail);
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	if (operation == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_SHORTCUT_LAUNCH_OPTIONS) {
		gboolean _tmp59_ = FALSE;
		gboolean _tmp60_ = FALSE;
		if (proton_plus_services_steam_restart_state_store_is_uint (self, field_id)) {
			gchar* _tmp61_;
			gchar* _tmp62_;
			_tmp61_ = g_strdup_printf ("%s#shortcut/%s/LaunchOptions", path, field_id);
			_tmp62_ = _tmp61_;
			_tmp60_ = g_strcmp0 (resource_key, _tmp62_) == 0;
			_g_free0 (_tmp62_);
		} else {
			_tmp60_ = FALSE;
		}
		if (_tmp60_) {
			_tmp59_ = kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_NON_STEAM_GAME_LAUNCH_OPTIONS_CHANGED;
		} else {
			_tmp59_ = FALSE;
		}
		result = _tmp59_;
		_g_free0 (profile_config);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (tail);
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	if (operation == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_SHORTCUTS_FILE_PRESENT) {
		gboolean _tmp63_ = FALSE;
		gboolean _tmp64_ = FALSE;
		if (g_strcmp0 (field_id, "shortcuts.vdf") == 0) {
			gchar* _tmp65_;
			gchar* _tmp66_;
			_tmp65_ = g_strdup_printf ("%s#shortcuts.vdf", path);
			_tmp66_ = _tmp65_;
			_tmp64_ = g_strcmp0 (resource_key, _tmp66_) == 0;
			_g_free0 (_tmp66_);
		} else {
			_tmp64_ = FALSE;
		}
		if (_tmp64_) {
			_tmp63_ = kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_SHORTCUTS_VDF_CREATED;
		} else {
			_tmp63_ = FALSE;
		}
		result = _tmp63_;
		_g_free0 (profile_config);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (tail);
		_g_free0 (prefix);
		_g_free0 (config);
		_g_free0 (canonical);
		return result;
	}
	if (operation == PROTON_PLUS_MODELS_STEAM_CONFIGURATION_OPERATION_SHORTCUT_PRESENCE) {
		_tmp69_ = g_strcmp0 (field_id, "ProtonPlus") == 0;
	} else {
		_tmp69_ = FALSE;
	}
	if (_tmp69_) {
		gchar* _tmp70_;
		gchar* _tmp71_;
		_tmp70_ = g_strdup_printf ("%s#ProtonPlus", path);
		_tmp71_ = _tmp70_;
		_tmp68_ = g_strcmp0 (resource_key, _tmp71_) == 0;
		_g_free0 (_tmp71_);
	} else {
		_tmp68_ = FALSE;
	}
	if (_tmp68_) {
		gboolean _tmp72_ = FALSE;
		if (kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_PROTONPLUS_SHORTCUT_CREATED) {
			_tmp72_ = TRUE;
		} else {
			_tmp72_ = kind == PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_PROTONPLUS_SHORTCUT_REMOVED;
		}
		_tmp67_ = _tmp72_;
	} else {
		_tmp67_ = FALSE;
	}
	result = _tmp67_;
	_g_free0 (profile_config);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (tail);
	_g_free0 (prefix);
	_g_free0 (config);
	_g_free0 (canonical);
	return result;
}

static gboolean
proton_plus_services_steam_restart_state_store_path_resolves_inside (ProtonPlusServicesSteamRestartStateStore* self,
                                                                     const gchar* path,
                                                                     const gchar* expected)
{
	gchar* resolved = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (expected != NULL, FALSE);
	_tmp0_ = realpath (path, NULL);
	resolved = _tmp0_;
	_tmp2_ = resolved;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = resolved;
		_tmp1_ = g_strcmp0 (_tmp3_, expected) == 0;
	}
	result = _tmp1_;
	_g_free0 (resolved);
	return result;
}

static gboolean
proton_plus_services_steam_restart_state_store_directory_is_expected_or_missing (ProtonPlusServicesSteamRestartStateStore* self,
                                                                                 const gchar* path,
                                                                                 const gchar* expected)
{
	gchar* resolved = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (expected != NULL, FALSE);
	_tmp0_ = realpath (path, NULL);
	resolved = _tmp0_;
	_tmp2_ = resolved;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = resolved;
		_tmp1_ = g_strcmp0 (_tmp3_, expected) == 0;
	}
	result = _tmp1_;
	_g_free0 (resolved);
	return result;
}

static gboolean
uint_try_parse (const gchar* str,
                guint* _result_,
                const gchar** unparsed,
                guint _base)
{
	guint _vala__result_ = 0U;
	const gchar* _vala_unparsed = NULL;
	gchar* endptr = NULL;
	gulong ulong_result = 0UL;
	gchar* _tmp0_ = NULL;
	gulong _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gulong _tmp6_;
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	errno = 0;
	_tmp1_ = strtoul (str, &_tmp0_, (gint) _base);
	endptr = _tmp0_;
	ulong_result = _tmp1_;
	_tmp2_ = endptr;
	_tmp3_ = strlen (str);
	_tmp4_ = _tmp3_;
	if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
		_vala_unparsed = "";
	} else {
		gchar* _tmp5_;
		_tmp5_ = endptr;
		_vala_unparsed = (const gchar*) _tmp5_;
	}
	_tmp6_ = ulong_result;
	if ((((gulong) 0) <= _tmp6_) && (_tmp6_ <= ((gulong) G_MAXUINT))) {
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		_vala__result_ = (guint) ulong_result;
		if (errno != ERANGE) {
			_tmp8_ = errno != EINVAL;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			const gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp9_ = _vala_unparsed;
			_tmp10_ = endptr;
			_tmp7_ = _tmp9_ != _tmp10_;
		} else {
			_tmp7_ = FALSE;
		}
		result = _tmp7_;
		if (_result_) {
			*_result_ = _vala__result_;
		}
		if (unparsed) {
			*unparsed = _vala_unparsed;
		}
		return result;
	} else {
		_vala__result_ = G_MAXUINT;
		result = FALSE;
		if (_result_) {
			*_result_ = _vala__result_;
		}
		if (unparsed) {
			*unparsed = _vala_unparsed;
		}
		return result;
	}
}

static gboolean
proton_plus_services_steam_restart_state_store_is_uint (ProtonPlusServicesSteamRestartStateStore* self,
                                                        const gchar* value)
{
	guint parsed = 0U;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (value != NULL, FALSE);
	if (g_strcmp0 (value, "") != 0) {
		guint _tmp1_ = 0U;
		gboolean _tmp2_;
		_tmp2_ = uint_try_parse (value, &_tmp1_, NULL, (guint) 0);
		parsed = _tmp1_;
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static ProtonPlusModelsSteamRestartTarget*
proton_plus_services_steam_restart_state_store_target_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                 JsonObject* object)
{
	ProtonPlusModelsSteamInstallationKind kind = 0;
	gchar* data_root = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* stored_id = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	ProtonPlusModelsSteamRestartTarget* target = NULL;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	ProtonPlusModelsSteamRestartTarget* _tmp19_;
	ProtonPlusModelsSteamRestartTarget* _tmp20_;
	ProtonPlusModelsSteamRestartTarget* _tmp21_ = NULL;
	ProtonPlusModelsSteamRestartTarget* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	ProtonPlusModelsSteamRestartTarget* _tmp27_;
	ProtonPlusModelsSteamRestartTarget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	kind = PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_UNKNOWN;
	_tmp0_ = json_object_get_string_member_with_default (object, "data_root", "");
	_tmp1_ = g_strdup (_tmp0_);
	data_root = _tmp1_;
	_tmp2_ = json_object_get_string_member_with_default (object, "id", "");
	_tmp3_ = g_strdup (_tmp2_);
	stored_id = _tmp3_;
	_tmp6_ = data_root;
	if (g_strcmp0 (_tmp6_, "") == 0) {
		_tmp5_ = TRUE;
	} else {
		const gchar* _tmp7_;
		_tmp7_ = stored_id;
		_tmp5_ = g_strcmp0 (_tmp7_, "") == 0;
	}
	if (_tmp5_) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp8_;
		ProtonPlusModelsSteamInstallationKind _tmp9_ = 0;
		gboolean _tmp10_;
		_tmp8_ = json_object_get_string_member_with_default (object, "installation_kind", "");
		_tmp10_ = proton_plus_services_steam_restart_state_store_try_installation_kind_from_identifier (_tmp8_, &_tmp9_);
		kind = _tmp9_;
		_tmp4_ = !_tmp10_;
	}
	if (_tmp4_) {
		result = NULL;
		_g_free0 (stored_id);
		_g_free0 (data_root);
		return result;
	}
	_tmp11_ = data_root;
	_tmp12_ = json_object_get_string_member_with_default (object, "display_name", "Steam");
	_tmp13_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "flatpak_application_id");
	_tmp14_ = _tmp13_;
	_tmp15_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "executable_hint");
	_tmp16_ = _tmp15_;
	_tmp17_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "desktop_entry_id");
	_tmp18_ = _tmp17_;
	_tmp19_ = proton_plus_models_steam_restart_target_new (_tmp11_, kind, _tmp12_, _tmp14_, _tmp16_, _tmp18_, json_object_get_boolean_member_with_default (object, "storage_only", FALSE));
	_tmp20_ = _tmp19_;
	_g_free0 (_tmp18_);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	target = _tmp20_;
	_tmp22_ = target;
	_tmp23_ = proton_plus_models_steam_restart_target_get_id (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = stored_id;
	if (g_strcmp0 (_tmp24_, _tmp25_) == 0) {
		ProtonPlusModelsSteamRestartTarget* _tmp26_;
		_tmp26_ = target;
		_tmp21_ = _tmp26_;
	} else {
		_tmp21_ = NULL;
	}
	_tmp27_ = _g_object_ref0 (_tmp21_);
	result = _tmp27_;
	_g_object_unref0 (target);
	_g_free0 (stored_id);
	_g_free0 (data_root);
	return result;
}

static JsonObject*
proton_plus_services_steam_restart_state_store_session_to_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                ProtonPlusModelsSteamSessionIdentity* session)
{
	JsonObject* object = NULL;
	JsonObject* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	JsonObject* _tmp6_;
	gint64 _tmp7_;
	gint64 _tmp8_;
	JsonObject* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	JsonObject* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (session != NULL, NULL);
	_tmp0_ = json_object_new ();
	object = _tmp0_;
	_tmp1_ = proton_plus_models_steam_session_identity_get_boot_id (session);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		JsonObject* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = object;
		_tmp4_ = proton_plus_models_steam_session_identity_get_boot_id (session);
		_tmp5_ = _tmp4_;
		json_object_set_string_member (_tmp3_, "boot_id", (const gchar*) _tmp5_);
	}
	_tmp6_ = object;
	_tmp7_ = proton_plus_models_steam_session_identity_get_process_start_ticks (session);
	_tmp8_ = _tmp7_;
	json_object_set_int_member (_tmp6_, "process_start_ticks", _tmp8_);
	_tmp9_ = object;
	_tmp10_ = proton_plus_models_steam_session_identity_get_process_pid (session);
	_tmp11_ = _tmp10_;
	json_object_set_int_member (_tmp9_, "process_pid", (gint64) _tmp11_);
	_tmp12_ = proton_plus_models_steam_session_identity_get_flatpak_instance_id (session);
	_tmp13_ = _tmp12_;
	if (_tmp13_ != NULL) {
		JsonObject* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp14_ = object;
		_tmp15_ = proton_plus_models_steam_session_identity_get_flatpak_instance_id (session);
		_tmp16_ = _tmp15_;
		json_object_set_string_member (_tmp14_, "flatpak_instance_id", (const gchar*) _tmp16_);
	}
	result = object;
	return result;
}

static ProtonPlusModelsSteamSessionIdentity*
proton_plus_services_steam_restart_state_store_session_from_json (ProtonPlusServicesSteamRestartStateStore* self,
                                                                  JsonObject* object)
{
	gchar* instance = NULL;
	gchar* _tmp0_;
	gchar* boot = NULL;
	gchar* _tmp1_;
	gint64 ticks = 0LL;
	gint64 pid = 0LL;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	const gchar* _tmp12_;
	const gchar* _tmp14_;
	ProtonPlusModelsSteamSessionIdentity* _tmp15_;
	ProtonPlusModelsSteamSessionIdentity* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	_tmp0_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "flatpak_instance_id");
	instance = _tmp0_;
	_tmp1_ = proton_plus_services_steam_restart_state_store_optional_string (self, object, "boot_id");
	boot = _tmp1_;
	ticks = json_object_get_int_member_with_default (object, "process_start_ticks", (gint64) 0);
	pid = json_object_get_int_member_with_default (object, "process_pid", (gint64) 0);
	_tmp3_ = instance;
	if (_tmp3_ != NULL) {
		const gchar* _tmp4_;
		_tmp4_ = instance;
		_tmp2_ = g_strcmp0 (_tmp4_, "") != 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		ProtonPlusModelsSteamSessionIdentity* _tmp7_;
		_tmp5_ = boot;
		_tmp6_ = instance;
		_tmp7_ = proton_plus_models_steam_session_identity_new (_tmp5_, ticks, (gint) pid, _tmp6_);
		result = _tmp7_;
		_g_free0 (boot);
		_g_free0 (instance);
		return result;
	}
	_tmp12_ = boot;
	if (_tmp12_ == NULL) {
		_tmp11_ = TRUE;
	} else {
		const gchar* _tmp13_;
		_tmp13_ = boot;
		_tmp11_ = g_strcmp0 (_tmp13_, "") == 0;
	}
	if (_tmp11_) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = ticks <= ((gint64) 0);
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = pid <= ((gint64) 0);
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = pid > ((gint64) G_MAXINT);
	}
	if (_tmp8_) {
		result = NULL;
		_g_free0 (boot);
		_g_free0 (instance);
		return result;
	}
	_tmp14_ = boot;
	_tmp15_ = proton_plus_models_steam_session_identity_new (_tmp14_, ticks, (gint) pid, NULL);
	result = _tmp15_;
	_g_free0 (boot);
	_g_free0 (instance);
	return result;
}

static gchar*
proton_plus_services_steam_restart_state_store_optional_string (ProtonPlusServicesSteamRestartStateStore* self,
                                                                JsonObject* object,
                                                                const gchar* member)
{
	gchar* value = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp3_;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	g_return_val_if_fail (member != NULL, NULL);
	if (!json_object_has_member (object, member)) {
		result = NULL;
		return result;
	}
	_tmp0_ = json_object_get_string_member_with_default (object, member, "");
	_tmp1_ = g_strdup (_tmp0_);
	value = _tmp1_;
	_tmp3_ = value;
	if (g_strcmp0 (_tmp3_, "") == 0) {
		_tmp2_ = NULL;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = value;
		_tmp2_ = _tmp4_;
	}
	_tmp5_ = g_strdup (_tmp2_);
	result = _tmp5_;
	_g_free0 (value);
	return result;
}

static gchar*
proton_plus_services_steam_restart_state_store_installation_kind_to_identifier (ProtonPlusModelsSteamInstallationKind kind)
{
	gchar* result;
	switch (kind) {
		case PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_NATIVE:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("native");
			result = _tmp0_;
			return result;
		}
		case PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_FLATPAK:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("flatpak");
			result = _tmp1_;
			return result;
		}
		case PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_SNAP:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("snap");
			result = _tmp2_;
			return result;
		}
		case PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_CUSTOM:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("custom");
			result = _tmp3_;
			return result;
		}
		default:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("unknown");
			result = _tmp4_;
			return result;
		}
	}
}

static gboolean
proton_plus_services_steam_restart_state_store_try_installation_kind_from_identifier (const gchar* value,
                                                                                      ProtonPlusModelsSteamInstallationKind* kind)
{
	ProtonPlusModelsSteamInstallationKind _vala_kind = 0;
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	static GQuark _tmp1_label3 = 0;
	gboolean result;
	g_return_val_if_fail (value != NULL, FALSE);
	_vala_kind = PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_UNKNOWN;
	_tmp0_ = value;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("native")))) {
		switch (0) {
			default:
			{
				_vala_kind = PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_NATIVE;
				result = TRUE;
				if (kind) {
					*kind = _vala_kind;
				}
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("flatpak")))) {
		switch (0) {
			default:
			{
				_vala_kind = PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_FLATPAK;
				result = TRUE;
				if (kind) {
					*kind = _vala_kind;
				}
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("snap")))) {
		switch (0) {
			default:
			{
				_vala_kind = PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_SNAP;
				result = TRUE;
				if (kind) {
					*kind = _vala_kind;
				}
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("custom")))) {
		switch (0) {
			default:
			{
				_vala_kind = PROTON_PLUS_MODELS_STEAM_INSTALLATION_KIND_CUSTOM;
				result = TRUE;
				if (kind) {
					*kind = _vala_kind;
				}
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = FALSE;
				if (kind) {
					*kind = _vala_kind;
				}
				return result;
			}
		}
	}
}

const gchar*
proton_plus_services_steam_restart_state_store_get_path (ProtonPlusServicesSteamRestartStateStore* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_path;
	result = _tmp0_;
	return result;
}

static void
proton_plus_services_steam_restart_state_store_set_path (ProtonPlusServicesSteamRestartStateStore* self,
                                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_services_steam_restart_state_store_get_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_path);
		self->priv->_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_services_steam_restart_state_store_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_PATH_PROPERTY]);
	}
}

const gchar*
proton_plus_services_steam_restart_state_store_get_last_error (ProtonPlusServicesSteamRestartStateStore* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_last_error;
	result = _tmp0_;
	return result;
}

static void
proton_plus_services_steam_restart_state_store_set_last_error (ProtonPlusServicesSteamRestartStateStore* self,
                                                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_services_steam_restart_state_store_get_last_error (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_last_error);
		self->priv->_last_error = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_services_steam_restart_state_store_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_LAST_ERROR_PROPERTY]);
	}
}

static void
proton_plus_services_steam_restart_state_store_class_init (ProtonPlusServicesSteamRestartStateStoreClass * klass,
                                                           gpointer klass_data)
{
	proton_plus_services_steam_restart_state_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusServicesSteamRestartStateStore_private_offset);
	((ProtonPlusServicesSteamRestartStateStoreClass *) klass)->save = (gboolean (*) (ProtonPlusServicesSteamRestartStateStore*, GeeCollection*)) proton_plus_services_steam_restart_state_store_real_save;
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_services_steam_restart_state_store_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_services_steam_restart_state_store_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_services_steam_restart_state_store_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_PATH_PROPERTY, proton_plus_services_steam_restart_state_store_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_PATH_PROPERTY] = g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_LAST_ERROR_PROPERTY, proton_plus_services_steam_restart_state_store_properties[PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_LAST_ERROR_PROPERTY] = g_param_spec_string ("last-error", "last-error", "last-error", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_services_steam_restart_state_store_instance_init (ProtonPlusServicesSteamRestartStateStore * self,
                                                              gpointer klass)
{
	self->priv = proton_plus_services_steam_restart_state_store_get_instance_private (self);
	self->priv->_last_error = NULL;
}

static void
proton_plus_services_steam_restart_state_store_finalize (GObject * obj)
{
	ProtonPlusServicesSteamRestartStateStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_STORE, ProtonPlusServicesSteamRestartStateStore);
	_g_free0 (self->priv->_path);
	_g_free0 (self->priv->_last_error);
	G_OBJECT_CLASS (proton_plus_services_steam_restart_state_store_parent_class)->finalize (obj);
}

static GType
proton_plus_services_steam_restart_state_store_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesSteamRestartStateStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_steam_restart_state_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesSteamRestartStateStore), 0, (GInstanceInitFunc) proton_plus_services_steam_restart_state_store_instance_init, NULL };
	GType proton_plus_services_steam_restart_state_store_type_id;
	proton_plus_services_steam_restart_state_store_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusServicesSteamRestartStateStore", &g_define_type_info, 0);
	ProtonPlusServicesSteamRestartStateStore_private_offset = g_type_add_instance_private (proton_plus_services_steam_restart_state_store_type_id, sizeof (ProtonPlusServicesSteamRestartStateStorePrivate));
	return proton_plus_services_steam_restart_state_store_type_id;
}

GType
proton_plus_services_steam_restart_state_store_get_type (void)
{
	static volatile gsize proton_plus_services_steam_restart_state_store_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_steam_restart_state_store_type_id__once)) {
		GType proton_plus_services_steam_restart_state_store_type_id;
		proton_plus_services_steam_restart_state_store_type_id = proton_plus_services_steam_restart_state_store_get_type_once ();
		g_once_init_leave (&proton_plus_services_steam_restart_state_store_type_id__once, proton_plus_services_steam_restart_state_store_type_id);
	}
	return proton_plus_services_steam_restart_state_store_type_id__once;
}

static void
_vala_proton_plus_services_steam_restart_state_store_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec)
{
	ProtonPlusServicesSteamRestartStateStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_STORE, ProtonPlusServicesSteamRestartStateStore);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_PATH_PROPERTY:
		g_value_set_string (value, proton_plus_services_steam_restart_state_store_get_path (self));
		break;
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_LAST_ERROR_PROPERTY:
		g_value_set_string (value, proton_plus_services_steam_restart_state_store_get_last_error (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_services_steam_restart_state_store_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec)
{
	ProtonPlusServicesSteamRestartStateStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_TYPE_STEAM_RESTART_STATE_STORE, ProtonPlusServicesSteamRestartStateStore);
	switch (property_id) {
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_PATH_PROPERTY:
		proton_plus_services_steam_restart_state_store_set_path (self, g_value_get_string (value));
		break;
		case PROTON_PLUS_SERVICES_STEAM_RESTART_STATE_STORE_LAST_ERROR_PROPERTY:
		proton_plus_services_steam_restart_state_store_set_last_error (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

