/*******************************************************************************
***  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_BUDGETSOURCE_H_
#define DRN_BUDGETING_BUDGETSOURCE_H_

#include <QtGlobal>
#include <QString>

#include <iosfwd>

#include "budgeting_export.h"


namespace drn
{
namespace budgeting
{

/**
 * @brief The manager for the information on the source of a budgetary item.
 */
class DRN_BUDGETING_EXPORT BudgetSource
{
	::QString name_;

public:
	/**
	 * @brief Default constructor populated with invalid data.
	 */
	BudgetSource();
	/**
	 * @brief Fully initialising constructor. All leading and trailing white-space is removed
	 * from the name of the source.
	 *
	 * @exception Error When the name of the budgetary item is not valid.
	 *
	 * @param name The name of the source for the budgetary item.
	 */
	explicit BudgetSource(::QString name);
	/**
	 * @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 BudgetSource& other) const;
	/**
	 * @brief Less-than operator compares all members.
	 *
	 * @param other The other object whose members should all be compared to the current object.
	 *
	 * @return When all the current object's member variables are less than the supplied it'll
	 * give true, else false.
	 */
	bool operator<(const BudgetSource& other) const;
	/**
	 * @brief The name of the source.
	 */
	const ::QString& name() const;
	/**
	 * @brief Changes the name of the budgetary item source. All leading and trailing white-space
	 * is removed from the name.
	 *
	 * @exception Error When the name of the budgetary item is not valid.
	 *
	 * @param name The new name for the budgetary item source.
	 */
	void setName(const ::QString& name);
	/**
	 * @brief Determines if the object is empty, e.g. constructed by default.
	 *
	 * @return When everything is the default value gives true, false else-wise.
	 */
	bool isEmpty() const;
};

DRN_BUDGETING_EXPORT bool operator!=(const BudgetSource& lhs, const BudgetSource& rhs);
DRN_BUDGETING_EXPORT std::ostream& operator<<(std::ostream& o, const BudgetSource& bs);
DRN_BUDGETING_EXPORT ::QString presentationText(const BudgetSource& bs);

}}

#endif
