/*******************************************************************************
***  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_DESKTOP_UI_INTERNAL_MONTHLYTOTALSWIDGET_H
#define DRN_DESKTOP_UI_INTERNAL_MONTHLYTOTALSWIDGET_H

#include <QWidget>

#include <foundation/ObserverPtr.hpp>
#include <ui_MonthlyTotalsWidget.h>


namespace pecunia
{
namespace currency
{

enum class Iso4217Codes : quint16;

}}

namespace drn
{
namespace budgeting
{

struct BudgetTotals;
enum class BudgetItemTypes : quint8;

}
namespace desktop_ui
{
namespace internal
{

class MonthlyTotalsWidget : public QWidget, Ui::MonthlyTotalsWdgt
{
	Q_OBJECT

	static const int wageTotalIndex_;
	static const int goalsTotalIndex_;
	static const int billsTotalIndex_;
	static const int debtsTotalIndex_;
	static const int nontrackIndex_;

signals:
	void selectedBudgetType(const budgeting::BudgetItemTypes& type);

private slots:
	void onItemDoubleClicked(foundation::ObserverPtr<QTableWidgetItem> item);

public:
	explicit MonthlyTotalsWidget(const foundation::ObserverPtr<::QWidget>& parent = nullptr);
	void updateTotals(
		const budgeting::BudgetTotals& bt,
		const pecunia::currency::Iso4217Codes& preferred
	);
};

}}}

#endif
