#pragma once

#include <QSqlDatabase>
#include <QString>
#include <QMap>
#include <QMutex>
#include <QSet>

class DatabaseManager {
public:
    static DatabaseManager& instance();

    QSqlDatabase database();
    void closeConnection();

private:
    DatabaseManager();
    ~DatabaseManager();

    static QString connectionName();

    QMutex mutex;
    QSet<QString> activeConnections;
    QMap<QString, QSqlDatabase> connectionPool;
};