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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <json-glib/json-glib.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  {
	OBJECTS_DUE_DATE_0_PROPERTY,
	OBJECTS_DUE_DATE_DATE_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCE_STRING_PROPERTY,
	OBJECTS_DUE_DATE_TIME_ZONE_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCY_WEEKS_PROPERTY,
	OBJECTS_DUE_DATE_IS_RECURRING_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCY_TYPE_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCY_INTERVAL_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCY_COUNT_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCY_END_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCY_LAST_DAY_OF_MONTH_PROPERTY,
	OBJECTS_DUE_DATE_RECURRENCE_SUPPORTED_PROPERTY,
	OBJECTS_DUE_DATE_DATETIME_PROPERTY,
	OBJECTS_DUE_DATE_END_DATETIME_PROPERTY,
	OBJECTS_DUE_DATE_HAS_WEEKS_PROPERTY,
	OBJECTS_DUE_DATE_END_TYPE_PROPERTY,
	OBJECTS_DUE_DATE_IS_RECURRENCY_END_PROPERTY,
	OBJECTS_DUE_DATE_NUM_PROPERTIES
};
static GParamSpec* objects_due_date_properties[OBJECTS_DUE_DATE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ObjectsDueDatePrivate {
	gchar* _date;
	gchar* _recurrence_string;
	gchar* _time_zone;
	gchar* _recurrency_weeks;
	gboolean _is_recurring;
	RecurrencyType _recurrency_type;
	gint _recurrency_interval;
	gint _recurrency_count;
	gchar* _recurrency_end;
	gboolean _recurrency_last_day_of_month;
	gboolean _recurrence_supported;
	GDateTime* _datetime;
	GDateTime* _end_datetime;
};

static gint ObjectsDueDate_private_offset;
static gpointer objects_due_date_parent_class = NULL;

static void _vala_JsonNode_free (JsonNode* self);
static GObject * objects_due_date_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties);
static void _objects_due_date___lambda10_ (ObjectsDueDate* self);
static void __objects_due_date___lambda10__g_object_notify (GObject* _sender,
                                                     GParamSpec* pspec,
                                                     gpointer self);
static void objects_due_date_finalize (GObject * obj);
static GType objects_due_date_get_type_once (void);
static void _vala_objects_due_date_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static void _vala_objects_due_date_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
objects_due_date_get_instance_private (ObjectsDueDate* self)
{
	return G_STRUCT_MEMBER_P (self, ObjectsDueDate_private_offset);
}

ObjectsDueDate*
objects_due_date_construct_from_json (GType object_type,
                                      JsonObject* object)
{
	ObjectsDueDate * self = NULL;
	g_return_val_if_fail (object != NULL, NULL);
	self = (ObjectsDueDate*) g_object_new (object_type, NULL);
	objects_due_date_update_from_json (self, object);
	return self;
}

ObjectsDueDate*
objects_due_date_new_from_json (JsonObject* object)
{
	return objects_due_date_construct_from_json (OBJECTS_TYPE_DUE_DATE, object);
}

void
objects_due_date_update_from_todoist_json (ObjectsDueDate* self,
                                           JsonObject* object)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	if (json_object_has_member (object, "date")) {
		const gchar* _tmp0_;
		_tmp0_ = json_object_get_string_member (object, "date");
		objects_due_date_set_date (self, _tmp0_);
	}
	if (json_object_has_member (object, "string")) {
		const gchar* _tmp1_;
		_tmp1_ = json_object_get_string_member (object, "string");
		objects_due_date_set_recurrence_string (self, _tmp1_);
	}
	if (json_object_has_member (object, "timezone")) {
		const gchar* _tmp2_;
		_tmp2_ = json_object_get_string_member (object, "timezone");
		objects_due_date_set_time_zone (self, _tmp2_);
	}
	if (json_object_has_member (object, "is_recurring")) {
		objects_due_date_set_is_recurring (self, json_object_get_boolean_member (object, "is_recurring"));
		utils_datetime_parse_todoist_recurrency (self, object);
	}
}

