/*
 * Copyright (C) 2022-2025 Seagull Developers
 *
 * Seagull 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 library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

#include "seagullversion.h"

/******************************************************************************
 * Externals
 *****************************************************************************/
const guint seagull_major_version = SEAGULL_MAJOR_VERSION;
const guint seagull_minor_version = SEAGULL_MINOR_VERSION;
const guint seagull_micro_version = SEAGULL_MICRO_VERSION;
const char *seagull_version = SEAGULL_VERSION;

/******************************************************************************
 * Public API
 *****************************************************************************/
const char *
seagull_check_version(guint required_major, guint required_minor,
                   guint required_micro)
{
	if(required_major > SEAGULL_MAJOR_VERSION) {
		return "seagull version too old (major mismatch)";
	}

#if SEAGULL_CHECK_VERSION(1, 0, 0)
	if(required_major < SEAGULL_MAJOR_VERSION) {
		return "seagull version too new (major mismatch)";
	}
#endif

	if(required_minor > SEAGULL_MINOR_VERSION) {
		return "seagull version too old (minor mismatch)";
	}

	if((required_minor == SEAGULL_MINOR_VERSION) &&
	   (required_micro > SEAGULL_MICRO_VERSION))
	{
		return "seagull version too old (micro mismatch)";
	}

	return NULL;
}
