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

#include <glib-object.h>
#include <gtk/gtk.h>
#include <json-glib/json-glib.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_TYPE_WIDGETIZABLE (tuba_widgetizable_get_type ())
#define TUBA_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizable))
#define TUBA_IS_WIDGETIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_WIDGETIZABLE))
#define TUBA_WIDGETIZABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_TYPE_WIDGETIZABLE, TubaWidgetizableIface))

typedef struct _TubaWidgetizable TubaWidgetizable;
typedef struct _TubaWidgetizableIface TubaWidgetizableIface;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;

#define TUBA_TYPE_INSTANCE_ACCOUNT (tuba_instance_account_get_type ())
#define TUBA_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccount))
#define TUBA_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))
#define TUBA_IS_INSTANCE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_IS_INSTANCE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_INSTANCE_ACCOUNT))
#define TUBA_INSTANCE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_INSTANCE_ACCOUNT, TubaInstanceAccountClass))

typedef struct _TubaInstanceAccount TubaInstanceAccount;
typedef struct _TubaInstanceAccountClass TubaInstanceAccountClass;
typedef struct _TubaEntityPrivate TubaEntityPrivate;

#define TUBA_API_TYPE_SEARCH_RESULT (tuba_api_search_result_get_type ())
#define TUBA_API_SEARCH_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_SEARCH_RESULT, TubaAPISearchResult))
#define TUBA_API_IS_SEARCH_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_SEARCH_RESULT))
#define TUBA_API_SEARCH_RESULT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TUBA_API_TYPE_SEARCH_RESULT, TubaAPISearchResultIface))

typedef struct _TubaAPISearchResult TubaAPISearchResult;
typedef struct _TubaAPISearchResultIface TubaAPISearchResultIface;

#define TUBA_API_TYPE_STATUS (tuba_api_status_get_type ())
#define TUBA_API_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_STATUS, TubaAPIStatus))
#define TUBA_API_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_STATUS, TubaAPIStatusClass))
#define TUBA_API_IS_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_STATUS))
#define TUBA_API_IS_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_STATUS))
#define TUBA_API_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_STATUS, TubaAPIStatusClass))

typedef struct _TubaAPIStatus TubaAPIStatus;
typedef struct _TubaAPIStatusClass TubaAPIStatusClass;
typedef struct _TubaAPIStatusPrivate TubaAPIStatusPrivate;

#define TUBA_API_TYPE_QUOTE (tuba_api_quote_get_type ())
#define TUBA_API_QUOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_QUOTE, TubaAPIQuote))
#define TUBA_API_QUOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_QUOTE, TubaAPIQuoteClass))
#define TUBA_API_IS_QUOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_QUOTE))
#define TUBA_API_IS_QUOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_QUOTE))
#define TUBA_API_QUOTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_QUOTE, TubaAPIQuoteClass))