static gboolean
bool_parse (const gchar* str)
{
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	if (g_strcmp0 (str, "true") == 0) {
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

void
objects_due_date_update_from_json (ObjectsDueDate* self,
                                   JsonObject* object)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	if (json_object_has_member (object, "date")) {
		const gchar* _tmp0_;
		_tmp0_ = json_object_get_string_member (object, "date");
		objects_due_date_set_date (self, _tmp0_);
	}
	if (json_object_has_member (object, "recurrence_string")) {
		const gchar* _tmp1_;
		_tmp1_ = json_object_get_string_member (object, "recurrence_string");
		objects_due_date_set_recurrence_string (self, _tmp1_);
	}
	if (json_object_has_member (object, "timezone")) {
		const gchar* _tmp2_;
		_tmp2_ = json_object_get_string_member (object, "timezone");
		objects_due_date_set_time_zone (self, _tmp2_);
	}
	if (json_object_has_member (object, "is_recurring")) {
		objects_due_date_set_is_recurring (self, json_object_get_boolean_member (object, "is_recurring"));
	}
	if (json_object_has_member (object, "recurrency_type")) {
		const gchar* _tmp3_;
		_tmp3_ = json_object_get_string_member (object, "recurrency_type");
		objects_due_date_set_recurrency_type (self, (RecurrencyType) atoi (_tmp3_));
	}
	if (json_object_has_member (object, "recurrency_interval")) {
		const gchar* _tmp4_;
		_tmp4_ = json_object_get_string_member (object, "recurrency_interval");
		objects_due_date_set_recurrency_interval (self, atoi (_tmp4_));
	}
	if (json_object_has_member (object, "recurrency_weeks")) {
		const gchar* _tmp5_;
		_tmp5_ = json_object_get_string_member (object, "recurrency_weeks");
		objects_due_date_set_recurrency_weeks (self, _tmp5_);
	}
	if (json_object_has_member (object, "recurrency_count")) {
		const gchar* _tmp6_;
		_tmp6_ = json_object_get_string_member (object, "recurrency_count");
		objects_due_date_set_recurrency_count (self, atoi (_tmp6_));
	}
	if (json_object_has_member (object, "recurrency_end")) {
		const gchar* _tmp7_;
		_tmp7_ = json_object_get_string_member (object, "recurrency_end");
		objects_due_date_set_recurrency_end (self, _tmp7_);
	}
	if (json_object_has_member (object, "recurrency_last_day_of_month")) {
		const gchar* _tmp8_;
		_tmp8_ = json_object_get_string_member (object, "recurrency_last_day_of_month");
		objects_due_date_set_recurrency_last_day_of_month (self, bool_parse (_tmp8_));
	}
}

void
objects_due_date_reset (ObjectsDueDate* self)
{
	g_return_if_fail (self != NULL);
	objects_due_date_set_date (self, "");
	objects_due_date_set_recurrence_string (self, "");
	objects_due_date_set_time_zone (self, "");
	objects_due_date_set_recurrency_type (self, RECURRENCY_TYPE_NONE);
	objects_due_date_set_recurrency_interval (self, 0);
	objects_due_date_set_is_recurring (self, FALSE);
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

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

gchar*
objects_due_date_to_string (ObjectsDueDate* self)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_;
	RecurrencyType _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gint _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gint _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gboolean _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp19_;
	JsonNode* root = NULL;
	JsonNode* _tmp20_;
	gchar* _tmp21_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	json_builder_begin_object (builder);
	json_builder_set_member_name (builder, "date");
	_tmp1_ = self->priv->_date;
	json_builder_add_string_value (builder, _tmp1_);
	json_builder_set_member_name (builder, "recurrence_string");
	_tmp2_ = self->priv->_recurrence_string;
	json_builder_add_string_value (builder, _tmp2_);
	json_builder_set_member_name (builder, "timezone");
	_tmp3_ = self->priv->_time_zone;
	json_builder_add_string_value (builder, _tmp3_);
	json_builder_set_member_name (builder, "is_recurring");
	_tmp4_ = self->priv->_is_recurring;
	json_builder_add_boolean_value (builder, _tmp4_);
	json_builder_set_member_name (builder, "recurrency_type");
	_tmp5_ = self->priv->_recurrency_type;
	_tmp6_ = g_strdup_printf ("%i", (gint) _tmp5_);
	_tmp7_ = _tmp6_;
	json_builder_add_string_value (builder, _tmp7_);
	_g_free0 (_tmp7_);
	json_builder_set_member_name (builder, "recurrency_interval");
	_tmp8_ = self->priv->_recurrency_interval;
	_tmp9_ = g_strdup_printf ("%i", _tmp8_);
	_tmp10_ = _tmp9_;
	json_builder_add_string_value (builder, _tmp10_);
	_g_free0 (_tmp10_);
	json_builder_set_member_name (builder, "recurrency_weeks");
	_tmp11_ = self->priv->_recurrency_weeks;
	json_builder_add_string_value (builder, _tmp11_);
	json_builder_set_member_name (builder, "recurrency_count");
	_tmp12_ = self->priv->_recurrency_count;
	_tmp13_ = g_strdup_printf ("%i", _tmp12_);
	_tmp14_ = _tmp13_;
	json_builder_add_string_value (builder, _tmp14_);
	_g_free0 (_tmp14_);
	json_builder_set_member_name (builder, "recurrency_end");
	_tmp15_ = self->priv->_recurrency_end;
	json_builder_add_string_value (builder, _tmp15_);
	json_builder_set_member_name (builder, "recurrency_last_day_of_month");
	_tmp16_ = self->priv->_recurrency_last_day_of_month;
	_tmp17_ = bool_to_string (_tmp16_);
	_tmp18_ = _tmp17_;
	json_builder_add_string_value (builder, _tmp18_);
	_g_free0 (_tmp18_);
	json_builder_end_object (builder);
	_tmp19_ = json_generator_new ();
	generator = _tmp19_;
	_tmp20_ = json_builder_get_root (builder);
	root = _tmp20_;
	json_generator_set_root (generator, root);
	_tmp21_ = json_generator_to_data (generator, NULL);
	result = _tmp21_;
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
	return result;
}

gboolean
objects_due_date_is_recurrency_equal (ObjectsDueDate* self,
                                      ObjectsDueDate* duedate)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	RecurrencyType _tmp6_;
	RecurrencyType _tmp7_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (duedate != NULL, FALSE);
	_tmp6_ = self->priv->_recurrency_type;
	_tmp7_ = duedate->priv->_recurrency_type;
	if (((gint) _tmp6_) == ((gint) _tmp7_)) {
		gint _tmp8_;
		gint _tmp9_;
		_tmp8_ = self->priv->_recurrency_interval;
		_tmp9_ = duedate->priv->_recurrency_interval;
		_tmp5_ = _tmp8_ == _tmp9_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = self->priv->_recurrency_weeks;
		_tmp11_ = duedate->priv->_recurrency_weeks;
		_tmp4_ = g_strcmp0 (_tmp10_, _tmp11_) == 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		gint _tmp12_;
		gint _tmp13_;
		_tmp12_ = self->priv->_recurrency_count;
		_tmp13_ = duedate->priv->_recurrency_count;
		_tmp3_ = _tmp12_ == _tmp13_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp14_ = self->priv->_recurrency_end;
		_tmp15_ = duedate->priv->_recurrency_end;
		_tmp2_ = g_strcmp0 (_tmp14_, _tmp15_) == 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gboolean _tmp16_;
		gboolean _tmp17_;
		_tmp16_ = self->priv->_recurrency_last_day_of_month;
		_tmp17_ = duedate->priv->_recurrency_last_day_of_month;
		_tmp1_ = _tmp16_ == _tmp17_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp18_;
		gboolean _tmp19_;
		_tmp18_ = self->priv->_is_recurring;
		_tmp19_ = duedate->priv->_is_recurring;
		_tmp0_ = _tmp18_ == _tmp19_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gchar*
objects_due_date_to_friendly_string (ObjectsDueDate* self)
{
	RecurrencyType _tmp0_;
	gint _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_recurrency_type;
	_tmp1_ = self->priv->_recurrency_interval;
	_tmp2_ = recurrency_type_to_friendly_string (_tmp0_, &_tmp1_);
	result = _tmp2_;
	return result;
}

ObjectsDueDate*
objects_due_date_duplicate (ObjectsDueDate* self)
{
	ObjectsDueDate* new_due = NULL;
	ObjectsDueDate* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp5_;
	RecurrencyType _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	const gchar* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	ObjectsDueDate* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_due_date_new ();
	new_due = _tmp0_;
	_tmp1_ = self->priv->_date;
	objects_due_date_set_date (new_due, _tmp1_);
	_tmp2_ = self->priv->_recurrence_string;
	objects_due_date_set_recurrence_string (new_due, _tmp2_);
	_tmp3_ = self->priv->_time_zone;
	objects_due_date_set_time_zone (new_due, _tmp3_);
	_tmp4_ = self->priv->_recurrency_weeks;
	objects_due_date_set_recurrency_weeks (new_due, _tmp4_);
	_tmp5_ = self->priv->_is_recurring;
	objects_due_date_set_is_recurring (new_due, _tmp5_);
	_tmp6_ = self->priv->_recurrency_type;
	objects_due_date_set_recurrency_type (new_due, _tmp6_);
	_tmp7_ = self->priv->_recurrency_interval;
	objects_due_date_set_recurrency_interval (new_due, _tmp7_);
	_tmp8_ = self->priv->_recurrency_count;
	objects_due_date_set_recurrency_count (new_due, _tmp8_);
	_tmp9_ = self->priv->_recurrency_end;
	objects_due_date_set_recurrency_end (new_due, _tmp9_);
	_tmp10_ = self->priv->_recurrence_supported;
	objects_due_date_set_recurrence_supported (new_due, _tmp10_);
	_tmp11_ = self->priv->_recurrency_last_day_of_month;
	objects_due_date_set_recurrency_last_day_of_month (new_due, _tmp11_);
	result = new_due;
	return result;
}

ObjectsDueDate*
objects_due_date_construct (GType object_type)
{
	ObjectsDueDate * self = NULL;
	self = (ObjectsDueDate*) g_object_new (object_type, NULL);
	return self;
}

ObjectsDueDate*
objects_due_date_new (void)
{
	return objects_due_date_construct (OBJECTS_TYPE_DUE_DATE);
}

const gchar*
objects_due_date_get_date (ObjectsDueDate* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_date;
	result = _tmp0_;
	return result;
}

void
objects_due_date_set_date (ObjectsDueDate* self,
                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_date (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_date);
		self->priv->_date = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_DATE_PROPERTY]);
	}
}

