#ifndef ASSETSMANAGER_H
#define ASSETSMANAGER_H

#include <QObject>
#include <Systems/updatecontroller.h>
#include <Data/StreamingVersionData.h>


class AssetsManager : public QObject
{
    Q_OBJECT
public:
    explicit AssetsManager(QObject *parent = nullptr);
    void initialize(UpdateController* updateContoller,DataParser *dataParser);
    void addVersion(StreamingVersionData *data);
    void createCopyVersion(QString versionName,QString newName,QString author);
    void deleteVersion(QString version);
    void setVersionList(QList<StreamingVersionData *> *streamingVersion);
    bool findDuplicate(QString name);
    void createFirstVersionListXML(QList<StreamingVersionData*> assets);
    QString setVersion(QString versionName);

    QList<FileData> *prepareLocalPathList(QList<FileData>*fileData);
    QList<FileData> *prepareRealPathList(QList<FileData> *fileData);
    QList<FileData> *getRealPathList();

    ~AssetsManager();

    StreamingVersionData *getCurrentVersionData() const;

    void saveVersionToFile(StreamingVersionData *streamingVersion);
    void writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst);

signals:
    void sigSaveVersion(StreamingVersionData *versionData);

private:
    UpdateController *updateController;
    QList<StreamingVersionData*> *datas;
    StreamingVersionData* currentVersionData;

    void copyAllRecurse(QString source, QString destination);
    void fillDatas();
};

#endif // ASSETSMANAGER_H
