/*******************************************************************************
***  This file is part of Pecunia.                                           ***
***                                                                          ***
***  Copyright (C) 2017, 2018, 2019, 2020, 2021, 2023                        ***
***  John Schneiderman <Licencing _AT_ Schneiderman _DOT_ me>                ***
***                                                                          ***
***  This program 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 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 Lesser General Public License for more details.             ***
***                                                                          ***
***  You should have received a copy of the GNU Lesser General Public License***
***  along with this program. If not, see <http://www.gnu.org/licenses/>.    ***
*******************************************************************************/
#ifndef PECUNIA_CURRENCY_INTERNAL_VERIFICATION_H_
#define PECUNIA_CURRENCY_INTERNAL_VERIFICATION_H_

#include <cstdint>

#include <pecunia/MoneyTypes.h>


namespace pecunia
{

class FloatingPoint;

namespace internal
{

enum class VerifiedValue
{
	Fits,
	Overflows,
	Underflows,
	Undefined
};

VerifiedValue verifyAdditionFits(
	const UnitStorage& lhs,
	const UnitStorage& rhs,
	const UnitStorage& maximum,
	const UnitStorage& minimum
);
VerifiedValue verifySubtractionFits(
	const UnitStorage& lhs,
	const UnitStorage& rhs,
	const UnitStorage& maximum,
	const UnitStorage& minimum
);
VerifiedValue verifyMultiplicationFits(
	const UnitStorage& lhs,
	const FloatingPoint& rhs,
	const UnitStorage& maximum,
	const UnitStorage& minimum,
	const MinorUnit& minorMaximum,
	const std::uint8_t minorPrecision
);
VerifiedValue verifyDivisionFits(
	const UnitStorage& lhs,
	const FloatingPoint& rhs,
	const UnitStorage& maximum,
	const UnitStorage& minimum,
	const MinorUnit& minorMaximum,
	const std::uint8_t minorPrecision
);
VerifiedValue verifyMultiplicationFits(
	const UnitStorage& lhs,
	const UnitStorage& rhs,
	const UnitStorage& maximum,
	const UnitStorage& minimum
);
VerifiedValue verifyDivisionFits(
	const UnitStorage& lhs,
	const UnitStorage& rhs,
	const MinorUnit& minorMaximum
);

}}

#endif
