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

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gee.h>

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

enum  {
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_0_PROPERTY,
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_PROVIDER_ID_PROPERTY,
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_providers_provider_definition_validation_result_properties[PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_0_PROPERTY,
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_IS_VALID_PROPERTY,
	PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_providers_provider_registry_properties[PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ProtonPlusModelsProvidersProviderDefinitionValidationResultPrivate {
	gchar* _provider_id;
	gchar** messages;
	gint messages_length1;
	gint _messages_size_;
};

struct _ProtonPlusModelsProvidersProviderRegistryPrivate {
	GeeHashMap* definitions_by_id;
	GeeHashMap* definitions_by_category;
	GeeArrayList* all_definitions;
	GeeArrayList* validation_results;
};

static gint ProtonPlusModelsProvidersProviderDefinitionValidationResult_private_offset;
static gpointer proton_plus_models_providers_provider_definition_validation_result_parent_class = NULL;
static gint ProtonPlusModelsProvidersProviderRegistry_private_offset;
static gpointer proton_plus_models_providers_provider_registry_parent_class = NULL;

static void proton_plus_models_providers_provider_definition_validation_result_set_provider_id (ProtonPlusModelsProvidersProviderDefinitionValidationResult* self,
                                                                                         const gchar* value);
static gchar** proton_plus_models_providers_provider_definition_validation_result_copy_messages (gchar** values,
                                                                                          gint values_length1,
                                                                                          gint* result_length1);
static void proton_plus_models_providers_provider_definition_validation_result_finalize (GObject * obj);
static GType proton_plus_models_providers_provider_definition_validation_result_get_type_once (void);
static void _vala_proton_plus_models_providers_provider_definition_validation_result_get_property (GObject * object,
                                                                                            guint property_id,
                                                                                            GValue * value,
                                                                                            GParamSpec * pspec);
static void _vala_proton_plus_models_providers_provider_definition_validation_result_set_property (GObject * object,
                                                                                            guint property_id,
                                                                                            const GValue * value,
                                                                                            GParamSpec * pspec);
static void proton_plus_models_providers_provider_registry_initialize_categories (ProtonPlusModelsProvidersProviderRegistry* self);
static ProtonPlusModelsProvidersProviderDefinition** _vala_array_dup51 (ProtonPlusModelsProvidersProviderDefinition** self,
                                                                 gssize length);
VALA_EXTERN ProtonPlusModelsProvidersProviderDefinition** proton_plus_models_providers_built_in_provider_definitions_create_all (gint* result_length1);
static void proton_plus_models_providers_provider_registry_add (ProtonPlusModelsProvidersProviderRegistry* self,
                                                         ProtonPlusModelsProvidersProviderDefinition* definition);
static void proton_plus_models_providers_provider_registry_validate (ProtonPlusModelsProvidersProviderRegistry* self);
static ProtonPlusModelsProvidersProviderDefinition** proton_plus_models_providers_provider_registry_copy_definitions (GeeCollection* values,
                                                                                                               gint* result_length1);
static ProtonPlusModelsProvidersProviderDefinitionValidationResult** proton_plus_models_providers_provider_registry_copy_validation_results (GeeCollection* values,
                                                                                                                                      gint* result_length1);
static void proton_plus_models_providers_provider_registry_validate_variants (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                                       GeeArrayList* messages);
static void proton_plus_models_providers_provider_registry_validate_install_layouts (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                                              GeeArrayList* messages);
static void proton_plus_models_providers_provider_registry_validate_legacy_endpoints (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                                               GeeArrayList* messages);
static gchar** proton_plus_models_providers_provider_registry_copy_messages (GeeCollection* values,
                                                                      gint* result_length1);
static void proton_plus_models_providers_provider_registry_finalize (GObject * obj);
static GType proton_plus_models_providers_provider_registry_get_type_once (void);
static void _vala_proton_plus_models_providers_provider_registry_get_property (GObject * object,
                                                                        guint property_id,
                                                                        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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_models_providers_provider_definition_validation_result_get_instance_private (ProtonPlusModelsProvidersProviderDefinitionValidationResult* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsProvidersProviderDefinitionValidationResult_private_offset);
}

ProtonPlusModelsProvidersProviderDefinitionValidationResult*
proton_plus_models_providers_provider_definition_validation_result_construct (GType object_type,
                                                                              const gchar* provider_id,
                                                                              gchar** messages,
                                                                              gint messages_length1)
{
	ProtonPlusModelsProvidersProviderDefinitionValidationResult * self = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_;
	g_return_val_if_fail (provider_id != NULL, NULL);
	self = (ProtonPlusModelsProvidersProviderDefinitionValidationResult*) g_object_new (object_type, NULL);
	proton_plus_models_providers_provider_definition_validation_result_set_provider_id (self, provider_id);
	_tmp1_ = proton_plus_models_providers_provider_definition_validation_result_copy_messages (messages, (gint) messages_length1, &_tmp0_);
	self->priv->messages = (_vala_array_free (self->priv->messages, self->priv->messages_length1, (GDestroyNotify) g_free), NULL);
	self->priv->messages = _tmp1_;
	self->priv->messages_length1 = _tmp0_;
	self->priv->_messages_size_ = self->priv->messages_length1;
	return self;
}

ProtonPlusModelsProvidersProviderDefinitionValidationResult*
proton_plus_models_providers_provider_definition_validation_result_new (const gchar* provider_id,
                                                                        gchar** messages,
                                                                        gint messages_length1)
{
	return proton_plus_models_providers_provider_definition_validation_result_construct (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION_VALIDATION_RESULT, provider_id, messages, messages_length1);
}

gchar**
proton_plus_models_providers_provider_definition_validation_result_get_messages (ProtonPlusModelsProvidersProviderDefinitionValidationResult* self,
                                                                                 gint* result_length1)
{
	gchar** _tmp0_;
	gint _tmp0__length1;
	gint _tmp1_ = 0;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->messages;
	_tmp0__length1 = self->priv->messages_length1;
	_tmp2_ = proton_plus_models_providers_provider_definition_validation_result_copy_messages (_tmp0_, (gint) _tmp0__length1, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}

static gchar**
proton_plus_models_providers_provider_definition_validation_result_copy_messages (gchar** values,
                                                                                  gint values_length1,
                                                                                  gint* result_length1)
{
	gchar** copied = NULL;
	gchar** _tmp0_;
	gint copied_length1;
	gint _copied_size_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** result;
	_tmp0_ = g_new0 (gchar*, values_length1 + 1);
	copied = _tmp0_;
	copied_length1 = values_length1;
	_copied_size_ = copied_length1;
	{
		gint index = 0;
		index = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gchar** _tmp3_;
				gint _tmp3__length1;
				const gchar* _tmp4_;
				gchar* _tmp5_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = index;
					index = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(index < values_length1)) {
					break;
				}
				_tmp3_ = copied;
				_tmp3__length1 = copied_length1;
				_tmp4_ = values[index];
				_tmp5_ = g_strdup (_tmp4_);
				_g_free0 (_tmp3_[index]);
				_tmp3_[index] = _tmp5_;
			}
		}
	}
	_tmp6_ = copied;
	_tmp6__length1 = copied_length1;
	if (result_length1) {
		*result_length1 = _tmp6__length1;
	}
	result = _tmp6_;
	return result;
}

const gchar*
proton_plus_models_providers_provider_definition_validation_result_get_provider_id (ProtonPlusModelsProvidersProviderDefinitionValidationResult* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_provider_id;
	result = _tmp0_;
	return result;
}

static void
proton_plus_models_providers_provider_definition_validation_result_set_provider_id (ProtonPlusModelsProvidersProviderDefinitionValidationResult* self,
                                                                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_providers_provider_definition_validation_result_get_provider_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_provider_id);
		self->priv->_provider_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_providers_provider_definition_validation_result_properties[PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_PROVIDER_ID_PROPERTY]);
	}
}

