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

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>

typedef enum  {
	TOOTLE_API_NOTIFICATION_TYPE_MENTION,
	TOOTLE_API_NOTIFICATION_TYPE_REBLOG,
	TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER,
	TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE,
	TOOTLE_API_NOTIFICATION_TYPE_FOLLOW,
	TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST,
	TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST
} TootleAPINotificationType;

#define TOOTLE_API_TYPE_NOTIFICATION_TYPE (tootle_api_notification_type_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))

#define TOOTLE_TYPE_ENTITY (tootle_entity_get_type ())
#define TOOTLE_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_TYPE_ENTITY, TootleEntity))
#define TOOTLE_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_TYPE_ENTITY, TootleEntityClass))
#define TOOTLE_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_TYPE_ENTITY))
#define TOOTLE_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_TYPE_ENTITY))
#define TOOTLE_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_TYPE_ENTITY, TootleEntityClass))

typedef struct _TootleEntity TootleEntity;
typedef struct _TootleEntityClass TootleEntityClass;

#define TOOTLE_API_TYPE_ACCOUNT (tootle_api_account_get_type ())
#define TOOTLE_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccount))
#define TOOTLE_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))
#define TOOTLE_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TOOTLE_API_TYPE_ACCOUNT))
#define TOOTLE_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TOOTLE_API_TYPE_ACCOUNT, TootleAPIAccountClass))

typedef struct _TootleAPIAccount TootleAPIAccount;
typedef struct _TootleAPIAccountClass TootleAPIAccountClass;

typedef enum  {
	TOOTLE_OOPSIE_USER,
	TOOTLE_OOPSIE_PARSING,
	TOOTLE_OOPSIE_INSTANCE,
	TOOTLE_OOPSIE_INTERNAL
} TootleOopsie;
#define TOOTLE_OOPSIE tootle_oopsie_quark ()

GType tootle_api_notification_type_get_type (void) G_GNUC_CONST ;
gchar* tootle_api_notification_type_to_string (TootleAPINotificationType self);
GQuark tootle_oopsie_quark (void);
TootleAPINotificationType tootle_api_notification_type_from_string (const gchar* str,
                                                                    GError** error);
GType tootle_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleEntity, g_object_unref)
GType tootle_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TootleAPIAccount, g_object_unref)
gchar* tootle_api_notification_type_get_desc (TootleAPINotificationType self,
                                              TootleAPIAccount* account);
const gchar* tootle_api_account_get_url (TootleAPIAccount* self);
const gchar* tootle_api_account_get_display_name (TootleAPIAccount* self);
gchar* tootle_api_notification_type_get_icon (TootleAPINotificationType self);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

gchar*
tootle_api_notification_type_to_string (TootleAPINotificationType self)
{
	gchar* result = NULL;
	switch (self) {
		case TOOTLE_API_NOTIFICATION_TYPE_MENTION:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("mention");
			result = _tmp0_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_REBLOG:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("reblog");
			result = _tmp1_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("reblog_remote");
			result = _tmp2_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("favourite");
			result = _tmp3_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FOLLOW:
		{
			gchar* _tmp4_;
			_tmp4_ = g_strdup ("follow");
			result = _tmp4_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST:
		{
			gchar* _tmp5_;
			_tmp5_ = g_strdup ("follow_request");
			result = _tmp5_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST:
		{
			gchar* _tmp6_;
			_tmp6_ = g_strdup ("watchlist");
			result = _tmp6_;
			return result;
		}
		default:
		{
			gchar* _tmp7_;
			gchar* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp7_ = tootle_api_notification_type_to_string (self);
			_tmp8_ = _tmp7_;
			_tmp9_ = g_strconcat ("Unknown notification type: ", _tmp8_, NULL);
			_tmp10_ = _tmp9_;
			g_warning ("NotificationType.vala:27: %s", _tmp10_);
			_g_free0 (_tmp10_);
			_g_free0 (_tmp8_);
			_tmp11_ = g_strdup ("");
			result = _tmp11_;
			return result;
		}
	}
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

TootleAPINotificationType
tootle_api_notification_type_from_string (const gchar* str,
                                          GError** error)
{
	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;
	static GQuark _tmp1_label4 = 0;
	static GQuark _tmp1_label5 = 0;
	static GQuark _tmp1_label6 = 0;
	GError* _inner_error0_ = NULL;
	TootleAPINotificationType result = 0;
	g_return_val_if_fail (str != NULL, 0);
	_tmp0_ = str;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("mention")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_MENTION;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("reblog")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_REBLOG;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("reblog_remote")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("favourite")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label4) ? _tmp1_label4 : (_tmp1_label4 = g_quark_from_static_string ("follow")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_FOLLOW;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label5) ? _tmp1_label5 : (_tmp1_label5 = g_quark_from_static_string ("follow_request")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label6) ? _tmp1_label6 : (_tmp1_label6 = g_quark_from_static_string ("watchlist")))) {
		switch (0) {
			default:
			{
				result = TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				const gchar* _tmp3_;
				gchar* _tmp4_;
				gchar* _tmp5_;
				GError* _tmp6_;
				GError* _tmp7_;
				_tmp3_ = string_to_string (str);
				_tmp4_ = g_strconcat ("Unknown notification type: ", _tmp3_, NULL);
				_tmp5_ = _tmp4_;
				_tmp6_ = g_error_new_literal (TOOTLE_OOPSIE, TOOTLE_OOPSIE_INSTANCE, _tmp5_);
				_tmp7_ = _tmp6_;
				_g_free0 (_tmp5_);
				_inner_error0_ = _tmp7_;
				if (_inner_error0_->domain == TOOTLE_OOPSIE) {
					g_propagate_error (error, _inner_error0_);
					return 0;
				} else {
					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 0;
				}
			}
		}
	}
}