const gchar*
objects_due_date_get_recurrence_string (ObjectsDueDate* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_recurrence_string;
	result = _tmp0_;
	return result;
}

void
objects_due_date_set_recurrence_string (ObjectsDueDate* self,
                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrence_string (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_recurrence_string);
		self->priv->_recurrence_string = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCE_STRING_PROPERTY]);
	}
}

const gchar*
objects_due_date_get_time_zone (ObjectsDueDate* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_time_zone;
	result = _tmp0_;
	return result;
}

void
objects_due_date_set_time_zone (ObjectsDueDate* self,
                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_time_zone (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_time_zone);
		self->priv->_time_zone = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_TIME_ZONE_PROPERTY]);
	}
}

const gchar*
objects_due_date_get_recurrency_weeks (ObjectsDueDate* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_recurrency_weeks;
	result = _tmp0_;
	return result;
}

void
objects_due_date_set_recurrency_weeks (ObjectsDueDate* self,
                                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrency_weeks (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_recurrency_weeks);
		self->priv->_recurrency_weeks = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_WEEKS_PROPERTY]);
	}
}

gboolean
objects_due_date_get_is_recurring (ObjectsDueDate* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_recurring;
	return result;
}

void
objects_due_date_set_is_recurring (ObjectsDueDate* self,
                                   gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_is_recurring (self);
	if (old_value != value) {
		self->priv->_is_recurring = value;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_IS_RECURRING_PROPERTY]);
	}
}

