#ifndef PROJECTPARAMTABLEMODEL_H
#define PROJECTPARAMTABLEMODEL_H

#include <QAbstractTableModel>
#include <QObject>
#include <QVariant>
#include <QModelIndex>
#include <Qt>
#include <QList>
#include <QString>

struct ProjectParamTableData {
    int id;
    QString name;
    QString value;
};

class ProjectParamTableModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit ProjectParamTableModel(QObject *parent = nullptr);

    // Обязательные методы QAbstractTableModel
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
    Qt::ItemFlags flags(const QModelIndex &index) const override;

                // Методы для управления данными
            void setProjectParams(const QList<ProjectParamTableData> &params);
            void addProjectParam(const ProjectParamTableData &param);
            void removeProjectParam(int row);
            void clear();
            ProjectParamTableData getProjectParam(int row) const;
            QList<ProjectParamTableData> getData() const;
            QMap<QString, QString> getDataAsMap() const;

        private:
            QList<ProjectParamTableData> m_data;
};

#endif // PROJECTPARAMTABLEMODEL_H 