static void
proton_plus_models_providers_provider_definition_validation_result_class_init (ProtonPlusModelsProvidersProviderDefinitionValidationResultClass * klass,
                                                                               gpointer klass_data)
{
	proton_plus_models_providers_provider_definition_validation_result_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsProvidersProviderDefinitionValidationResult_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_providers_provider_definition_validation_result_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_models_providers_provider_definition_validation_result_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_providers_provider_definition_validation_result_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_PROVIDER_ID_PROPERTY, proton_plus_models_providers_provider_definition_validation_result_properties[PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_PROVIDER_ID_PROPERTY] = g_param_spec_string ("provider-id", "provider-id", "provider-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_models_providers_provider_definition_validation_result_instance_init (ProtonPlusModelsProvidersProviderDefinitionValidationResult * self,
                                                                                  gpointer klass)
{
	self->priv = proton_plus_models_providers_provider_definition_validation_result_get_instance_private (self);
}

static void
proton_plus_models_providers_provider_definition_validation_result_finalize (GObject * obj)
{
	ProtonPlusModelsProvidersProviderDefinitionValidationResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION_VALIDATION_RESULT, ProtonPlusModelsProvidersProviderDefinitionValidationResult);
	_g_free0 (self->priv->_provider_id);
	self->priv->messages = (_vala_array_free (self->priv->messages, self->priv->messages_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (proton_plus_models_providers_provider_definition_validation_result_parent_class)->finalize (obj);
}

static GType
proton_plus_models_providers_provider_definition_validation_result_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsProvidersProviderDefinitionValidationResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_providers_provider_definition_validation_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsProvidersProviderDefinitionValidationResult), 0, (GInstanceInitFunc) proton_plus_models_providers_provider_definition_validation_result_instance_init, NULL };
	GType proton_plus_models_providers_provider_definition_validation_result_type_id;
	proton_plus_models_providers_provider_definition_validation_result_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsProvidersProviderDefinitionValidationResult", &g_define_type_info, 0);
	ProtonPlusModelsProvidersProviderDefinitionValidationResult_private_offset = g_type_add_instance_private (proton_plus_models_providers_provider_definition_validation_result_type_id, sizeof (ProtonPlusModelsProvidersProviderDefinitionValidationResultPrivate));
	return proton_plus_models_providers_provider_definition_validation_result_type_id;
}

GType
proton_plus_models_providers_provider_definition_validation_result_get_type (void)
{
	static volatile gsize proton_plus_models_providers_provider_definition_validation_result_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_providers_provider_definition_validation_result_type_id__once)) {
		GType proton_plus_models_providers_provider_definition_validation_result_type_id;
		proton_plus_models_providers_provider_definition_validation_result_type_id = proton_plus_models_providers_provider_definition_validation_result_get_type_once ();
		g_once_init_leave (&proton_plus_models_providers_provider_definition_validation_result_type_id__once, proton_plus_models_providers_provider_definition_validation_result_type_id);
	}
	return proton_plus_models_providers_provider_definition_validation_result_type_id__once;
}