RecurrencyType
objects_due_date_get_recurrency_type (ObjectsDueDate* self)
{
	RecurrencyType result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_recurrency_type;
	return result;
}

void
objects_due_date_set_recurrency_type (ObjectsDueDate* self,
                                      RecurrencyType value)
{
	RecurrencyType old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrency_type (self);
	if (old_value != value) {
		self->priv->_recurrency_type = value;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_TYPE_PROPERTY]);
	}
}

gint
objects_due_date_get_recurrency_interval (ObjectsDueDate* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_recurrency_interval;
	return result;
}

void
objects_due_date_set_recurrency_interval (ObjectsDueDate* self,
                                          gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrency_interval (self);
	if (old_value != value) {
		self->priv->_recurrency_interval = value;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_INTERVAL_PROPERTY]);
	}
}

gint
objects_due_date_get_recurrency_count (ObjectsDueDate* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_recurrency_count;
	return result;
}

void
objects_due_date_set_recurrency_count (ObjectsDueDate* self,
                                       gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrency_count (self);
	if (old_value != value) {
		self->priv->_recurrency_count = value;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_COUNT_PROPERTY]);
	}
}

const gchar*
objects_due_date_get_recurrency_end (ObjectsDueDate* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_recurrency_end;
	result = _tmp0_;
	return result;
}

