/*******************************************************************************
***  This file is part of Dux Rei Nummariae.                                 ***
***                                                                          ***
***  Copyright (C) 2017, 2018, 2019, 2020, 2021                              ***
***  John Schneiderman <Licensing _AT_ Schneiderman _DOT_ me>                ***
***                                                                          ***
***  This program is free software: you can redistribute it and/or modify it ***
***  under the terms of the GNU Affero 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 Affero General Public License for more details.             ***
***                                                                          ***
***  You should have received a copy of the GNU Affero General Public License***
***  along with this program. If not, see <http://www.gnu.org/licenses/>.    ***
*******************************************************************************/
#ifndef DRN_BUDGETING_GOAL_H_
#define DRN_BUDGETING_GOAL_H_

#include <iosfwd>

#include "BudgetedMoney.h"
#include "budgeting_export.h"


namespace drn
{
namespace budgeting
{
/**
 * @brief The representation of an amount of money that set aside each period for a particular
 * usage.
 */
class DRN_BUDGETING_EXPORT Goal : public BudgetedMoney
{
	pecunia::currency::Money final_;

public:
	/**
	 * @brief Constructs all member variables to their empty state.
	 */
	Goal();
	Goal(const BudgetSource& source);
	/**
	 * @brief Fully initialises all member variables to their supplied values.
	 *
	 * @exception BudgetItemError When the source is empty.
	 * @exception BudgetItemError When the amount is less then zero.
	 * @exception BudgetItemError When the amount is not issued in a known currency.
	 * @exception BudgetItemError When the period is not known.
	 * @exception BudgetItemError When the next occur date is invalid.
	 *
	 * @param source The source of the money budget item.
	 * @param amount The amount the money is for every period.
	 * @param period The frequency period of the event for the money.
	 * @param nextOccurOn The date the money budget item last occurred on.
	 * @param final The final amount of money the goal is completed at.
	 */
	Goal(
		const BudgetSource& source,
		const pecunia::currency::Money& amount,
		const EventFrequency& period,
		const ::QDate& nextOccurOn,
		const pecunia::currency::Money& final
	);
	const pecunia::currency::Money& final() const;
	/**
	 * @brief Equality operator compares all members.
	 *
	 * @param other The other object whose members should all be equal.
	 *
	 * @return When all member variables are the same it'll give true, else false.
	 */
	bool operator==(const Goal& other) const;
};

DRN_BUDGETING_EXPORT std::ostream& operator<<(std::ostream& o, const Goal& g);

}}

#endif