static void
_vala_proton_plus_models_providers_provider_definition_validation_result_get_property (GObject * object,
                                                                                       guint property_id,
                                                                                       GValue * value,
                                                                                       GParamSpec * pspec)
{
	ProtonPlusModelsProvidersProviderDefinitionValidationResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION_VALIDATION_RESULT, ProtonPlusModelsProvidersProviderDefinitionValidationResult);
	switch (property_id) {
		case PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_PROVIDER_ID_PROPERTY:
		g_value_set_string (value, proton_plus_models_providers_provider_definition_validation_result_get_provider_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_models_providers_provider_definition_validation_result_set_property (GObject * object,
                                                                                       guint property_id,
                                                                                       const GValue * value,
                                                                                       GParamSpec * pspec)
{
	ProtonPlusModelsProvidersProviderDefinitionValidationResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION_VALIDATION_RESULT, ProtonPlusModelsProvidersProviderDefinitionValidationResult);
	switch (property_id) {
		case PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_DEFINITION_VALIDATION_RESULT_PROVIDER_ID_PROPERTY:
		proton_plus_models_providers_provider_definition_validation_result_set_provider_id (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
proton_plus_models_providers_provider_registry_get_instance_private (ProtonPlusModelsProvidersProviderRegistry* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsProvidersProviderRegistry_private_offset);
}

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

static ProtonPlusModelsProvidersProviderDefinition**
_vala_array_dup51 (ProtonPlusModelsProvidersProviderDefinition** self,
                   gssize length)
{
	if (length >= 0) {
		ProtonPlusModelsProvidersProviderDefinition** result;
		gssize i;
		result = g_new0 (ProtonPlusModelsProvidersProviderDefinition*, length + 1);
		for (i = 0; i < length; i++) {
			ProtonPlusModelsProvidersProviderDefinition* _tmp0_;
			_tmp0_ = _g_object_ref0 (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

ProtonPlusModelsProvidersProviderRegistry*
proton_plus_models_providers_provider_registry_construct (GType object_type,
                                                          ProtonPlusModelsProvidersProviderDefinition** definitions,
                                                          gint definitions_length1)
{
	ProtonPlusModelsProvidersProviderRegistry * self = NULL;
	ProtonPlusModelsProvidersProviderDefinition** _tmp0_ = NULL;
	ProtonPlusModelsProvidersProviderDefinition** _tmp1_;
	gint _tmp1__length1;
	gint _tmp0__length1;
	gint __tmp0__size_;
	ProtonPlusModelsProvidersProviderDefinition** configured_definitions = NULL;
	ProtonPlusModelsProvidersProviderDefinition** _tmp4_;
	gint _tmp4__length1;
	gint configured_definitions_length1;
	gint _configured_definitions_size_;
	ProtonPlusModelsProvidersProviderDefinition** _tmp5_;
	gint _tmp5__length1;
	self = (ProtonPlusModelsProvidersProviderRegistry*) g_object_new (object_type, NULL);
	proton_plus_models_providers_provider_registry_initialize_categories (self);
	_tmp1_ = (definitions != NULL) ? _vala_array_dup51 (definitions, definitions_length1) : definitions;
	_tmp1__length1 = definitions_length1;
	_tmp0_ = _tmp1_;
	_tmp0__length1 = _tmp1__length1;
	__tmp0__size_ = _tmp0__length1;
	if (_tmp0_ == NULL) {
		gint _tmp2_ = 0;
		ProtonPlusModelsProvidersProviderDefinition** _tmp3_;
		_tmp3_ = proton_plus_models_providers_built_in_provider_definitions_create_all (&_tmp2_);
		_tmp0_ = (_vala_array_free (_tmp0_, _tmp0__length1, (GDestroyNotify) g_object_unref), NULL);
		_tmp0_ = _tmp3_;
		_tmp0__length1 = _tmp2_;
		__tmp0__size_ = _tmp0__length1;
	}
	_tmp4_ = _tmp0_;
	_tmp4__length1 = _tmp0__length1;
	_tmp0_ = NULL;
	_tmp0__length1 = 0;
	configured_definitions = _tmp4_;
	configured_definitions_length1 = _tmp4__length1;
	_configured_definitions_size_ = configured_definitions_length1;
	_tmp5_ = configured_definitions;
	_tmp5__length1 = configured_definitions_length1;
	{
		ProtonPlusModelsProvidersProviderDefinition** definition_collection = NULL;
		gint definition_collection_length1 = 0;
		gint _definition_collection_size_ = 0;
		gint definition_it = 0;
		definition_collection = _tmp5_;
		definition_collection_length1 = _tmp5__length1;
		for (definition_it = 0; definition_it < definition_collection_length1; definition_it = definition_it + 1) {
			ProtonPlusModelsProvidersProviderDefinition* _tmp6_;
			ProtonPlusModelsProvidersProviderDefinition* definition = NULL;
			_tmp6_ = _g_object_ref0 (definition_collection[definition_it]);
			definition = _tmp6_;
			{
				ProtonPlusModelsProvidersProviderDefinition* _tmp7_;
				_tmp7_ = definition;
				proton_plus_models_providers_provider_registry_add (self, _tmp7_);
				_g_object_unref0 (definition);
			}
		}
	}
	proton_plus_models_providers_provider_registry_validate (self);
	configured_definitions = (_vala_array_free (configured_definitions, configured_definitions_length1, (GDestroyNotify) g_object_unref), NULL);
	_tmp0_ = (_vala_array_free (_tmp0_, _tmp0__length1, (GDestroyNotify) g_object_unref), NULL);
	return self;
}

ProtonPlusModelsProvidersProviderRegistry*
proton_plus_models_providers_provider_registry_new (ProtonPlusModelsProvidersProviderDefinition** definitions,
                                                    gint definitions_length1)
{
	return proton_plus_models_providers_provider_registry_construct (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_REGISTRY, definitions, definitions_length1);
}

ProtonPlusModelsProvidersProviderDefinition*
proton_plus_models_providers_provider_registry_get_by_id (ProtonPlusModelsProvidersProviderRegistry* self,
                                                          const gchar* provider_id)
{
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	ProtonPlusModelsProvidersProviderDefinition* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (provider_id != NULL, NULL);
	_tmp0_ = self->priv->definitions_by_id;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, provider_id);
	result = (ProtonPlusModelsProvidersProviderDefinition*) _tmp1_;
	return result;
}

ProtonPlusModelsProvidersProviderDefinition**
proton_plus_models_providers_provider_registry_get (ProtonPlusModelsProvidersProviderRegistry* self,
                                                    ProtonPlusModelsProvidersCategory category,
                                                    gint* result_length1)
{
	GeeArrayList* definitions = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp5_;
	gint _tmp6_ = 0;
	ProtonPlusModelsProvidersProviderDefinition** _tmp7_;
	ProtonPlusModelsProvidersProviderDefinition** _tmp8_;
	gint _tmp8__length1;
	ProtonPlusModelsProvidersProviderDefinition** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->definitions_by_category;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, (gpointer) ((gintptr) category));
	definitions = (GeeArrayList*) _tmp1_;
	_tmp2_ = definitions;
	if (_tmp2_ == NULL) {
		ProtonPlusModelsProvidersProviderDefinition** _tmp3_;
		ProtonPlusModelsProvidersProviderDefinition** _tmp4_;
		gint _tmp4__length1;
		_tmp3_ = g_new0 (ProtonPlusModelsProvidersProviderDefinition*, 0 + 1);
		_tmp4_ = _tmp3_;
		_tmp4__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp4__length1;
		}
		result = _tmp4_;
		_g_object_unref0 (definitions);
		return result;
	}
	_tmp5_ = definitions;
	_tmp7_ = proton_plus_models_providers_provider_registry_copy_definitions ((GeeCollection*) _tmp5_, &_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp8__length1 = _tmp6_;
	if (result_length1) {
		*result_length1 = _tmp8__length1;
	}
	result = _tmp8_;
	_g_object_unref0 (definitions);
	return result;
}

ProtonPlusModelsProvidersProviderDefinition**
proton_plus_models_providers_provider_registry_get_all (ProtonPlusModelsProvidersProviderRegistry* self,
                                                        gint* result_length1)
{
	GeeArrayList* copied = NULL;
	GeeArrayList* _tmp0_;
	ProtonPlusModelsProvidersCategory* _tmp1_;
	GeeArrayList* _tmp7_;
	gint _tmp8_ = 0;
	ProtonPlusModelsProvidersProviderDefinition** _tmp9_;
	ProtonPlusModelsProvidersProviderDefinition** _tmp10_;
	gint _tmp10__length1;
	ProtonPlusModelsProvidersProviderDefinition** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	copied = _tmp0_;
	_tmp1_ = g_new0 (ProtonPlusModelsProvidersCategory, 4);
	_tmp1_[0] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_DXVK;
	_tmp1_[1] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_VKD3D;
	_tmp1_[2] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_PROTON;
	_tmp1_[3] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_WINE;
	{
		ProtonPlusModelsProvidersCategory* category_collection = NULL;
		gint category_collection_length1 = 0;
		gint _category_collection_size_ = 0;
		gint category_it = 0;
		category_collection = _tmp1_;
		category_collection_length1 = 4;
		for (category_it = 0; category_it < category_collection_length1; category_it = category_it + 1) {
			ProtonPlusModelsProvidersCategory category = 0;
			category = category_collection[category_it];
			{
				gint _tmp2_ = 0;
				ProtonPlusModelsProvidersProviderDefinition** _tmp3_;
				_tmp3_ = proton_plus_models_providers_provider_registry_get (self, category, &_tmp2_);
				{
					ProtonPlusModelsProvidersProviderDefinition** definition_collection = NULL;
					gint definition_collection_length1 = 0;
					gint _definition_collection_size_ = 0;
					gint definition_it = 0;
					definition_collection = _tmp3_;
					definition_collection_length1 = _tmp2_;
					for (definition_it = 0; definition_it < definition_collection_length1; definition_it = definition_it + 1) {
						ProtonPlusModelsProvidersProviderDefinition* _tmp4_;
						ProtonPlusModelsProvidersProviderDefinition* definition = NULL;
						_tmp4_ = _g_object_ref0 (definition_collection[definition_it]);
						definition = _tmp4_;
						{
							GeeArrayList* _tmp5_;
							ProtonPlusModelsProvidersProviderDefinition* _tmp6_;
							_tmp5_ = copied;
							_tmp6_ = definition;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, _tmp6_);
							_g_object_unref0 (definition);
						}
					}
					definition_collection = (_vala_array_free (definition_collection, definition_collection_length1, (GDestroyNotify) g_object_unref), NULL);
				}
			}
		}
		category_collection = (g_free (category_collection), NULL);
	}
	_tmp7_ = copied;
	_tmp9_ = proton_plus_models_providers_provider_registry_copy_definitions ((GeeCollection*) _tmp7_, &_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp10__length1 = _tmp8_;
	if (result_length1) {
		*result_length1 = _tmp10__length1;
	}
	result = _tmp10_;
	_g_object_unref0 (copied);
	return result;
}

ProtonPlusModelsProvidersProviderDefinitionValidationResult**
proton_plus_models_providers_provider_registry_get_validation_results (ProtonPlusModelsProvidersProviderRegistry* self,
                                                                       gint* result_length1)
{
	GeeArrayList* _tmp0_;
	gint _tmp1_ = 0;
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** _tmp2_;
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** _tmp3_;
	gint _tmp3__length1;
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->validation_results;
	_tmp2_ = proton_plus_models_providers_provider_registry_copy_validation_results ((GeeCollection*) _tmp0_, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	if (result_length1) {
		*result_length1 = _tmp3__length1;
	}
	result = _tmp3_;
	return result;
}

static void
proton_plus_models_providers_provider_registry_initialize_categories (ProtonPlusModelsProvidersProviderRegistry* self)
{
	ProtonPlusModelsProvidersCategory* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (ProtonPlusModelsProvidersCategory, 4);
	_tmp0_[0] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_DXVK;
	_tmp0_[1] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_VKD3D;
	_tmp0_[2] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_PROTON;
	_tmp0_[3] = PROTON_PLUS_MODELS_PROVIDERS_CATEGORY_WINE;
	{
		ProtonPlusModelsProvidersCategory* category_collection = NULL;
		gint category_collection_length1 = 0;
		gint _category_collection_size_ = 0;
		gint category_it = 0;
		category_collection = _tmp0_;
		category_collection_length1 = 4;
		for (category_it = 0; category_it < category_collection_length1; category_it = category_it + 1) {
			ProtonPlusModelsProvidersCategory category = 0;
			category = category_collection[category_it];
			{
				GeeHashMap* _tmp1_;
				GeeArrayList* _tmp2_;
				GeeArrayList* _tmp3_;
				_tmp1_ = self->priv->definitions_by_category;
				_tmp2_ = gee_array_list_new (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
				_tmp3_ = _tmp2_;
				gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, (gpointer) ((gintptr) category), _tmp3_);
				_g_object_unref0 (_tmp3_);
			}
		}
		category_collection = (g_free (category_collection), NULL);
	}
}

static void
proton_plus_models_providers_provider_registry_add (ProtonPlusModelsProvidersProviderRegistry* self,
                                                    ProtonPlusModelsProvidersProviderDefinition* definition)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* category_definitions = NULL;
	GeeHashMap* _tmp1_;
	ProtonPlusModelsProvidersCategory _tmp2_;
	ProtonPlusModelsProvidersCategory _tmp3_;
	gpointer _tmp4_;
	GeeArrayList* _tmp5_;
	GeeHashMap* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (definition != NULL);
	_tmp0_ = self->priv->all_definitions;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, definition);
	_tmp1_ = self->priv->definitions_by_category;
	_tmp2_ = proton_plus_models_providers_provider_definition_get_category (definition);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, (gpointer) ((gintptr) _tmp3_));
	category_definitions = (GeeArrayList*) _tmp4_;
	_tmp5_ = category_definitions;
	if (_tmp5_ != NULL) {
		GeeArrayList* _tmp6_;
		_tmp6_ = category_definitions;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, definition);
	}
	_tmp7_ = self->priv->definitions_by_id;
	_tmp8_ = proton_plus_models_providers_provider_definition_get_provider_id (definition);
	_tmp9_ = _tmp8_;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp7_, _tmp9_)) {
		GeeHashMap* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp10_ = self->priv->definitions_by_id;
		_tmp11_ = proton_plus_models_providers_provider_definition_get_provider_id (definition);
		_tmp12_ = _tmp11_;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp10_, _tmp12_, definition);
	}
	_g_object_unref0 (category_definitions);
}