typedef struct _TubaAPIQuote TubaAPIQuote;
typedef struct _TubaAPIQuoteClass TubaAPIQuoteClass;
typedef struct _TubaAPIQuotePrivate TubaAPIQuotePrivate;
enum  {
	TUBA_API_QUOTE_0_PROPERTY,
	TUBA_API_QUOTE_TUBA_HAS_QUOTE_PROPERTY,
	TUBA_API_QUOTE_STATE_PROPERTY,
	TUBA_API_QUOTE_QUOTED_STATUS_PROPERTY,
	TUBA_API_QUOTE_NUM_PROPERTIES
};
static GParamSpec* tuba_api_quote_properties[TUBA_API_QUOTE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _TubaWidgetizableIface {
	GTypeInterface parent_iface;
	GtkWidget* (*to_widget) (TubaWidgetizable* self);
	void (*open) (TubaWidgetizable* self);
	void (*resolve_open) (TubaWidgetizable* self, TubaInstanceAccount* account);
};

struct _TubaEntity {
	GObject parent_instance;
	TubaEntityPrivate * priv;
};

struct _TubaEntityClass {
	GObjectClass parent_class;
	gboolean (*is_local) (TubaEntity* self, TubaInstanceAccount* account);
	GType (*deserialize_array_type) (TubaEntity* self, const gchar* prop);
};

struct _TubaAPISearchResultIface {
	GTypeInterface parent_iface;
	GRegex* (*get_tuba_search_query_regex) (TubaAPISearchResult* self);
	void (*set_tuba_search_query_regex) (TubaAPISearchResult* self, GRegex* value);
};

struct _TubaAPIStatus {
	TubaEntity parent_instance;
	TubaAPIStatusPrivate * priv;
};

struct _TubaAPIStatusClass {
	TubaEntityClass parent_class;
	gboolean (*get_reply_mentions) (TubaAPIStatus* self, gchar** joined_mentions);
};

struct _TubaAPIQuote {
	TubaAPIStatus parent_instance;
	TubaAPIQuotePrivate * priv;
};

struct _TubaAPIQuoteClass {
	TubaAPIStatusClass parent_class;
};

struct _TubaAPIQuotePrivate {
	gchar* _state;
};

static gint TubaAPIQuote_private_offset;
static gpointer tuba_api_quote_parent_class = NULL;

VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN GType tuba_instance_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaInstanceAccount, g_object_unref)
VALA_EXTERN GType tuba_widgetizable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetizable, g_object_unref)
VALA_EXTERN GType tuba_api_search_result_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPISearchResult, g_object_unref)
VALA_EXTERN GType tuba_api_status_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIStatus, g_object_unref)
VALA_EXTERN GType tuba_api_quote_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIQuote, g_object_unref)
VALA_EXTERN TubaAPIQuote* tuba_api_quote_new (void);
VALA_EXTERN TubaAPIQuote* tuba_api_quote_construct (GType object_type);
VALA_EXTERN TubaAPIStatus* tuba_api_status_new (void);
VALA_EXTERN TubaAPIStatus* tuba_api_status_construct (GType object_type);
VALA_EXTERN gboolean tuba_api_quote_get_tuba_has_quote (TubaAPIQuote* self);
VALA_EXTERN const gchar* tuba_api_quote_get_state (TubaAPIQuote* self);
VALA_EXTERN void tuba_api_quote_set_state (TubaAPIQuote* self,
                               const gchar* value);
VALA_EXTERN void tuba_api_quote_set_quoted_status (TubaAPIQuote* self,
                                       TubaAPIStatus* value);
VALA_EXTERN void tuba_api_status_set_tuba_had_quote (TubaAPIStatus* self,
                                         gboolean value);
VALA_EXTERN TubaAPIQuote* tuba_api_status_get_quote (TubaAPIStatus* self);
VALA_EXTERN void tuba_api_status_set_quote (TubaAPIStatus* self,
                                TubaAPIQuote* value);
VALA_EXTERN void tuba_entity_patch (TubaEntity* self,
                        GObject* with);
static void tuba_api_quote_finalize (GObject * obj);
static GType tuba_api_quote_get_type_once (void);
static void _vala_tuba_api_quote_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_tuba_api_quote_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);

static inline gpointer
tuba_api_quote_get_instance_private (TubaAPIQuote* self)
{
	return G_STRUCT_MEMBER_P (self, TubaAPIQuote_private_offset);
}

TubaAPIQuote*
tuba_api_quote_construct (GType object_type)
{
	TubaAPIQuote * self = NULL;
	self = (TubaAPIQuote*) tuba_api_status_construct (object_type);
	return self;
}

TubaAPIQuote*
tuba_api_quote_new (void)
{
	return tuba_api_quote_construct (TUBA_API_TYPE_QUOTE);
}

gboolean
tuba_api_quote_get_tuba_has_quote (TubaAPIQuote* self)
{
	gboolean result;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp3_ = self->priv->_state;
	if (g_strcmp0 (_tmp3_, "accepted") == 0) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = self->priv->_state;
		_tmp2_ = g_strcmp0 (_tmp4_, "blocked_account") == 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = self->priv->_state;
		_tmp1_ = g_strcmp0 (_tmp5_, "blocked_domain") == 0;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = self->priv->_state;
		_tmp0_ = g_strcmp0 (_tmp6_, "muted_account") == 0;
	}
	result = _tmp0_;
	return result;
}

const gchar*
tuba_api_quote_get_state (TubaAPIQuote* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_state;
	result = _tmp0_;
	return result;
}

void
tuba_api_quote_set_state (TubaAPIQuote* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_api_quote_get_state (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_state);
		self->priv->_state = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_api_quote_properties[TUBA_API_QUOTE_STATE_PROPERTY]);
	}
}