void
objects_due_date_set_recurrency_end (ObjectsDueDate* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrency_end (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_recurrency_end);
		self->priv->_recurrency_end = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_END_PROPERTY]);
	}
}

gboolean
objects_due_date_get_recurrency_last_day_of_month (ObjectsDueDate* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_recurrency_last_day_of_month;
	return result;
}

void
objects_due_date_set_recurrency_last_day_of_month (ObjectsDueDate* self,
                                                   gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrency_last_day_of_month (self);
	if (old_value != value) {
		self->priv->_recurrency_last_day_of_month = value;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_LAST_DAY_OF_MONTH_PROPERTY]);
	}
}

gboolean
objects_due_date_get_recurrence_supported (ObjectsDueDate* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_recurrence_supported;
	return result;
}

void
objects_due_date_set_recurrence_supported (ObjectsDueDate* self,
                                           gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_due_date_get_recurrence_supported (self);
	if (old_value != value) {
		self->priv->_recurrence_supported = value;
		g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCE_SUPPORTED_PROPERTY]);
	}
}

GDateTime*
objects_due_date_get_datetime (ObjectsDueDate* self)
{
	GDateTime* result;
	const gchar* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_date;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_datetime;
	if (_tmp1_ == NULL) {
		const gchar* _tmp2_;
		GDateTime* _tmp3_;
		_tmp2_ = self->priv->_date;
		_tmp3_ = utils_datetime_get_todoist_datetime (_tmp2_);
		_g_date_time_unref0 (self->priv->_datetime);
		self->priv->_datetime = _tmp3_;
	}
	_tmp4_ = self->priv->_datetime;
	result = _tmp4_;
	return result;
}

void
objects_due_date_set_datetime (ObjectsDueDate* self,
                               GDateTime* value)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = utils_datetime_get_todoist_datetime_format (value);
	_tmp1_ = _tmp0_;
	objects_due_date_set_date (self, _tmp1_);
	_g_free0 (_tmp1_);
	g_object_notify_by_pspec ((GObject *) self, objects_due_date_properties[OBJECTS_DUE_DATE_DATETIME_PROPERTY]);
}

GDateTime*
objects_due_date_get_end_datetime (ObjectsDueDate* self)
{
	GDateTime* result;
	const gchar* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_recurrency_end;
	_tmp1_ = utils_datetime_get_date_from_string (_tmp0_);
	_g_date_time_unref0 (self->priv->_end_datetime);
	self->priv->_end_datetime = _tmp1_;
	_tmp2_ = self->priv->_end_datetime;
	result = _tmp2_;
	return result;
}

gboolean
objects_due_date_get_has_weeks (ObjectsDueDate* self)
{
	gboolean result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_recurrency_weeks;
	result = g_strcmp0 (_tmp0_, "") != 0;
	return result;
}

RecurrencyEndType
objects_due_date_get_end_type (ObjectsDueDate* self)
{
	RecurrencyEndType result;
	const gchar* _tmp0_;
	gint _tmp1_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_recurrency_end;
	if (g_strcmp0 (_tmp0_, "") != 0) {
		result = RECURRENCY_END_TYPE_ON_DATE;
		return result;
	}
	_tmp1_ = self->priv->_recurrency_count;
	if (_tmp1_ > 0) {
		result = RECURRENCY_END_TYPE_AFTER;
		return result;
	}
	result = RECURRENCY_END_TYPE_NEVER;
	return result;
}