static void
proton_plus_models_providers_provider_registry_validate (ProtonPlusModelsProvidersProviderRegistry* self)
{
	GeeHashSet* seen_provider_ids = NULL;
	GeeHashSet* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	seen_provider_ids = _tmp0_;
	{
		GeeArrayList* _definition_list = NULL;
		GeeArrayList* _tmp1_;
		gint _definition_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _definition_index = 0;
		_tmp1_ = self->priv->all_definitions;
		_definition_list = _tmp1_;
		_tmp2_ = _definition_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_definition_size = _tmp4_;
		_definition_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ProtonPlusModelsProvidersProviderDefinition* definition = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			GeeArrayList* messages = NULL;
			GeeArrayList* _tmp9_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			GeeHashSet* _tmp14_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp19_;
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp23_;
			const gchar* _tmp24_;
			const gchar* _tmp25_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp27_;
			const gchar* _tmp28_;
			const gchar* _tmp29_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			gchar* _tmp34_;
			gboolean _tmp35_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp37_;
			GeeArrayList* _tmp38_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp39_;
			GeeArrayList* _tmp40_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp41_;
			GeeArrayList* _tmp42_;
			gboolean _tmp43_ = FALSE;
			ProtonPlusModelsProvidersProviderDefinition* _tmp44_;
			ProtonPlusModelsProvidersSourceType _tmp45_;
			ProtonPlusModelsProvidersSourceType _tmp46_;
			gboolean _tmp51_ = FALSE;
			ProtonPlusModelsProvidersProviderDefinition* _tmp52_;
			ProtonPlusModelsProvidersSourceType _tmp53_;
			ProtonPlusModelsProvidersSourceType _tmp54_;
			GeeArrayList* _tmp59_;
			gint _tmp60_;
			gint _tmp61_;
			_definition_index = _definition_index + 1;
			_tmp5_ = _definition_index;
			_tmp6_ = _definition_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _definition_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _definition_index);
			definition = (ProtonPlusModelsProvidersProviderDefinition*) _tmp8_;
			_tmp9_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
			messages = _tmp9_;
			_tmp10_ = definition;
			_tmp11_ = proton_plus_models_providers_provider_definition_get_provider_id (_tmp10_);
			_tmp12_ = _tmp11_;
			if (g_strcmp0 (_tmp12_, "") == 0) {
				GeeArrayList* _tmp13_;
				_tmp13_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, "provider ID is empty");
			}
			_tmp14_ = seen_provider_ids;
			_tmp15_ = definition;
			_tmp16_ = proton_plus_models_providers_provider_definition_get_provider_id (_tmp15_);
			_tmp17_ = _tmp16_;
			if (!gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp17_)) {
				GeeArrayList* _tmp18_;
				_tmp18_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, "provider ID is duplicated");
			}
			_tmp19_ = definition;
			_tmp20_ = proton_plus_models_providers_provider_definition_get_title (_tmp19_);
			_tmp21_ = _tmp20_;
			if (g_strcmp0 (_tmp21_, "") == 0) {
				GeeArrayList* _tmp22_;
				_tmp22_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, "title is empty");
			}
			_tmp23_ = definition;
			_tmp24_ = proton_plus_models_providers_provider_definition_get_endpoint (_tmp23_);
			_tmp25_ = _tmp24_;
			if (g_strcmp0 (_tmp25_, "") == 0) {
				GeeArrayList* _tmp26_;
				_tmp26_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp26_, "endpoint is empty");
			}
			_tmp27_ = definition;
			_tmp28_ = proton_plus_models_providers_provider_definition_get_repository_url (_tmp27_);
			_tmp29_ = _tmp28_;
			if (g_strcmp0 (_tmp29_, "") == 0) {
				GeeArrayList* _tmp30_;
				_tmp30_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp30_, "repository URL is empty");
			}
			_tmp31_ = definition;
			_tmp32_ = proton_plus_models_providers_provider_definition_get_source_id (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = _tmp33_;
			_tmp35_ = g_strcmp0 (_tmp34_, "") == 0;
			_g_free0 (_tmp34_);
			if (_tmp35_) {
				GeeArrayList* _tmp36_;
				_tmp36_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp36_, "source type has no supported source mapping");
			}
			_tmp37_ = definition;
			_tmp38_ = messages;
			proton_plus_models_providers_provider_registry_validate_variants (_tmp37_, _tmp38_);
			_tmp39_ = definition;
			_tmp40_ = messages;
			proton_plus_models_providers_provider_registry_validate_install_layouts (_tmp39_, _tmp40_);
			_tmp41_ = definition;
			_tmp42_ = messages;
			proton_plus_models_providers_provider_registry_validate_legacy_endpoints (_tmp41_, _tmp42_);
			_tmp44_ = definition;
			_tmp45_ = proton_plus_models_providers_provider_definition_get_source_type (_tmp44_);
			_tmp46_ = _tmp45_;
			if (_tmp46_ == PROTON_PLUS_MODELS_PROVIDERS_SOURCE_TYPE_GITHUB_ACTIONS) {
				ProtonPlusModelsProvidersProviderDefinition* _tmp47_;
				const gchar* _tmp48_;
				const gchar* _tmp49_;
				_tmp47_ = definition;
				_tmp48_ = proton_plus_models_providers_provider_definition_get_url_template (_tmp47_);
				_tmp49_ = _tmp48_;
				_tmp43_ = g_strcmp0 (_tmp49_, "") == 0;
			} else {
				_tmp43_ = FALSE;
			}
			if (_tmp43_) {
				GeeArrayList* _tmp50_;
				_tmp50_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp50_, "GitHub Actions source requires a URL template");
			}
			_tmp52_ = definition;
			_tmp53_ = proton_plus_models_providers_provider_definition_get_source_type (_tmp52_);
			_tmp54_ = _tmp53_;
			if (_tmp54_ != PROTON_PLUS_MODELS_PROVIDERS_SOURCE_TYPE_GITHUB_ACTIONS) {
				ProtonPlusModelsProvidersProviderDefinition* _tmp55_;
				const gchar* _tmp56_;
				const gchar* _tmp57_;
				_tmp55_ = definition;
				_tmp56_ = proton_plus_models_providers_provider_definition_get_url_template (_tmp55_);
				_tmp57_ = _tmp56_;
				_tmp51_ = g_strcmp0 (_tmp57_, "") != 0;
			} else {
				_tmp51_ = FALSE;
			}
			if (_tmp51_) {
				GeeArrayList* _tmp58_;
				_tmp58_ = messages;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp58_, "only GitHub Actions sources may have a URL template");
			}
			_tmp59_ = messages;
			_tmp60_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp59_);
			_tmp61_ = _tmp60_;
			if (_tmp61_ > 0) {
				GeeArrayList* _tmp62_;
				ProtonPlusModelsProvidersProviderDefinition* _tmp63_;
				const gchar* _tmp64_;
				const gchar* _tmp65_;
				GeeArrayList* _tmp66_;
				gint _tmp67_ = 0;
				gchar** _tmp68_;
				gchar** _tmp69_;
				gint _tmp69__length1;
				ProtonPlusModelsProvidersProviderDefinitionValidationResult* _tmp70_;
				ProtonPlusModelsProvidersProviderDefinitionValidationResult* _tmp71_;
				_tmp62_ = self->priv->validation_results;
				_tmp63_ = definition;
				_tmp64_ = proton_plus_models_providers_provider_definition_get_provider_id (_tmp63_);
				_tmp65_ = _tmp64_;
				_tmp66_ = messages;
				_tmp68_ = proton_plus_models_providers_provider_registry_copy_messages ((GeeCollection*) _tmp66_, &_tmp67_);
				_tmp69_ = _tmp68_;
				_tmp69__length1 = _tmp67_;
				_tmp70_ = proton_plus_models_providers_provider_definition_validation_result_new (_tmp65_, _tmp69_, _tmp67_);
				_tmp71_ = _tmp70_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp62_, _tmp71_);
				_g_object_unref0 (_tmp71_);
				_tmp69_ = (_vala_array_free (_tmp69_, _tmp69__length1, (GDestroyNotify) g_free), NULL);
			}
			_g_object_unref0 (messages);
			_g_object_unref0 (definition);
		}
	}
	_g_object_unref0 (seen_provider_ids);
}