void
tuba_api_quote_set_quoted_status (TubaAPIQuote* self,
                                  TubaAPIStatus* value)
{
	g_return_if_fail (self != NULL);
	tuba_api_status_set_tuba_had_quote ((TubaAPIStatus*) self, FALSE);
	if (value == NULL) {
		const gchar* _tmp0_;
		_tmp0_ = self->priv->_state;
		if (g_strcmp0 (_tmp0_, "accepted") == 0) {
			tuba_api_quote_set_state (self, "pending");
		}
	} else {
		TubaAPIQuote* _tmp1_;
		TubaAPIQuote* _tmp2_;
		_tmp1_ = tuba_api_status_get_quote (value);
		_tmp2_ = _tmp1_;
		if (_tmp2_ != NULL) {
			tuba_api_status_set_tuba_had_quote ((TubaAPIStatus*) self, TRUE);
		}
		tuba_api_status_set_quote (value, NULL);
		tuba_entity_patch ((TubaEntity*) self, (GObject*) value);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_api_quote_properties[TUBA_API_QUOTE_QUOTED_STATUS_PROPERTY]);
}

static void
tuba_api_quote_class_init (TubaAPIQuoteClass * klass,
                           gpointer klass_data)
{
	tuba_api_quote_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaAPIQuote_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_api_quote_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_api_quote_set_property;
	G_OBJECT_CLASS (klass)->finalize = tuba_api_quote_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_QUOTE_TUBA_HAS_QUOTE_PROPERTY, tuba_api_quote_properties[TUBA_API_QUOTE_TUBA_HAS_QUOTE_PROPERTY] = g_param_spec_boolean ("tuba-has-quote", "tuba-has-quote", "tuba-has-quote", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_QUOTE_STATE_PROPERTY, tuba_api_quote_properties[TUBA_API_QUOTE_STATE_PROPERTY] = g_param_spec_string ("state", "state", "state", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_API_QUOTE_QUOTED_STATUS_PROPERTY, tuba_api_quote_properties[TUBA_API_QUOTE_QUOTED_STATUS_PROPERTY] = g_param_spec_object ("quoted-status", "quoted-status", "quoted-status", TUBA_API_TYPE_STATUS, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
tuba_api_quote_instance_init (TubaAPIQuote * self,
                              gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tuba_api_quote_get_instance_private (self);
	_tmp0_ = g_strdup ("accepted");
	self->priv->_state = _tmp0_;
}

static void
tuba_api_quote_finalize (GObject * obj)
{
	TubaAPIQuote * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_API_TYPE_QUOTE, TubaAPIQuote);
	_g_free0 (self->priv->_state);
	G_OBJECT_CLASS (tuba_api_quote_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_api_quote_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaAPIQuoteClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_api_quote_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaAPIQuote), 0, (GInstanceInitFunc) tuba_api_quote_instance_init, NULL };
	GType tuba_api_quote_type_id;
	tuba_api_quote_type_id = g_type_register_static (TUBA_API_TYPE_STATUS, "TubaAPIQuote", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaAPIQuote_private_offset = g_type_add_instance_private (tuba_api_quote_type_id, sizeof (TubaAPIQuotePrivate));
	return tuba_api_quote_type_id;
}

GType
tuba_api_quote_get_type (void)
{
	static GType tuba_api_quote_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_api_quote_type_id__once)) {
		GType tuba_api_quote_type_id;
		tuba_api_quote_type_id = tuba_api_quote_get_type_once ();
		g_once_init_leave_pointer (&tuba_api_quote_type_id__once, tuba_api_quote_type_id);
	}
	return tuba_api_quote_type_id__once;
}

static void
_vala_tuba_api_quote_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	TubaAPIQuote * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_API_TYPE_QUOTE, TubaAPIQuote);
	switch (property_id) {
		case TUBA_API_QUOTE_TUBA_HAS_QUOTE_PROPERTY:
		g_value_set_boolean (value, tuba_api_quote_get_tuba_has_quote (self));
		break;
		case TUBA_API_QUOTE_STATE_PROPERTY:
		g_value_set_string (value, tuba_api_quote_get_state (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_api_quote_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	TubaAPIQuote * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_API_TYPE_QUOTE, TubaAPIQuote);
	switch (property_id) {
		case TUBA_API_QUOTE_STATE_PROPERTY:
		tuba_api_quote_set_state (self, g_value_get_string (value));
		break;
		case TUBA_API_QUOTE_QUOTED_STATUS_PROPERTY:
		tuba_api_quote_set_quoted_status (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

