/*
 * Copyright (C) 2023-2024 Birb Developers
 *
 * Birb is the legal property of its developers, whose names are too
 * numerous to list here. Please refer to the AUTHORS file distributed
 * with this source distribution
 *
 * 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 2 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, see <https://www.gnu.org/licenses/>.
 */

#if !defined(BIRB_GLOBAL_HEADER_INSIDE) && !defined(BIRB_COMPILATION)
# error "only <birb.h> may be included directly"
#endif

#ifndef BIRB_DATE_TIME_H
#define BIRB_DATE_TIME_H

#include <glib.h>

#include "birbversion.h"

G_BEGIN_DECLS

/**
 * birb_date_time_set:
 * @datetime_ptr: (inout) (not optional) (nullable): A pointer to a
 *                [type@GLib.DateTime] reference.
 * @new_datetime: (nullable) (transfer none): The new date time to set.
 *
 * Updates @datetime_ptr to point to @new_datetime.
 *
 * If @datetime_ptr had a previous reference, it will be un-referenced.
 *
 * If @new_datetime is not %NULL, a new reference will be added when it is
 * assigned to @datetime_ptr.
 *
 * @datetime_ptr can not be %NULL but may point to a %NULL value.
 *
 * Returns: %TRUE if the value of @datetime_ptr changed, otherwise %FALSE.
 *
 * Since: 0.1
 */
BIRB_AVAILABLE_IN_0_1
gboolean birb_date_time_set(GDateTime **datetime_ptr, GDateTime *new_datetime);

/**
 * birb_date_time_clear:
 * @datetime_ptr: A pointer to a [type@GLib.DateTime] reference.
 *
 * Clears a reference to a [type@GLib.DateTime].
 *
 * If the reference is %NULL, this function does nothing. Otherwise, the
 * reference count of the [type@GLib.DateTime] is decreased and the pointer is
 * set to %NULL.
 *
 * Since: 0.1
 */
BIRB_AVAILABLE_IN_0_1
void birb_date_time_clear(GDateTime **datetime_ptr);

/**
 * birb_date_time_compare:
 * @dt1: (nullable) (transfer none): The pointer to the first
 *       [type@GLib.DateTime] to compare.
 * @dt2: (nullable) (transfer none): The pointer to the second
 *       [type@GLib.DateTime] to compare.
 *
 * Compare two [type@GLib.DateTime] objects.
 *
 * Returns: -1, 0 or 1 if @dt1 is *less than*, *equal to* or
 *          *greater than* @dt2.
 *
 * Since: 0.2
 */
BIRB_AVAILABLE_IN_0_2
gint birb_date_time_compare(GDateTime *dt1, GDateTime *dt2);

/**
 * birb_date_time_equal:
 * @dt1: (nullable) (transfer none): The pointer to the first
 *       [type@GLib.DateTime] to compare.
 * @dt2: (nullable) (transfer none): The pointer to the second
 *       [type@GLib.DateTime] to compare.
 *
 * Checks two [type@GLib.DateTime] objects for equality.
 *
 * Returns: %TRUE if @dt1 and @dt2 are equal.
 *
 * Since: 0.2
 */
BIRB_AVAILABLE_IN_0_2
gboolean birb_date_time_equal(GDateTime *dt1, GDateTime *dt2);

G_END_DECLS

#endif /* BIRB_DATE_TIME_H */