gboolean
objects_due_date_get_is_recurrency_end (ObjectsDueDate* self)
{
	gboolean result;
	RecurrencyEndType _tmp0_;
	RecurrencyEndType _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = objects_due_date_get_end_type (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == RECURRENCY_END_TYPE_ON_DATE) {
		GDateTime* next_recurrency = NULL;
		GDateTime* _tmp2_;
		GDateTime* _tmp3_;
		GDateTime* _tmp4_;
		GDateTime* _tmp5_;
		GDateTime* _tmp6_;
		GDateTime* _tmp7_;
		_tmp2_ = objects_due_date_get_datetime (self);
		_tmp3_ = _tmp2_;
		_tmp4_ = utils_datetime_next_recurrency (_tmp3_, self);
		next_recurrency = _tmp4_;
		_tmp5_ = next_recurrency;
		_tmp6_ = objects_due_date_get_end_datetime (self);
		_tmp7_ = _tmp6_;
		result = g_date_time_compare (_tmp5_, _tmp7_) > -1;
		_g_date_time_unref0 (next_recurrency);
		return result;
	} else {
		RecurrencyEndType _tmp8_;
		RecurrencyEndType _tmp9_;
		_tmp8_ = objects_due_date_get_end_type (self);
		_tmp9_ = _tmp8_;
		if (_tmp9_ == RECURRENCY_END_TYPE_AFTER) {
			gint _tmp10_;
			_tmp10_ = self->priv->_recurrency_count;
			result = (_tmp10_ - 1) <= 0;
			return result;
		}
	}
	result = FALSE;
	return result;
}

static void
_objects_due_date___lambda10_ (ObjectsDueDate* self)
{
	_g_date_time_unref0 (self->priv->_datetime);
	self->priv->_datetime = NULL;
}

static void
__objects_due_date___lambda10__g_object_notify (GObject* _sender,
                                                GParamSpec* pspec,
                                                gpointer self)
{
	_objects_due_date___lambda10_ ((ObjectsDueDate*) self);
}

static GObject *
objects_due_date_constructor (GType type,
                              guint n_construct_properties,
                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ObjectsDueDate * self;
	parent_class = G_OBJECT_CLASS (objects_due_date_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_DUE_DATE, ObjectsDueDate);
	g_signal_connect_object ((GObject*) self, "notify::date", (GCallback) __objects_due_date___lambda10__g_object_notify, self, 0);
	return obj;
}

