#ifndef FORMPROJECT_H
#define FORMPROJECT_H

#include <QMainWindow>
#include <QDate>
#include "projectdao.h"

namespace Ui {
class formProject;
}

class formProject : public QMainWindow
{
    Q_OBJECT

public:
    explicit formProject(QWidget *parent = nullptr);
    ~formProject();

    void loadProject(const QString &code);
    void setNewMode();

signals:
    void projectSaved();

private slots:
    void saveProject();
    void onStateChanged(int index);
    void addDocument();
    void removeDocument();
    void addBudgetLine();
    void removeBudgetLine();
    void refreshDocuments();
    void refreshBudget();
    void refreshFinancialSummary();

private:
    Ui::formProject *ui;
    Project m_project;
    bool m_isNew;

    void populateForm();
    void readForm();
    void clearForm();
    void setupConnections();
};

#endif // FORMPROJECT_H