static void
proton_plus_models_providers_provider_registry_validate_variants (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                                  GeeArrayList* messages)
{
	ProtonPlusModelsProvidersVariantDefinition** variants = NULL;
	gint _tmp0_ = 0;
	ProtonPlusModelsProvidersVariantDefinition** _tmp1_;
	gint variants_length1;
	gint _variants_size_;
	ProtonPlusModelsProvidersVariantDefinition** _tmp2_;
	gint _tmp2__length1;
	GeeHashSet* variant_ids = NULL;
	GeeHashSet* _tmp3_;
	gint default_count = 0;
	ProtonPlusModelsProvidersVariantDefinition** _tmp4_;
	gint _tmp4__length1;
	gboolean _tmp127_ = FALSE;
	gboolean _tmp128_;
	gboolean _tmp129_;
	g_return_if_fail (definition != NULL);
	g_return_if_fail (messages != NULL);
	_tmp1_ = proton_plus_models_providers_provider_definition_get_variants (definition, &_tmp0_);
	variants = _tmp1_;
	variants_length1 = _tmp0_;
	_variants_size_ = variants_length1;
	_tmp2_ = variants;
	_tmp2__length1 = variants_length1;
	if (_tmp2__length1 == 0) {
		gee_abstract_collection_add ((GeeAbstractCollection*) messages, "variants are missing");
		variants = (_vala_array_free (variants, variants_length1, (GDestroyNotify) g_object_unref), NULL);
		return;
	}
	_tmp3_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	variant_ids = _tmp3_;
	default_count = 0;
	_tmp4_ = variants;
	_tmp4__length1 = variants_length1;
	{
		ProtonPlusModelsProvidersVariantDefinition** variant_collection = NULL;
		gint variant_collection_length1 = 0;
		gint _variant_collection_size_ = 0;
		gint variant_it = 0;
		variant_collection = _tmp4_;
		variant_collection_length1 = _tmp4__length1;
		for (variant_it = 0; variant_it < variant_collection_length1; variant_it = variant_it + 1) {
			ProtonPlusModelsProvidersVariantDefinition* _tmp5_;
			ProtonPlusModelsProvidersVariantDefinition* variant = NULL;
			_tmp5_ = _g_object_ref0 (variant_collection[variant_it]);
			variant = _tmp5_;
			{
				ProtonPlusModelsProvidersVariantDefinition* _tmp6_;
				const gchar* _tmp7_;
				const gchar* _tmp8_;
				GeeHashSet* _tmp9_;
				ProtonPlusModelsProvidersVariantDefinition* _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				ProtonPlusModelsProvidersVariantDefinition* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				ProtonPlusModelsProvidersVariantDefinition* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				GeeHashSet* asset_formats = NULL;
				GeeHashSet* _tmp24_;
				GeeHashSet* _tmp25_;
				ProtonPlusModelsProvidersVariantDefinition* _tmp26_;
				const gchar* _tmp27_;
				const gchar* _tmp28_;
				ProtonPlusModelsProvidersVariantDefinition* _tmp29_;
				gchar** _tmp30_;
				gint _tmp30__length1;
				gint _tmp31_ = 0;
				gchar** _tmp32_;
				gint _tmp32__length1;
				ProtonPlusModelsProvidersVariantDefinition* _tmp47_;
				gboolean _tmp48_;
				gboolean _tmp49_;
				ProtonPlusModelsVariantCompatibility* compatibility = NULL;
				ProtonPlusModelsProvidersVariantDefinition* _tmp51_;
				ProtonPlusModelsVariantCompatibility* _tmp52_;
				ProtonPlusModelsVariantCompatibility* _tmp53_;
				ProtonPlusModelsVariantCompatibility* _tmp54_;
				ProtonPlusModelsCpuArchitecture* architectures = NULL;
				ProtonPlusModelsVariantCompatibility* _tmp55_;
				gint _tmp56_ = 0;
				ProtonPlusModelsCpuArchitecture* _tmp57_;
				gint architectures_length1;
				gint _architectures_size_;
				GeeHashSet* seen_architectures = NULL;
				GeeHashSet* _tmp58_;
				ProtonPlusModelsCpuArchitecture* _tmp59_;
				gint _tmp59__length1;
				gboolean has_x86_64 = FALSE;
				GeeHashSet* _tmp71_;
				gboolean has_aarch64 = FALSE;
				GeeHashSet* _tmp72_;
				gboolean _tmp73_ = FALSE;
				ProtonPlusModelsVariantCompatibility* _tmp74_;
				gboolean _tmp75_;
				gboolean _tmp76_;
				gboolean _tmp91_ = FALSE;
				ProtonPlusModelsVariantCompatibility* _tmp92_;
				ProtonPlusModelsX86_64Level _tmp93_;
				ProtonPlusModelsX86_64Level _tmp94_;
				gboolean _tmp100_ = FALSE;
				gboolean _tmp109_ = FALSE;
				ProtonPlusModelsVariantCompatibility* _tmp110_;
				ProtonPlusModelsAarch64Level _tmp111_;
				ProtonPlusModelsAarch64Level _tmp112_;
				gboolean _tmp118_ = FALSE;
				_tmp6_ = variant;
				_tmp7_ = proton_plus_models_providers_variant_definition_get_id (_tmp6_);
				_tmp8_ = _tmp7_;
				if (g_strcmp0 (_tmp8_, "") == 0) {
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, "variant ID is empty");
				}
				_tmp9_ = variant_ids;
				_tmp10_ = variant;
				_tmp11_ = proton_plus_models_providers_variant_definition_get_id (_tmp10_);
				_tmp12_ = _tmp11_;
				if (!gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp12_)) {
					ProtonPlusModelsProvidersVariantDefinition* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					_tmp13_ = variant;
					_tmp14_ = proton_plus_models_providers_variant_definition_get_id (_tmp13_);
					_tmp15_ = _tmp14_;
					_tmp16_ = g_strdup_printf ("variant ID is duplicated: %s", _tmp15_);
					_tmp17_ = _tmp16_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp17_);
					_g_free0 (_tmp17_);
				}
				_tmp18_ = variant;
				_tmp19_ = proton_plus_models_providers_variant_definition_get_name (_tmp18_);
				_tmp20_ = _tmp19_;
				if (g_strcmp0 (_tmp20_, "") == 0) {
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, "variant name is empty");
				}
				_tmp21_ = variant;
				_tmp22_ = proton_plus_models_providers_variant_definition_get_format (_tmp21_);
				_tmp23_ = _tmp22_;
				if (g_strcmp0 (_tmp23_, "") == 0) {
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, "variant format is empty");
				}
				_tmp24_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
				asset_formats = _tmp24_;
				_tmp25_ = asset_formats;
				_tmp26_ = variant;
				_tmp27_ = proton_plus_models_providers_variant_definition_get_format (_tmp26_);
				_tmp28_ = _tmp27_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp25_, _tmp28_);
				_tmp29_ = variant;
				_tmp30_ = proton_plus_models_providers_variant_definition_get_alternate_formats (_tmp29_, &_tmp31_);
				_tmp30__length1 = _tmp31_;
				_tmp32_ = _tmp30_;
				_tmp32__length1 = _tmp30__length1;
				{
					gchar** alternate_format_collection = NULL;
					gint alternate_format_collection_length1 = 0;
					gint _alternate_format_collection_size_ = 0;
					gint alternate_format_it = 0;
					alternate_format_collection = _tmp32_;
					alternate_format_collection_length1 = _tmp32__length1;
					for (alternate_format_it = 0; alternate_format_it < alternate_format_collection_length1; alternate_format_it = alternate_format_it + 1) {
						gchar* _tmp33_;
						gchar* alternate_format = NULL;
						_tmp33_ = g_strdup (alternate_format_collection[alternate_format_it]);
						alternate_format = _tmp33_;
						{
							const gchar* _tmp34_;
							GeeHashSet* _tmp40_;
							const gchar* _tmp41_;
							_tmp34_ = alternate_format;
							if (g_strcmp0 (_tmp34_, "") == 0) {
								ProtonPlusModelsProvidersVariantDefinition* _tmp35_;
								const gchar* _tmp36_;
								const gchar* _tmp37_;
								gchar* _tmp38_;
								gchar* _tmp39_;
								_tmp35_ = variant;
								_tmp36_ = proton_plus_models_providers_variant_definition_get_id (_tmp35_);
								_tmp37_ = _tmp36_;
								_tmp38_ = g_strdup_printf ("variant alternate format is empty: %s", _tmp37_);
								_tmp39_ = _tmp38_;
								gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp39_);
								_g_free0 (_tmp39_);
							}
							_tmp40_ = asset_formats;
							_tmp41_ = alternate_format;
							if (!gee_abstract_collection_add ((GeeAbstractCollection*) _tmp40_, _tmp41_)) {
								ProtonPlusModelsProvidersVariantDefinition* _tmp42_;
								const gchar* _tmp43_;
								const gchar* _tmp44_;
								gchar* _tmp45_;
								gchar* _tmp46_;
								_tmp42_ = variant;
								_tmp43_ = proton_plus_models_providers_variant_definition_get_id (_tmp42_);
								_tmp44_ = _tmp43_;
								_tmp45_ = g_strdup_printf ("variant asset format is duplicated: %s", _tmp44_);
								_tmp46_ = _tmp45_;
								gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp46_);
								_g_free0 (_tmp46_);
							}
							_g_free0 (alternate_format);
						}
					}
					alternate_format_collection = (_vala_array_free (alternate_format_collection, alternate_format_collection_length1, (GDestroyNotify) g_free), NULL);
				}
				_tmp47_ = variant;
				_tmp48_ = proton_plus_models_providers_variant_definition_get_is_default (_tmp47_);
				_tmp49_ = _tmp48_;
				if (_tmp49_) {
					gint _tmp50_;
					_tmp50_ = default_count;
					default_count = _tmp50_ + 1;
				}
				_tmp51_ = variant;
				_tmp52_ = proton_plus_models_providers_variant_definition_get_compatibility (_tmp51_);
				_tmp53_ = _tmp52_;
				_tmp54_ = _g_object_ref0 (_tmp53_);
				compatibility = _tmp54_;
				_tmp55_ = compatibility;
				_tmp57_ = proton_plus_models_variant_compatibility_get_supported_architectures (_tmp55_, &_tmp56_);
				architectures = _tmp57_;
				architectures_length1 = _tmp56_;
				_architectures_size_ = architectures_length1;
				_tmp58_ = gee_hash_set_new (PROTON_PLUS_MODELS_TYPE_CPU_ARCHITECTURE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
				seen_architectures = _tmp58_;
				_tmp59_ = architectures;
				_tmp59__length1 = architectures_length1;
				{
					ProtonPlusModelsCpuArchitecture* architecture_collection = NULL;
					gint architecture_collection_length1 = 0;
					gint _architecture_collection_size_ = 0;
					gint architecture_it = 0;
					architecture_collection = _tmp59_;
					architecture_collection_length1 = _tmp59__length1;
					for (architecture_it = 0; architecture_it < architecture_collection_length1; architecture_it = architecture_it + 1) {
						ProtonPlusModelsCpuArchitecture architecture = 0;
						architecture = architecture_collection[architecture_it];
						{
							GeeHashSet* _tmp65_;
							if (architecture == PROTON_PLUS_MODELS_CPU_ARCHITECTURE_UNKNOWN) {
								ProtonPlusModelsProvidersVariantDefinition* _tmp60_;
								const gchar* _tmp61_;
								const gchar* _tmp62_;
								gchar* _tmp63_;
								gchar* _tmp64_;
								_tmp60_ = variant;
								_tmp61_ = proton_plus_models_providers_variant_definition_get_id (_tmp60_);
								_tmp62_ = _tmp61_;
								_tmp63_ = g_strdup_printf ("variant compatibility contains unknown architecture: %s", _tmp62_);
								_tmp64_ = _tmp63_;
								gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp64_);
								_g_free0 (_tmp64_);
							}
							_tmp65_ = seen_architectures;
							if (!gee_abstract_collection_add ((GeeAbstractCollection*) _tmp65_, (gpointer) ((gintptr) architecture))) {
								ProtonPlusModelsProvidersVariantDefinition* _tmp66_;
								const gchar* _tmp67_;
								const gchar* _tmp68_;
								gchar* _tmp69_;
								gchar* _tmp70_;
								_tmp66_ = variant;
								_tmp67_ = proton_plus_models_providers_variant_definition_get_id (_tmp66_);
								_tmp68_ = _tmp67_;
								_tmp69_ = g_strdup_printf ("variant compatibility architecture is duplicated: %s", _tmp68_);
								_tmp70_ = _tmp69_;
								gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp70_);
								_g_free0 (_tmp70_);
							}
						}
					}
				}
				_tmp71_ = seen_architectures;
				has_x86_64 = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp71_, (gpointer) ((gintptr) PROTON_PLUS_MODELS_CPU_ARCHITECTURE_X86_64));
				_tmp72_ = seen_architectures;
				has_aarch64 = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp72_, (gpointer) ((gintptr) PROTON_PLUS_MODELS_CPU_ARCHITECTURE_AARCH64));
				_tmp74_ = compatibility;
				_tmp75_ = proton_plus_models_variant_compatibility_get_architecture_independent (_tmp74_);
				_tmp76_ = _tmp75_;
				if (_tmp76_) {
					gboolean _tmp77_ = FALSE;
					gboolean _tmp78_ = FALSE;
					ProtonPlusModelsCpuArchitecture* _tmp79_;
					gint _tmp79__length1;
					_tmp79_ = architectures;
					_tmp79__length1 = architectures_length1;
					if (_tmp79__length1 > 0) {
						_tmp78_ = TRUE;
					} else {
						ProtonPlusModelsVariantCompatibility* _tmp80_;
						ProtonPlusModelsX86_64Level _tmp81_;
						ProtonPlusModelsX86_64Level _tmp82_;
						_tmp80_ = compatibility;
						_tmp81_ = proton_plus_models_variant_compatibility_get_minimum_x86_64_level (_tmp80_);
						_tmp82_ = _tmp81_;
						_tmp78_ = _tmp82_ != PROTON_PLUS_MODELS_X86_64LEVEL_UNKNOWN;
					}
					if (_tmp78_) {
						_tmp77_ = TRUE;
					} else {
						ProtonPlusModelsVariantCompatibility* _tmp83_;
						ProtonPlusModelsAarch64Level _tmp84_;
						ProtonPlusModelsAarch64Level _tmp85_;
						_tmp83_ = compatibility;
						_tmp84_ = proton_plus_models_variant_compatibility_get_minimum_aarch64_level (_tmp83_);
						_tmp85_ = _tmp84_;
						_tmp77_ = _tmp85_ != PROTON_PLUS_MODELS_AARCH64_LEVEL_UNKNOWN;
					}
					_tmp73_ = _tmp77_;
				} else {
					_tmp73_ = FALSE;
				}
				if (_tmp73_) {
					ProtonPlusModelsProvidersVariantDefinition* _tmp86_;
					const gchar* _tmp87_;
					const gchar* _tmp88_;
					gchar* _tmp89_;
					gchar* _tmp90_;
					_tmp86_ = variant;
					_tmp87_ = proton_plus_models_providers_variant_definition_get_id (_tmp86_);
					_tmp88_ = _tmp87_;
					_tmp89_ = g_strdup_printf ("architecture-independent variant compatibility must not declare archit" \
"ectures or ISA levels: %s", _tmp88_);
					_tmp90_ = _tmp89_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp90_);
					_g_free0 (_tmp90_);
				}
				_tmp92_ = compatibility;
				_tmp93_ = proton_plus_models_variant_compatibility_get_minimum_x86_64_level (_tmp92_);
				_tmp94_ = _tmp93_;
				if (_tmp94_ != PROTON_PLUS_MODELS_X86_64LEVEL_UNKNOWN) {
					_tmp91_ = !has_x86_64;
				} else {
					_tmp91_ = FALSE;
				}
				if (_tmp91_) {
					ProtonPlusModelsProvidersVariantDefinition* _tmp95_;
					const gchar* _tmp96_;
					const gchar* _tmp97_;
					gchar* _tmp98_;
					gchar* _tmp99_;
					_tmp95_ = variant;
					_tmp96_ = proton_plus_models_providers_variant_definition_get_id (_tmp95_);
					_tmp97_ = _tmp96_;
					_tmp98_ = g_strdup_printf ("x86-64 compatibility level requires x86-64 architecture: %s", _tmp97_);
					_tmp99_ = _tmp98_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp99_);
					_g_free0 (_tmp99_);
				}
				if (has_x86_64) {
					ProtonPlusModelsVariantCompatibility* _tmp101_;
					ProtonPlusModelsX86_64Level _tmp102_;
					ProtonPlusModelsX86_64Level _tmp103_;
					_tmp101_ = compatibility;
					_tmp102_ = proton_plus_models_variant_compatibility_get_minimum_x86_64_level (_tmp101_);
					_tmp103_ = _tmp102_;
					_tmp100_ = _tmp103_ < PROTON_PLUS_MODELS_X86_64LEVEL_BASELINE;
				} else {
					_tmp100_ = FALSE;
				}
				if (_tmp100_) {
					ProtonPlusModelsProvidersVariantDefinition* _tmp104_;
					const gchar* _tmp105_;
					const gchar* _tmp106_;
					gchar* _tmp107_;
					gchar* _tmp108_;
					_tmp104_ = variant;
					_tmp105_ = proton_plus_models_providers_variant_definition_get_id (_tmp104_);
					_tmp106_ = _tmp105_;
					_tmp107_ = g_strdup_printf ("x86-64 compatibility requires at least the baseline level: %s", _tmp106_);
					_tmp108_ = _tmp107_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp108_);
					_g_free0 (_tmp108_);
				}
				_tmp110_ = compatibility;
				_tmp111_ = proton_plus_models_variant_compatibility_get_minimum_aarch64_level (_tmp110_);
				_tmp112_ = _tmp111_;
				if (_tmp112_ != PROTON_PLUS_MODELS_AARCH64_LEVEL_UNKNOWN) {
					_tmp109_ = !has_aarch64;
				} else {
					_tmp109_ = FALSE;
				}
				if (_tmp109_) {
					ProtonPlusModelsProvidersVariantDefinition* _tmp113_;
					const gchar* _tmp114_;
					const gchar* _tmp115_;
					gchar* _tmp116_;
					gchar* _tmp117_;
					_tmp113_ = variant;
					_tmp114_ = proton_plus_models_providers_variant_definition_get_id (_tmp113_);
					_tmp115_ = _tmp114_;
					_tmp116_ = g_strdup_printf ("AArch64 compatibility level requires AArch64 architecture: %s", _tmp115_);
					_tmp117_ = _tmp116_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp117_);
					_g_free0 (_tmp117_);
				}
				if (has_aarch64) {
					ProtonPlusModelsVariantCompatibility* _tmp119_;
					ProtonPlusModelsAarch64Level _tmp120_;
					ProtonPlusModelsAarch64Level _tmp121_;
					_tmp119_ = compatibility;
					_tmp120_ = proton_plus_models_variant_compatibility_get_minimum_aarch64_level (_tmp119_);
					_tmp121_ = _tmp120_;
					_tmp118_ = _tmp121_ < PROTON_PLUS_MODELS_AARCH64_LEVEL_V8_0;
				} else {
					_tmp118_ = FALSE;
				}
				if (_tmp118_) {
					ProtonPlusModelsProvidersVariantDefinition* _tmp122_;
					const gchar* _tmp123_;
					const gchar* _tmp124_;
					gchar* _tmp125_;
					gchar* _tmp126_;
					_tmp122_ = variant;
					_tmp123_ = proton_plus_models_providers_variant_definition_get_id (_tmp122_);
					_tmp124_ = _tmp123_;
					_tmp125_ = g_strdup_printf ("AArch64 compatibility requires at least the Armv8.0 level: %s", _tmp124_);
					_tmp126_ = _tmp125_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp126_);
					_g_free0 (_tmp126_);
				}
				_g_object_unref0 (seen_architectures);
				architectures = (g_free (architectures), NULL);
				_g_object_unref0 (compatibility);
				_g_object_unref0 (asset_formats);
				_g_object_unref0 (variant);
			}
		}
	}
	if (default_count == 0) {
		gee_abstract_collection_add ((GeeAbstractCollection*) messages, "default variant is missing");
	} else {
		if (default_count > 1) {
			gee_abstract_collection_add ((GeeAbstractCollection*) messages, "more than one default variant is configured");
		}
	}
	_tmp128_ = proton_plus_models_providers_provider_definition_get_single_archive_releases (definition);
	_tmp129_ = _tmp128_;
	if (_tmp129_) {
		ProtonPlusModelsProvidersVariantDefinition** _tmp130_;
		gint _tmp130__length1;
		_tmp130_ = variants;
		_tmp130__length1 = variants_length1;
		_tmp127_ = _tmp130__length1 != 1;
	} else {
		_tmp127_ = FALSE;
	}
	if (_tmp127_) {
		gee_abstract_collection_add ((GeeAbstractCollection*) messages, "single-archive releases require exactly one variant");
	}
	_g_object_unref0 (variant_ids);
	variants = (_vala_array_free (variants, variants_length1, (GDestroyNotify) g_object_unref), NULL);
}