static void
objects_due_date_class_init (ObjectsDueDateClass * klass,
                             gpointer klass_data)
{
	objects_due_date_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ObjectsDueDate_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_objects_due_date_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_objects_due_date_set_property;
	G_OBJECT_CLASS (klass)->constructor = objects_due_date_constructor;
	G_OBJECT_CLASS (klass)->finalize = objects_due_date_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_DATE_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_DATE_PROPERTY] = g_param_spec_string ("date", "date", "date", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCE_STRING_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCE_STRING_PROPERTY] = g_param_spec_string ("recurrence-string", "recurrence-string", "recurrence-string", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_TIME_ZONE_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_TIME_ZONE_PROPERTY] = g_param_spec_string ("time-zone", "time-zone", "time-zone", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCY_WEEKS_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_WEEKS_PROPERTY] = g_param_spec_string ("recurrency-weeks", "recurrency-weeks", "recurrency-weeks", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_IS_RECURRING_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_IS_RECURRING_PROPERTY] = g_param_spec_boolean ("is-recurring", "is-recurring", "is-recurring", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCY_TYPE_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_TYPE_PROPERTY] = g_param_spec_enum ("recurrency-type", "recurrency-type", "recurrency-type", TYPE_RECURRENCY_TYPE, RECURRENCY_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCY_INTERVAL_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_INTERVAL_PROPERTY] = g_param_spec_int ("recurrency-interval", "recurrency-interval", "recurrency-interval", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCY_COUNT_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_COUNT_PROPERTY] = g_param_spec_int ("recurrency-count", "recurrency-count", "recurrency-count", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCY_END_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_END_PROPERTY] = g_param_spec_string ("recurrency-end", "recurrency-end", "recurrency-end", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCY_LAST_DAY_OF_MONTH_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCY_LAST_DAY_OF_MONTH_PROPERTY] = g_param_spec_boolean ("recurrency-last-day-of-month", "recurrency-last-day-of-month", "recurrency-last-day-of-month", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_RECURRENCE_SUPPORTED_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_RECURRENCE_SUPPORTED_PROPERTY] = g_param_spec_boolean ("recurrence-supported", "recurrence-supported", "recurrence-supported", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_DATETIME_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_DATETIME_PROPERTY] = g_param_spec_boxed ("datetime", "datetime", "datetime", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_END_DATETIME_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_END_DATETIME_PROPERTY] = g_param_spec_boxed ("end-datetime", "end-datetime", "end-datetime", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_HAS_WEEKS_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_HAS_WEEKS_PROPERTY] = g_param_spec_boolean ("has-weeks", "has-weeks", "has-weeks", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_END_TYPE_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_END_TYPE_PROPERTY] = g_param_spec_enum ("end-type", "end-type", "end-type", TYPE_RECURRENCY_END_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_DUE_DATE_IS_RECURRENCY_END_PROPERTY, objects_due_date_properties[OBJECTS_DUE_DATE_IS_RECURRENCY_END_PROPERTY] = g_param_spec_boolean ("is-recurrency-end", "is-recurrency-end", "is-recurrency-end", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
objects_due_date_instance_init (ObjectsDueDate * self,
                                gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	self->priv = objects_due_date_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_date = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->_recurrence_string = _tmp1_;
	_tmp2_ = g_strdup ("");
	self->priv->_time_zone = _tmp2_;
	_tmp3_ = g_strdup ("");
	self->priv->_recurrency_weeks = _tmp3_;
	self->priv->_is_recurring = FALSE;
	self->priv->_recurrency_type = RECURRENCY_TYPE_NONE;
	self->priv->_recurrency_interval = 0;
	self->priv->_recurrency_count = 0;
	_tmp4_ = g_strdup ("");
	self->priv->_recurrency_end = _tmp4_;
	self->priv->_recurrency_last_day_of_month = FALSE;
	self->priv->_recurrence_supported = FALSE;
	self->priv->_datetime = NULL;
}

static void
objects_due_date_finalize (GObject * obj)
{
	ObjectsDueDate * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_DUE_DATE, ObjectsDueDate);
	_g_free0 (self->priv->_date);
	_g_free0 (self->priv->_recurrence_string);
	_g_free0 (self->priv->_time_zone);
	_g_free0 (self->priv->_recurrency_weeks);
	_g_free0 (self->priv->_recurrency_end);
	_g_date_time_unref0 (self->priv->_datetime);
	_g_date_time_unref0 (self->priv->_end_datetime);
	G_OBJECT_CLASS (objects_due_date_parent_class)->finalize (obj);
}

static GType
objects_due_date_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsDueDateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_due_date_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsDueDate), 0, (GInstanceInitFunc) objects_due_date_instance_init, NULL };
	GType objects_due_date_type_id;
	objects_due_date_type_id = g_type_register_static (G_TYPE_OBJECT, "ObjectsDueDate", &g_define_type_info, 0);
	ObjectsDueDate_private_offset = g_type_add_instance_private (objects_due_date_type_id, sizeof (ObjectsDueDatePrivate));
	return objects_due_date_type_id;
}

GType
objects_due_date_get_type (void)
{
	static volatile gsize objects_due_date_type_id__once = 0;
	if (g_once_init_enter (&objects_due_date_type_id__once)) {
		GType objects_due_date_type_id;
		objects_due_date_type_id = objects_due_date_get_type_once ();
		g_once_init_leave (&objects_due_date_type_id__once, objects_due_date_type_id);
	}
	return objects_due_date_type_id__once;
}

