/* time-block-entry.c generated by valac 0.56.19, the Vala compiler
 * generated from time-block-entry.vala, do not modify */

/*
 * Copyright (c) 2021-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_core.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gom/gom.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  {
	FT_TIME_BLOCK_ENTRY_0_PROPERTY,
	FT_TIME_BLOCK_ENTRY_ID_PROPERTY,
	FT_TIME_BLOCK_ENTRY_SESSION_ID_PROPERTY,
	FT_TIME_BLOCK_ENTRY_START_TIME_PROPERTY,
	FT_TIME_BLOCK_ENTRY_END_TIME_PROPERTY,
	FT_TIME_BLOCK_ENTRY_STATE_PROPERTY,
	FT_TIME_BLOCK_ENTRY_STATUS_PROPERTY,
	FT_TIME_BLOCK_ENTRY_INTENDED_DURATION_PROPERTY,
	FT_TIME_BLOCK_ENTRY_NUM_PROPERTIES
};
static GParamSpec* ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _FtTimeBlockEntryPrivate {
	gint64 _id;
	gint64 _session_id;
	gint64 _start_time;
	gint64 _end_time;
	gchar* _state;
	gchar* _status;
	gint64 _intended_duration;
};

static gint FtTimeBlockEntry_private_offset;
static gpointer ft_time_block_entry_parent_class = NULL;

static void ft_time_block_entry_finalize (GObject * obj);
static GType ft_time_block_entry_get_type_once (void);
static void _vala_ft_time_block_entry_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_ft_time_block_entry_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
ft_time_block_entry_get_instance_private (FtTimeBlockEntry* self)
{
	return G_STRUCT_MEMBER_P (self, FtTimeBlockEntry_private_offset);
}

FtTimeBlockEntry*
ft_time_block_entry_construct (GType object_type)
{
	FtTimeBlockEntry * self = NULL;
	self = (FtTimeBlockEntry*) g_object_new (object_type, NULL);
	return self;
}

FtTimeBlockEntry*
ft_time_block_entry_new (void)
{
	return ft_time_block_entry_construct (FT_TYPE_TIME_BLOCK_ENTRY);
}

gint64
ft_time_block_entry_get_id (FtTimeBlockEntry* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_id;
	return result;
}

void
ft_time_block_entry_set_id (FtTimeBlockEntry* self,
                            gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_get_id (self);
	if (old_value != value) {
		self->priv->_id = value;
		g_object_notify_by_pspec ((GObject *) self, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_ID_PROPERTY]);
	}
}

gint64
ft_time_block_entry_get_session_id (FtTimeBlockEntry* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_session_id;
	return result;
}

void
ft_time_block_entry_set_session_id (FtTimeBlockEntry* self,
                                    gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_get_session_id (self);
	if (old_value != value) {
		self->priv->_session_id = value;
		g_object_notify_by_pspec ((GObject *) self, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_SESSION_ID_PROPERTY]);
	}
}

gint64
ft_time_block_entry_get_start_time (FtTimeBlockEntry* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_start_time;
	return result;
}

void
ft_time_block_entry_set_start_time (FtTimeBlockEntry* self,
                                    gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_get_start_time (self);
	if (old_value != value) {
		self->priv->_start_time = value;
		g_object_notify_by_pspec ((GObject *) self, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_START_TIME_PROPERTY]);
	}
}

gint64
ft_time_block_entry_get_end_time (FtTimeBlockEntry* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_end_time;
	return result;
}

void
ft_time_block_entry_set_end_time (FtTimeBlockEntry* self,
                                  gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_get_end_time (self);
	if (old_value != value) {
		self->priv->_end_time = value;
		g_object_notify_by_pspec ((GObject *) self, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_END_TIME_PROPERTY]);
	}
}

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

void
ft_time_block_entry_set_state (FtTimeBlockEntry* self,
                               const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_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, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_STATE_PROPERTY]);
	}
}

const gchar*
ft_time_block_entry_get_status (FtTimeBlockEntry* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_status;
	result = _tmp0_;
	return result;
}

void
ft_time_block_entry_set_status (FtTimeBlockEntry* self,
                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_get_status (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_status);
		self->priv->_status = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_STATUS_PROPERTY]);
	}
}

gint64
ft_time_block_entry_get_intended_duration (FtTimeBlockEntry* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_intended_duration;
	return result;
}

void
ft_time_block_entry_set_intended_duration (FtTimeBlockEntry* self,
                                           gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = ft_time_block_entry_get_intended_duration (self);
	if (old_value != value) {
		self->priv->_intended_duration = value;
		g_object_notify_by_pspec ((GObject *) self, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_INTENDED_DURATION_PROPERTY]);
	}
}

static void
ft_time_block_entry_class_init (FtTimeBlockEntryClass * klass,
                                gpointer klass_data)
{
	ft_time_block_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtTimeBlockEntry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_time_block_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_time_block_entry_set_property;
	G_OBJECT_CLASS (klass)->finalize = ft_time_block_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIME_BLOCK_ENTRY_ID_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_ID_PROPERTY] = g_param_spec_int64 ("id", "id", "id", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIME_BLOCK_ENTRY_SESSION_ID_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_SESSION_ID_PROPERTY] = g_param_spec_int64 ("session-id", "session-id", "session-id", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIME_BLOCK_ENTRY_START_TIME_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_START_TIME_PROPERTY] = g_param_spec_int64 ("start-time", "start-time", "start-time", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIME_BLOCK_ENTRY_END_TIME_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_END_TIME_PROPERTY] = g_param_spec_int64 ("end-time", "end-time", "end-time", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIME_BLOCK_ENTRY_STATE_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_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), FT_TIME_BLOCK_ENTRY_STATUS_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_STATUS_PROPERTY] = g_param_spec_string ("status", "status", "status", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_TIME_BLOCK_ENTRY_INTENDED_DURATION_PROPERTY, ft_time_block_entry_properties[FT_TIME_BLOCK_ENTRY_INTENDED_DURATION_PROPERTY] = g_param_spec_int64 ("intended-duration", "intended-duration", "intended-duration", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gom_resource_class_set_table (GOM_RESOURCE_CLASS (klass), "timeblocks");
	gom_resource_class_set_primary_key (GOM_RESOURCE_CLASS (klass), "id");
	gom_resource_class_set_notnull (GOM_RESOURCE_CLASS (klass), "session-id");
	gom_resource_class_set_notnull (GOM_RESOURCE_CLASS (klass), "start-time");
	gom_resource_class_set_notnull (GOM_RESOURCE_CLASS (klass), "end-time");
	gom_resource_class_set_notnull (GOM_RESOURCE_CLASS (klass), "state");
	gom_resource_class_set_notnull (GOM_RESOURCE_CLASS (klass), "status");
	gom_resource_class_set_notnull (GOM_RESOURCE_CLASS (klass), "intended-duration");
	gom_resource_class_set_unique (GOM_RESOURCE_CLASS (klass), "start-time");
	gom_resource_class_set_reference (GOM_RESOURCE_CLASS (klass), "session-id", "sessions", "id");
}

static void
ft_time_block_entry_instance_init (FtTimeBlockEntry * self,
                                   gpointer klass)
{
	self->priv = ft_time_block_entry_get_instance_private (self);
	self->version = (gulong) 0;
}

static void
ft_time_block_entry_finalize (GObject * obj)
{
	FtTimeBlockEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_TIME_BLOCK_ENTRY, FtTimeBlockEntry);
	_g_free0 (self->priv->_state);
	_g_free0 (self->priv->_status);
	G_OBJECT_CLASS (ft_time_block_entry_parent_class)->finalize (obj);
}

static GType
ft_time_block_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtTimeBlockEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_time_block_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtTimeBlockEntry), 0, (GInstanceInitFunc) ft_time_block_entry_instance_init, NULL };
	GType ft_time_block_entry_type_id;
	ft_time_block_entry_type_id = g_type_register_static (gom_resource_get_type (), "FtTimeBlockEntry", &g_define_type_info, 0);
	FtTimeBlockEntry_private_offset = g_type_add_instance_private (ft_time_block_entry_type_id, sizeof (FtTimeBlockEntryPrivate));
	return ft_time_block_entry_type_id;
}

GType
ft_time_block_entry_get_type (void)
{
	static volatile gsize ft_time_block_entry_type_id__once = 0;
	if (g_once_init_enter (&ft_time_block_entry_type_id__once)) {
		GType ft_time_block_entry_type_id;
		ft_time_block_entry_type_id = ft_time_block_entry_get_type_once ();
		g_once_init_leave (&ft_time_block_entry_type_id__once, ft_time_block_entry_type_id);
	}
	return ft_time_block_entry_type_id__once;
}

static void
_vala_ft_time_block_entry_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	FtTimeBlockEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_TIME_BLOCK_ENTRY, FtTimeBlockEntry);
	switch (property_id) {
		case FT_TIME_BLOCK_ENTRY_ID_PROPERTY:
		g_value_set_int64 (value, ft_time_block_entry_get_id (self));
		break;
		case FT_TIME_BLOCK_ENTRY_SESSION_ID_PROPERTY:
		g_value_set_int64 (value, ft_time_block_entry_get_session_id (self));
		break;
		case FT_TIME_BLOCK_ENTRY_START_TIME_PROPERTY:
		g_value_set_int64 (value, ft_time_block_entry_get_start_time (self));
		break;
		case FT_TIME_BLOCK_ENTRY_END_TIME_PROPERTY:
		g_value_set_int64 (value, ft_time_block_entry_get_end_time (self));
		break;
		case FT_TIME_BLOCK_ENTRY_STATE_PROPERTY:
		g_value_set_string (value, ft_time_block_entry_get_state (self));
		break;
		case FT_TIME_BLOCK_ENTRY_STATUS_PROPERTY:
		g_value_set_string (value, ft_time_block_entry_get_status (self));
		break;
		case FT_TIME_BLOCK_ENTRY_INTENDED_DURATION_PROPERTY:
		g_value_set_int64 (value, ft_time_block_entry_get_intended_duration (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_time_block_entry_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	FtTimeBlockEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_TIME_BLOCK_ENTRY, FtTimeBlockEntry);
	switch (property_id) {
		case FT_TIME_BLOCK_ENTRY_ID_PROPERTY:
		ft_time_block_entry_set_id (self, g_value_get_int64 (value));
		break;
		case FT_TIME_BLOCK_ENTRY_SESSION_ID_PROPERTY:
		ft_time_block_entry_set_session_id (self, g_value_get_int64 (value));
		break;
		case FT_TIME_BLOCK_ENTRY_START_TIME_PROPERTY:
		ft_time_block_entry_set_start_time (self, g_value_get_int64 (value));
		break;
		case FT_TIME_BLOCK_ENTRY_END_TIME_PROPERTY:
		ft_time_block_entry_set_end_time (self, g_value_get_int64 (value));
		break;
		case FT_TIME_BLOCK_ENTRY_STATE_PROPERTY:
		ft_time_block_entry_set_state (self, g_value_get_string (value));
		break;
		case FT_TIME_BLOCK_ENTRY_STATUS_PROPERTY:
		ft_time_block_entry_set_status (self, g_value_get_string (value));
		break;
		case FT_TIME_BLOCK_ENTRY_INTENDED_DURATION_PROPERTY:
		ft_time_block_entry_set_intended_duration (self, g_value_get_int64 (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;
}