static void
proton_plus_models_providers_provider_registry_validate_install_layouts (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                                         GeeArrayList* messages)
{
	ProtonPlusModelsProvidersInstallLayout** layouts = NULL;
	gint _tmp0_ = 0;
	ProtonPlusModelsProvidersInstallLayout** _tmp1_;
	gint layouts_length1;
	gint _layouts_size_;
	ProtonPlusModelsProvidersInstallLayout** _tmp2_;
	gint _tmp2__length1;
	GeeHashSet* launcher_family_ids = NULL;
	GeeHashSet* _tmp3_;
	gboolean has_default_layout = FALSE;
	ProtonPlusModelsProvidersInstallLayout** _tmp4_;
	gint _tmp4__length1;
	g_return_if_fail (definition != NULL);
	g_return_if_fail (messages != NULL);
	_tmp1_ = proton_plus_models_providers_provider_definition_get_install_layouts (definition, &_tmp0_);
	layouts = _tmp1_;
	layouts_length1 = _tmp0_;
	_layouts_size_ = layouts_length1;
	_tmp2_ = layouts;
	_tmp2__length1 = layouts_length1;
	if (_tmp2__length1 == 0) {
		gee_abstract_collection_add ((GeeAbstractCollection*) messages, "install layouts are missing");
		layouts = (_vala_array_free (layouts, layouts_length1, (GDestroyNotify) g_object_unref), NULL);
		return;
	}
	_tmp3_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	launcher_family_ids = _tmp3_;
	has_default_layout = FALSE;
	_tmp4_ = layouts;
	_tmp4__length1 = layouts_length1;
	{
		ProtonPlusModelsProvidersInstallLayout** layout_collection = NULL;
		gint layout_collection_length1 = 0;
		gint _layout_collection_size_ = 0;
		gint layout_it = 0;
		layout_collection = _tmp4_;
		layout_collection_length1 = _tmp4__length1;
		for (layout_it = 0; layout_it < layout_collection_length1; layout_it = layout_it + 1) {
			ProtonPlusModelsProvidersInstallLayout* _tmp5_;
			ProtonPlusModelsProvidersInstallLayout* layout = NULL;
			_tmp5_ = _g_object_ref0 (layout_collection[layout_it]);
			layout = _tmp5_;
			{
				ProtonPlusModelsProvidersInstallLayout* _tmp6_;
				const gchar* _tmp7_;
				const gchar* _tmp8_;
				GeeHashSet* _tmp9_;
				ProtonPlusModelsProvidersInstallLayout* _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				ProtonPlusModelsProvidersInstallLayout* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				_tmp6_ = layout;
				_tmp7_ = proton_plus_models_providers_install_layout_get_launcher_family_id (_tmp6_);
				_tmp8_ = _tmp7_;
				if (g_strcmp0 (_tmp8_, "") == 0) {
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, "launcher family ID is empty");
				}
				_tmp9_ = launcher_family_ids;
				_tmp10_ = layout;
				_tmp11_ = proton_plus_models_providers_install_layout_get_launcher_family_id (_tmp10_);
				_tmp12_ = _tmp11_;
				if (!gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp12_)) {
					ProtonPlusModelsProvidersInstallLayout* _tmp13_;
					const gchar* _tmp14_;
					const gchar* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					_tmp13_ = layout;
					_tmp14_ = proton_plus_models_providers_install_layout_get_launcher_family_id (_tmp13_);
					_tmp15_ = _tmp14_;
					_tmp16_ = g_strdup_printf ("install layout is duplicated for launcher family: %s", _tmp15_);
					_tmp17_ = _tmp16_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp17_);
					_g_free0 (_tmp17_);
				}
				_tmp18_ = layout;
				_tmp19_ = proton_plus_models_providers_install_layout_get_launcher_family_id (_tmp18_);
				_tmp20_ = _tmp19_;
				if (g_strcmp0 (_tmp20_, "default") == 0) {
					has_default_layout = TRUE;
				}
				_g_object_unref0 (layout);
			}
		}
	}
	if (!has_default_layout) {
		gee_abstract_collection_add ((GeeAbstractCollection*) messages, "default install layout is missing");
	}
	_g_object_unref0 (launcher_family_ids);
	layouts = (_vala_array_free (layouts, layouts_length1, (GDestroyNotify) g_object_unref), NULL);
}