gchar*
tootle_api_notification_type_get_desc (TootleAPINotificationType self,
                                       TootleAPIAccount* account)
{
	gchar* result = NULL;
	switch (self) {
		case TOOTLE_API_NOTIFICATION_TYPE_MENTION:
		{
			const gchar* _tmp0_;
			const gchar* _tmp1_;
			const gchar* _tmp2_;
			const gchar* _tmp3_;
			gchar* _tmp4_;
			_tmp0_ = tootle_api_account_get_url (account);
			_tmp1_ = _tmp0_;
			_tmp2_ = tootle_api_account_get_display_name (account);
			_tmp3_ = _tmp2_;
			_tmp4_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> mentioned you</span>"), _tmp1_, _tmp3_);
			result = _tmp4_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_REBLOG:
		{
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			const gchar* _tmp7_;
			const gchar* _tmp8_;
			gchar* _tmp9_;
			_tmp5_ = tootle_api_account_get_url (account);
			_tmp6_ = _tmp5_;
			_tmp7_ = tootle_api_account_get_display_name (account);
			_tmp8_ = _tmp7_;
			_tmp9_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> boosted your status</sp" \
"an>"), _tmp6_, _tmp8_);
			result = _tmp9_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER:
		{
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp10_ = tootle_api_account_get_url (account);
			_tmp11_ = _tmp10_;
			_tmp12_ = tootle_api_account_get_display_name (account);
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> boosted</span>"), _tmp11_, _tmp13_);
			result = _tmp14_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE:
		{
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			gchar* _tmp19_;
			_tmp15_ = tootle_api_account_get_url (account);
			_tmp16_ = _tmp15_;
			_tmp17_ = tootle_api_account_get_display_name (account);
			_tmp18_ = _tmp17_;
			_tmp19_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> favorited your status</" \
"span>"), _tmp16_, _tmp18_);
			result = _tmp19_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FOLLOW:
		{
			const gchar* _tmp20_;
			const gchar* _tmp21_;
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			_tmp20_ = tootle_api_account_get_url (account);
			_tmp21_ = _tmp20_;
			_tmp22_ = tootle_api_account_get_display_name (account);
			_tmp23_ = _tmp22_;
			_tmp24_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> now follows you</span>"), _tmp21_, _tmp23_);
			result = _tmp24_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST:
		{
			const gchar* _tmp25_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			const gchar* _tmp28_;
			gchar* _tmp29_;
			_tmp25_ = tootle_api_account_get_url (account);
			_tmp26_ = _tmp25_;
			_tmp27_ = tootle_api_account_get_display_name (account);
			_tmp28_ = _tmp27_;
			_tmp29_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> wants to follow you</sp" \
"an>"), _tmp26_, _tmp28_);
			result = _tmp29_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST:
		{
			const gchar* _tmp30_;
			const gchar* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			gchar* _tmp34_;
			_tmp30_ = tootle_api_account_get_url (account);
			_tmp31_ = _tmp30_;
			_tmp32_ = tootle_api_account_get_display_name (account);
			_tmp33_ = _tmp32_;
			_tmp34_ = g_strdup_printf (_ ("<span underline=\"none\"><a href=\"%s\">%s</a> posted a status</span>"), _tmp31_, _tmp33_);
			result = _tmp34_;
			return result;
		}
		default:
		{
			gchar* _tmp35_;
			gchar* _tmp36_;
			gchar* _tmp37_;
			gchar* _tmp38_;
			gchar* _tmp39_;
			_tmp35_ = tootle_api_notification_type_to_string (self);
			_tmp36_ = _tmp35_;
			_tmp37_ = g_strconcat ("Unknown notification type: ", _tmp36_, NULL);
			_tmp38_ = _tmp37_;
			g_warning ("NotificationType.vala:70: %s", _tmp38_);
			_g_free0 (_tmp38_);
			_g_free0 (_tmp36_);
			_tmp39_ = g_strdup ("");
			result = _tmp39_;
			return result;
		}
	}
}

gchar*
tootle_api_notification_type_get_icon (TootleAPINotificationType self)
{
	gchar* result = NULL;
	switch (self) {
		case TOOTLE_API_NOTIFICATION_TYPE_MENTION:
		case TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("user-available-symbolic");
			result = _tmp0_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_REBLOG:
		case TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("media-playlist-repeat-symbolic");
			result = _tmp1_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("starred-symbolic");
			result = _tmp2_;
			return result;
		}
		case TOOTLE_API_NOTIFICATION_TYPE_FOLLOW:
		case TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("contact-new-symbolic");
			result = _tmp3_;
			return result;
		}
		default:
		{
			gchar* _tmp4_;
			gchar* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp4_ = tootle_api_notification_type_to_string (self);
			_tmp5_ = _tmp4_;
			_tmp6_ = g_strconcat ("Unknown notification type: ", _tmp5_, NULL);
			_tmp7_ = _tmp6_;
			g_warning ("NotificationType.vala:89: %s", _tmp7_);
			_g_free0 (_tmp7_);
			_g_free0 (_tmp5_);
			_tmp8_ = g_strdup ("");
			result = _tmp8_;
			return result;
		}
	}
}

static GType
tootle_api_notification_type_get_type_once (void)
{
	static const GEnumValue values[] = {{TOOTLE_API_NOTIFICATION_TYPE_MENTION, "TOOTLE_API_NOTIFICATION_TYPE_MENTION", "mention"}, {TOOTLE_API_NOTIFICATION_TYPE_REBLOG, "TOOTLE_API_NOTIFICATION_TYPE_REBLOG", "reblog"}, {TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER, "TOOTLE_API_NOTIFICATION_TYPE_REBLOG_REMOTE_USER", "reblog-remote-user"}, {TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE, "TOOTLE_API_NOTIFICATION_TYPE_FAVOURITE", "favourite"}, {TOOTLE_API_NOTIFICATION_TYPE_FOLLOW, "TOOTLE_API_NOTIFICATION_TYPE_FOLLOW", "follow"}, {TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST, "TOOTLE_API_NOTIFICATION_TYPE_FOLLOW_REQUEST", "follow-request"}, {TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST, "TOOTLE_API_NOTIFICATION_TYPE_WATCHLIST", "watchlist"}, {0, NULL, NULL}};
	GType tootle_api_notification_type_type_id;
	tootle_api_notification_type_type_id = g_enum_register_static ("TootleAPINotificationType", values);
	return tootle_api_notification_type_type_id;
}

GType
tootle_api_notification_type_get_type (void)
{
	static volatile gsize tootle_api_notification_type_type_id__volatile = 0;
	if (g_once_init_enter (&tootle_api_notification_type_type_id__volatile)) {
		GType tootle_api_notification_type_type_id;
		tootle_api_notification_type_type_id = tootle_api_notification_type_get_type_once ();
		g_once_init_leave (&tootle_api_notification_type_type_id__volatile, tootle_api_notification_type_type_id);
	}
	return tootle_api_notification_type_type_id__volatile;
}

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