static void
_vala_objects_due_date_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	ObjectsDueDate * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_DUE_DATE, ObjectsDueDate);
	switch (property_id) {
		case OBJECTS_DUE_DATE_DATE_PROPERTY:
		g_value_set_string (value, objects_due_date_get_date (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCE_STRING_PROPERTY:
		g_value_set_string (value, objects_due_date_get_recurrence_string (self));
		break;
		case OBJECTS_DUE_DATE_TIME_ZONE_PROPERTY:
		g_value_set_string (value, objects_due_date_get_time_zone (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_WEEKS_PROPERTY:
		g_value_set_string (value, objects_due_date_get_recurrency_weeks (self));
		break;
		case OBJECTS_DUE_DATE_IS_RECURRING_PROPERTY:
		g_value_set_boolean (value, objects_due_date_get_is_recurring (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_TYPE_PROPERTY:
		g_value_set_enum (value, objects_due_date_get_recurrency_type (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_INTERVAL_PROPERTY:
		g_value_set_int (value, objects_due_date_get_recurrency_interval (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_COUNT_PROPERTY:
		g_value_set_int (value, objects_due_date_get_recurrency_count (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_END_PROPERTY:
		g_value_set_string (value, objects_due_date_get_recurrency_end (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_LAST_DAY_OF_MONTH_PROPERTY:
		g_value_set_boolean (value, objects_due_date_get_recurrency_last_day_of_month (self));
		break;
		case OBJECTS_DUE_DATE_RECURRENCE_SUPPORTED_PROPERTY:
		g_value_set_boolean (value, objects_due_date_get_recurrence_supported (self));
		break;
		case OBJECTS_DUE_DATE_DATETIME_PROPERTY:
		g_value_set_boxed (value, objects_due_date_get_datetime (self));
		break;
		case OBJECTS_DUE_DATE_END_DATETIME_PROPERTY:
		g_value_set_boxed (value, objects_due_date_get_end_datetime (self));
		break;
		case OBJECTS_DUE_DATE_HAS_WEEKS_PROPERTY:
		g_value_set_boolean (value, objects_due_date_get_has_weeks (self));
		break;
		case OBJECTS_DUE_DATE_END_TYPE_PROPERTY:
		g_value_set_enum (value, objects_due_date_get_end_type (self));
		break;
		case OBJECTS_DUE_DATE_IS_RECURRENCY_END_PROPERTY:
		g_value_set_boolean (value, objects_due_date_get_is_recurrency_end (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_objects_due_date_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec)
{
	ObjectsDueDate * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_DUE_DATE, ObjectsDueDate);
	switch (property_id) {
		case OBJECTS_DUE_DATE_DATE_PROPERTY:
		objects_due_date_set_date (self, g_value_get_string (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCE_STRING_PROPERTY:
		objects_due_date_set_recurrence_string (self, g_value_get_string (value));
		break;
		case OBJECTS_DUE_DATE_TIME_ZONE_PROPERTY:
		objects_due_date_set_time_zone (self, g_value_get_string (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_WEEKS_PROPERTY:
		objects_due_date_set_recurrency_weeks (self, g_value_get_string (value));
		break;
		case OBJECTS_DUE_DATE_IS_RECURRING_PROPERTY:
		objects_due_date_set_is_recurring (self, g_value_get_boolean (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_TYPE_PROPERTY:
		objects_due_date_set_recurrency_type (self, g_value_get_enum (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_INTERVAL_PROPERTY:
		objects_due_date_set_recurrency_interval (self, g_value_get_int (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_COUNT_PROPERTY:
		objects_due_date_set_recurrency_count (self, g_value_get_int (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_END_PROPERTY:
		objects_due_date_set_recurrency_end (self, g_value_get_string (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCY_LAST_DAY_OF_MONTH_PROPERTY:
		objects_due_date_set_recurrency_last_day_of_month (self, g_value_get_boolean (value));
		break;
		case OBJECTS_DUE_DATE_RECURRENCE_SUPPORTED_PROPERTY:
		objects_due_date_set_recurrence_supported (self, g_value_get_boolean (value));
		break;
		case OBJECTS_DUE_DATE_DATETIME_PROPERTY:
		objects_due_date_set_datetime (self, g_value_get_boxed (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