static void
proton_plus_models_providers_provider_registry_validate_legacy_endpoints (ProtonPlusModelsProvidersProviderDefinition* definition,
                                                                          GeeArrayList* messages)
{
	GeeHashSet* seen_endpoints = NULL;
	GeeHashSet* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_ = 0;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (definition != NULL);
	g_return_if_fail (messages != NULL);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	seen_endpoints = _tmp0_;
	_tmp1_ = proton_plus_models_providers_provider_definition_get_legacy_endpoints (definition, &_tmp2_);
	_tmp1__length1 = _tmp2_;
	_tmp3_ = _tmp1_;
	_tmp3__length1 = _tmp1__length1;
	{
		gchar** legacy_endpoint_collection = NULL;
		gint legacy_endpoint_collection_length1 = 0;
		gint _legacy_endpoint_collection_size_ = 0;
		gint legacy_endpoint_it = 0;
		legacy_endpoint_collection = _tmp3_;
		legacy_endpoint_collection_length1 = _tmp3__length1;
		for (legacy_endpoint_it = 0; legacy_endpoint_it < legacy_endpoint_collection_length1; legacy_endpoint_it = legacy_endpoint_it + 1) {
			gchar* _tmp4_;
			gchar* legacy_endpoint = NULL;
			_tmp4_ = g_strdup (legacy_endpoint_collection[legacy_endpoint_it]);
			legacy_endpoint = _tmp4_;
			{
				const gchar* _tmp5_;
				const gchar* _tmp6_;
				const gchar* _tmp7_;
				const gchar* _tmp8_;
				GeeHashSet* _tmp9_;
				const gchar* _tmp10_;
				_tmp5_ = legacy_endpoint;
				if (g_strcmp0 (_tmp5_, "") == 0) {
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, "legacy endpoint is empty");
				}
				_tmp6_ = legacy_endpoint;
				_tmp7_ = proton_plus_models_providers_provider_definition_get_endpoint (definition);
				_tmp8_ = _tmp7_;
				if (g_strcmp0 (_tmp6_, _tmp8_) == 0) {
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, "legacy endpoint duplicates the current endpoint");
				}
				_tmp9_ = seen_endpoints;
				_tmp10_ = legacy_endpoint;
				if (!gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp10_)) {
					const gchar* _tmp11_;
					gchar* _tmp12_;
					gchar* _tmp13_;
					_tmp11_ = legacy_endpoint;
					_tmp12_ = g_strdup_printf ("legacy endpoint is duplicated: %s", _tmp11_);
					_tmp13_ = _tmp12_;
					gee_abstract_collection_add ((GeeAbstractCollection*) messages, _tmp13_);
					_g_free0 (_tmp13_);
				}
				_g_free0 (legacy_endpoint);
			}
		}
		legacy_endpoint_collection = (_vala_array_free (legacy_endpoint_collection, legacy_endpoint_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_g_object_unref0 (seen_endpoints);
}

static ProtonPlusModelsProvidersProviderDefinition**
proton_plus_models_providers_provider_registry_copy_definitions (GeeCollection* values,
                                                                 gint* result_length1)
{
	ProtonPlusModelsProvidersProviderDefinition** copied = NULL;
	gint _tmp0_;
	gint _tmp1_;
	ProtonPlusModelsProvidersProviderDefinition** _tmp2_;
	gint copied_length1;
	gint _copied_size_;
	gint index = 0;
	ProtonPlusModelsProvidersProviderDefinition** _tmp11_;
	gint _tmp11__length1;
	ProtonPlusModelsProvidersProviderDefinition** result;
	g_return_val_if_fail (values != NULL, NULL);
	_tmp0_ = gee_collection_get_size (values);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_new0 (ProtonPlusModelsProvidersProviderDefinition*, _tmp1_ + 1);
	copied = _tmp2_;
	copied_length1 = _tmp1_;
	_copied_size_ = copied_length1;
	index = 0;
	{
		GeeIterator* _value_it = NULL;
		GeeIterator* _tmp3_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) values);
		_value_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			ProtonPlusModelsProvidersProviderDefinition* value = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			ProtonPlusModelsProvidersProviderDefinition** _tmp7_;
			gint _tmp7__length1;
			gint _tmp8_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp9_;
			ProtonPlusModelsProvidersProviderDefinition* _tmp10_;
			_tmp4_ = _value_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _value_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			value = (ProtonPlusModelsProvidersProviderDefinition*) _tmp6_;
			_tmp7_ = copied;
			_tmp7__length1 = copied_length1;
			_tmp8_ = index;
			index = _tmp8_ + 1;
			_tmp9_ = value;
			_tmp10_ = _g_object_ref0 (_tmp9_);
			_g_object_unref0 (_tmp7_[_tmp8_]);
			_tmp7_[_tmp8_] = _tmp10_;
			_g_object_unref0 (value);
		}
		_g_object_unref0 (_value_it);
	}
	_tmp11_ = copied;
	_tmp11__length1 = copied_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	return result;
}

