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

/*
 * Copyright © 2025 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 "chrono.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <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  {
	CHRONO_ES_CONSTANTS_0_PROPERTY,
	CHRONO_ES_CONSTANTS_NUM_PROPERTIES
};
static GParamSpec* chrono_es_constants_properties[CHRONO_ES_CONSTANTS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

static gpointer chrono_es_constants_parent_class = NULL;
static GeeHashMap* chrono_es_constants__month_names;
static GeeHashMap* chrono_es_constants__month_names = NULL;
static GeeHashMap* chrono_es_constants__time_units;
static GeeHashMap* chrono_es_constants__time_units = NULL;

static GeeHashMap* chrono_es_constants_get_month_names (void);
static gint* _int_dup (gint* self);
static GeeHashMap* chrono_es_constants_get_time_units (void);
static ChronoTimeUnit* _chrono_time_unit_dup (ChronoTimeUnit* self);
static void chrono_es_constants_finalize (GObject * obj);
static GType chrono_es_constants_get_type_once (void);

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

static GeeHashMap*
chrono_es_constants_get_month_names (void)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp27_;
	GeeHashMap* _tmp28_;
	GeeHashMap* result;
	_tmp0_ = chrono_es_constants__month_names;
	if (_tmp0_ == NULL) {
		GeeHashMap* _tmp1_;
		GeeHashMap* _tmp2_;
		GeeHashMap* _tmp3_;
		GeeHashMap* _tmp4_;
		GeeHashMap* _tmp5_;
		GeeHashMap* _tmp6_;
		GeeHashMap* _tmp7_;
		GeeHashMap* _tmp8_;
		GeeHashMap* _tmp9_;
		GeeHashMap* _tmp10_;
		GeeHashMap* _tmp11_;
		GeeHashMap* _tmp12_;
		GeeHashMap* _tmp13_;
		GeeHashMap* _tmp14_;
		GeeHashMap* _tmp15_;
		GeeHashMap* _tmp16_;
		GeeHashMap* _tmp17_;
		GeeHashMap* _tmp18_;
		GeeHashMap* _tmp19_;
		GeeHashMap* _tmp20_;
		GeeHashMap* _tmp21_;
		GeeHashMap* _tmp22_;
		GeeHashMap* _tmp23_;
		GeeHashMap* _tmp24_;
		GeeHashMap* _tmp25_;
		GeeHashMap* _tmp26_;
		_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_INT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (chrono_es_constants__month_names);
		chrono_es_constants__month_names = _tmp1_;
		_tmp2_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, "enero", (gpointer) ((gintptr) 1));
		_tmp3_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp3_, "febrero", (gpointer) ((gintptr) 2));
		_tmp4_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, "marzo", (gpointer) ((gintptr) 3));
		_tmp5_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, "abril", (gpointer) ((gintptr) 4));
		_tmp6_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp6_, "mayo", (gpointer) ((gintptr) 5));
		_tmp7_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp7_, "junio", (gpointer) ((gintptr) 6));
		_tmp8_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp8_, "julio", (gpointer) ((gintptr) 7));
		_tmp9_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp9_, "agosto", (gpointer) ((gintptr) 8));
		_tmp10_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp10_, "septiembre", (gpointer) ((gintptr) 9));
		_tmp11_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp11_, "octubre", (gpointer) ((gintptr) 10));
		_tmp12_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, "noviembre", (gpointer) ((gintptr) 11));
		_tmp13_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp13_, "diciembre", (gpointer) ((gintptr) 12));
		_tmp14_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, "ene", (gpointer) ((gintptr) 1));
		_tmp15_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp15_, "feb", (gpointer) ((gintptr) 2));
		_tmp16_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp16_, "mar", (gpointer) ((gintptr) 3));
		_tmp17_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp17_, "abr", (gpointer) ((gintptr) 4));
		_tmp18_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp18_, "may", (gpointer) ((gintptr) 5));
		_tmp19_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp19_, "jun", (gpointer) ((gintptr) 6));
		_tmp20_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp20_, "jul", (gpointer) ((gintptr) 7));
		_tmp21_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, "ago", (gpointer) ((gintptr) 8));
		_tmp22_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp22_, "sep", (gpointer) ((gintptr) 9));
		_tmp23_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp23_, "sept", (gpointer) ((gintptr) 9));
		_tmp24_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp24_, "oct", (gpointer) ((gintptr) 10));
		_tmp25_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp25_, "nov", (gpointer) ((gintptr) 11));
		_tmp26_ = chrono_es_constants__month_names;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp26_, "dic", (gpointer) ((gintptr) 12));
	}
	_tmp27_ = chrono_es_constants__month_names;
	_tmp28_ = _g_object_ref0 (_tmp27_);
	result = _tmp28_;
	return result;
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

gint*
chrono_es_constants_get_month (const gchar* name)
{
	gchar* key = NULL;
	gchar* _tmp0_;
	GeeHashMap* months = NULL;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp2_;
	const gchar* _tmp3_;
	gint* result;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = g_utf8_strdown (name, (gssize) -1);
	key = _tmp0_;
	_tmp1_ = chrono_es_constants_get_month_names ();
	months = _tmp1_;
	_tmp2_ = months;
	_tmp3_ = key;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, _tmp3_)) {
		GeeHashMap* _tmp4_;
		const gchar* _tmp5_;
		gpointer _tmp6_;
		gint _tmp7_;
		gint* _tmp8_;
		_tmp4_ = months;
		_tmp5_ = key;
		_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, _tmp5_);
		_tmp7_ = (gint) ((gintptr) _tmp6_);
		_tmp8_ = __int_dup0 (&_tmp7_);
		result = _tmp8_;
		_g_object_unref0 (months);
		_g_free0 (key);
		return result;
	}
	result = NULL;
	_g_object_unref0 (months);
	_g_free0 (key);
	return result;
}

static GeeHashMap*
chrono_es_constants_get_time_units (void)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp28_;
	GeeHashMap* _tmp29_;
	GeeHashMap* result;
	_tmp0_ = chrono_es_constants__time_units;
	if (_tmp0_ == NULL) {
		GeeHashMap* _tmp1_;
		GeeHashMap* _tmp2_;
		GeeHashMap* _tmp3_;
		GeeHashMap* _tmp4_;
		GeeHashMap* _tmp5_;
		GeeHashMap* _tmp6_;
		GeeHashMap* _tmp7_;
		GeeHashMap* _tmp8_;
		GeeHashMap* _tmp9_;
		GeeHashMap* _tmp10_;
		GeeHashMap* _tmp11_;
		GeeHashMap* _tmp12_;
		GeeHashMap* _tmp13_;
		GeeHashMap* _tmp14_;
		GeeHashMap* _tmp15_;
		GeeHashMap* _tmp16_;
		GeeHashMap* _tmp17_;
		GeeHashMap* _tmp18_;
		GeeHashMap* _tmp19_;
		GeeHashMap* _tmp20_;
		GeeHashMap* _tmp21_;
		GeeHashMap* _tmp22_;
		GeeHashMap* _tmp23_;
		GeeHashMap* _tmp24_;
		GeeHashMap* _tmp25_;
		GeeHashMap* _tmp26_;
		GeeHashMap* _tmp27_;
		_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, CHRONO_TYPE_TIME_UNIT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (chrono_es_constants__time_units);
		chrono_es_constants__time_units = _tmp1_;
		_tmp2_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, "segundo", (gpointer) ((gintptr) CHRONO_TIME_UNIT_SECOND));
		_tmp3_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp3_, "segundos", (gpointer) ((gintptr) CHRONO_TIME_UNIT_SECOND));
		_tmp4_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, "minuto", (gpointer) ((gintptr) CHRONO_TIME_UNIT_MINUTE));
		_tmp5_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, "minutos", (gpointer) ((gintptr) CHRONO_TIME_UNIT_MINUTE));
		_tmp6_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp6_, "hora", (gpointer) ((gintptr) CHRONO_TIME_UNIT_HOUR));
		_tmp7_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp7_, "horas", (gpointer) ((gintptr) CHRONO_TIME_UNIT_HOUR));
		_tmp8_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp8_, "día", (gpointer) ((gintptr) CHRONO_TIME_UNIT_DAY));
		_tmp9_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp9_, "dia", (gpointer) ((gintptr) CHRONO_TIME_UNIT_DAY));
		_tmp10_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp10_, "días", (gpointer) ((gintptr) CHRONO_TIME_UNIT_DAY));
		_tmp11_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp11_, "dias", (gpointer) ((gintptr) CHRONO_TIME_UNIT_DAY));
		_tmp12_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, "semana", (gpointer) ((gintptr) CHRONO_TIME_UNIT_WEEK));
		_tmp13_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp13_, "semanas", (gpointer) ((gintptr) CHRONO_TIME_UNIT_WEEK));
		_tmp14_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, "mes", (gpointer) ((gintptr) CHRONO_TIME_UNIT_MONTH));
		_tmp15_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp15_, "meses", (gpointer) ((gintptr) CHRONO_TIME_UNIT_MONTH));
		_tmp16_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp16_, "trimestre", (gpointer) ((gintptr) CHRONO_TIME_UNIT_QUARTER));
		_tmp17_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp17_, "trimestres", (gpointer) ((gintptr) CHRONO_TIME_UNIT_QUARTER));
		_tmp18_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp18_, "año", (gpointer) ((gintptr) CHRONO_TIME_UNIT_YEAR));
		_tmp19_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp19_, "ano", (gpointer) ((gintptr) CHRONO_TIME_UNIT_YEAR));
		_tmp20_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp20_, "años", (gpointer) ((gintptr) CHRONO_TIME_UNIT_YEAR));
		_tmp21_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, "anos", (gpointer) ((gintptr) CHRONO_TIME_UNIT_YEAR));
		_tmp22_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp22_, "seg", (gpointer) ((gintptr) CHRONO_TIME_UNIT_SECOND));
		_tmp23_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp23_, "min", (gpointer) ((gintptr) CHRONO_TIME_UNIT_MINUTE));
		_tmp24_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp24_, "h", (gpointer) ((gintptr) CHRONO_TIME_UNIT_HOUR));
		_tmp25_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp25_, "d", (gpointer) ((gintptr) CHRONO_TIME_UNIT_DAY));
		_tmp26_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp26_, "sem", (gpointer) ((gintptr) CHRONO_TIME_UNIT_WEEK));
		_tmp27_ = chrono_es_constants__time_units;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp27_, "trim", (gpointer) ((gintptr) CHRONO_TIME_UNIT_QUARTER));
	}
	_tmp28_ = chrono_es_constants__time_units;
	_tmp29_ = _g_object_ref0 (_tmp28_);
	result = _tmp29_;
	return result;
}

static ChronoTimeUnit*
_chrono_time_unit_dup (ChronoTimeUnit* self)
{
	ChronoTimeUnit* dup;
	dup = g_new0 (ChronoTimeUnit, 1);
	memcpy (dup, self, sizeof (ChronoTimeUnit));
	return dup;
}

static gpointer
__chrono_time_unit_dup0 (gpointer self)
{
	return self ? _chrono_time_unit_dup (self) : NULL;
}

ChronoTimeUnit*
chrono_es_constants_get_time_unit (const gchar* name)
{
	gchar* key = NULL;
	gchar* _tmp0_;
	GeeHashMap* units = NULL;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp2_;
	const gchar* _tmp3_;
	ChronoTimeUnit* result;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = g_utf8_strdown (name, (gssize) -1);
	key = _tmp0_;
	_tmp1_ = chrono_es_constants_get_time_units ();
	units = _tmp1_;
	_tmp2_ = units;
	_tmp3_ = key;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, _tmp3_)) {
		GeeHashMap* _tmp4_;
		const gchar* _tmp5_;
		gpointer _tmp6_;
		ChronoTimeUnit _tmp7_;
		ChronoTimeUnit* _tmp8_;
		_tmp4_ = units;
		_tmp5_ = key;
		_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, _tmp5_);
		_tmp7_ = (ChronoTimeUnit) ((gintptr) _tmp6_);
		_tmp8_ = __chrono_time_unit_dup0 (&_tmp7_);
		result = _tmp8_;
		_g_object_unref0 (units);
		_g_free0 (key);
		return result;
	}
	result = NULL;
	_g_object_unref0 (units);
	_g_free0 (key);
	return result;
}

ChronoESConstants*
chrono_es_constants_construct (GType object_type)
{
	ChronoESConstants * self = NULL;
	self = (ChronoESConstants*) g_object_new (object_type, NULL);
	return self;
}

ChronoESConstants*
chrono_es_constants_new (void)
{
	return chrono_es_constants_construct (CHRONO_TYPE_ES_CONSTANTS);
}

static void
chrono_es_constants_class_init (ChronoESConstantsClass * klass,
                                gpointer klass_data)
{
	chrono_es_constants_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = chrono_es_constants_finalize;
}

static void
chrono_es_constants_instance_init (ChronoESConstants * self,
                                   gpointer klass)
{
}

static void
chrono_es_constants_finalize (GObject * obj)
{
	ChronoESConstants * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CHRONO_TYPE_ES_CONSTANTS, ChronoESConstants);
	G_OBJECT_CLASS (chrono_es_constants_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
chrono_es_constants_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ChronoESConstantsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) chrono_es_constants_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ChronoESConstants), 0, (GInstanceInitFunc) chrono_es_constants_instance_init, NULL };
	GType chrono_es_constants_type_id;
	chrono_es_constants_type_id = g_type_register_static (G_TYPE_OBJECT, "ChronoESConstants", &g_define_type_info, 0);
	return chrono_es_constants_type_id;
}

GType
chrono_es_constants_get_type (void)
{
	static gsize chrono_es_constants_type_id__once = 0;
	if (g_once_init_enter (&chrono_es_constants_type_id__once)) {
		GType chrono_es_constants_type_id;
		chrono_es_constants_type_id = chrono_es_constants_get_type_once ();
		g_once_init_leave (&chrono_es_constants_type_id__once, chrono_es_constants_type_id);
	}
	return chrono_es_constants_type_id__once;
}