static ProtonPlusModelsProvidersProviderDefinitionValidationResult**
proton_plus_models_providers_provider_registry_copy_validation_results (GeeCollection* values,
                                                                        gint* result_length1)
{
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** copied = NULL;
	gint _tmp0_;
	gint _tmp1_;
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** _tmp2_;
	gint copied_length1;
	gint _copied_size_;
	gint index = 0;
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** _tmp11_;
	gint _tmp11__length1;
	ProtonPlusModelsProvidersProviderDefinitionValidationResult** result;
	g_return_val_if_fail (values != NULL, NULL);
	_tmp0_ = gee_collection_get_size (values);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_new0 (ProtonPlusModelsProvidersProviderDefinitionValidationResult*, _tmp1_ + 1);
	copied = _tmp2_;
	copied_length1 = _tmp1_;
	_copied_size_ = copied_length1;
	index = 0;
	{
		GeeIterator* _value_it = NULL;
		GeeIterator* _tmp3_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) values);
		_value_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			ProtonPlusModelsProvidersProviderDefinitionValidationResult* value = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			ProtonPlusModelsProvidersProviderDefinitionValidationResult** _tmp7_;
			gint _tmp7__length1;
			gint _tmp8_;
			ProtonPlusModelsProvidersProviderDefinitionValidationResult* _tmp9_;
			ProtonPlusModelsProvidersProviderDefinitionValidationResult* _tmp10_;
			_tmp4_ = _value_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _value_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			value = (ProtonPlusModelsProvidersProviderDefinitionValidationResult*) _tmp6_;
			_tmp7_ = copied;
			_tmp7__length1 = copied_length1;
			_tmp8_ = index;
			index = _tmp8_ + 1;
			_tmp9_ = value;
			_tmp10_ = _g_object_ref0 (_tmp9_);
			_g_object_unref0 (_tmp7_[_tmp8_]);
			_tmp7_[_tmp8_] = _tmp10_;
			_g_object_unref0 (value);
		}
		_g_object_unref0 (_value_it);
	}
	_tmp11_ = copied;
	_tmp11__length1 = copied_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	return result;
}

static gchar**
proton_plus_models_providers_provider_registry_copy_messages (GeeCollection* values,
                                                              gint* result_length1)
{
	gchar** copied = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gchar** _tmp2_;
	gint copied_length1;
	gint _copied_size_;
	gint index = 0;
	gchar** _tmp11_;
	gint _tmp11__length1;
	gchar** result;
	g_return_val_if_fail (values != NULL, NULL);
	_tmp0_ = gee_collection_get_size (values);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_new0 (gchar*, _tmp1_ + 1);
	copied = _tmp2_;
	copied_length1 = _tmp1_;
	_copied_size_ = copied_length1;
	index = 0;
	{
		GeeIterator* _value_it = NULL;
		GeeIterator* _tmp3_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) values);
		_value_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			gchar* value = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			gchar** _tmp7_;
			gint _tmp7__length1;
			gint _tmp8_;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp4_ = _value_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _value_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			value = (gchar*) _tmp6_;
			_tmp7_ = copied;
			_tmp7__length1 = copied_length1;
			_tmp8_ = index;
			index = _tmp8_ + 1;
			_tmp9_ = value;
			_tmp10_ = g_strdup (_tmp9_);
			_g_free0 (_tmp7_[_tmp8_]);
			_tmp7_[_tmp8_] = _tmp10_;
			_g_free0 (value);
		}
		_g_object_unref0 (_value_it);
	}
	_tmp11_ = copied;
	_tmp11__length1 = copied_length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	return result;
}

gboolean
proton_plus_models_providers_provider_registry_get_is_valid (ProtonPlusModelsProvidersProviderRegistry* self)
{
	gboolean result;
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->validation_results;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ == 0;
	return result;
}

static void
proton_plus_models_providers_provider_registry_class_init (ProtonPlusModelsProvidersProviderRegistryClass * klass,
                                                           gpointer klass_data)
{
	proton_plus_models_providers_provider_registry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsProvidersProviderRegistry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_providers_provider_registry_get_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_providers_provider_registry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_IS_VALID_PROPERTY, proton_plus_models_providers_provider_registry_properties[PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_IS_VALID_PROPERTY] = g_param_spec_boolean ("is-valid", "is-valid", "is-valid", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_models_providers_provider_registry_instance_init (ProtonPlusModelsProvidersProviderRegistry * self,
                                                              gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	self->priv = proton_plus_models_providers_provider_registry_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->definitions_by_id = _tmp0_;
	_tmp1_ = gee_hash_map_new (PROTON_PLUS_MODELS_PROVIDERS_TYPE_CATEGORY, NULL, NULL, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->definitions_by_category = _tmp1_;
	_tmp2_ = gee_array_list_new (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->all_definitions = _tmp2_;
	_tmp3_ = gee_array_list_new (PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_DEFINITION_VALIDATION_RESULT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->validation_results = _tmp3_;
}

static void
proton_plus_models_providers_provider_registry_finalize (GObject * obj)
{
	ProtonPlusModelsProvidersProviderRegistry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_REGISTRY, ProtonPlusModelsProvidersProviderRegistry);
	_g_object_unref0 (self->priv->definitions_by_id);
	_g_object_unref0 (self->priv->definitions_by_category);
	_g_object_unref0 (self->priv->all_definitions);
	_g_object_unref0 (self->priv->validation_results);
	G_OBJECT_CLASS (proton_plus_models_providers_provider_registry_parent_class)->finalize (obj);
}

static GType
proton_plus_models_providers_provider_registry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsProvidersProviderRegistryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_providers_provider_registry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsProvidersProviderRegistry), 0, (GInstanceInitFunc) proton_plus_models_providers_provider_registry_instance_init, NULL };
	GType proton_plus_models_providers_provider_registry_type_id;
	proton_plus_models_providers_provider_registry_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusModelsProvidersProviderRegistry", &g_define_type_info, 0);
	ProtonPlusModelsProvidersProviderRegistry_private_offset = g_type_add_instance_private (proton_plus_models_providers_provider_registry_type_id, sizeof (ProtonPlusModelsProvidersProviderRegistryPrivate));
	return proton_plus_models_providers_provider_registry_type_id;
}

GType
proton_plus_models_providers_provider_registry_get_type (void)
{
	static volatile gsize proton_plus_models_providers_provider_registry_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_providers_provider_registry_type_id__once)) {
		GType proton_plus_models_providers_provider_registry_type_id;
		proton_plus_models_providers_provider_registry_type_id = proton_plus_models_providers_provider_registry_get_type_once ();
		g_once_init_leave (&proton_plus_models_providers_provider_registry_type_id__once, proton_plus_models_providers_provider_registry_type_id);
	}
	return proton_plus_models_providers_provider_registry_type_id__once;
}

static void
_vala_proton_plus_models_providers_provider_registry_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec)
{
	ProtonPlusModelsProvidersProviderRegistry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_PROVIDERS_TYPE_PROVIDER_REGISTRY, ProtonPlusModelsProvidersProviderRegistry);
	switch (property_id) {
		case PROTON_PLUS_MODELS_PROVIDERS_PROVIDER_REGISTRY_IS_VALID_PROPERTY:
		g_value_set_boolean (value, proton_plus_models_providers_provider_registry_get_is_valid (self));
		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 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;
}

