#ifndef VERSIONSELECTWIDGET_H
#define VERSIONSELECTWIDGET_H

#include <QListWidget>
#include <QWidget>

#include <Core/sendsystem.h>
#include <Core/versioncontainer.h>
#include <Core/notifycontroller.h>
#include <streamingversiondata.h>
#include <Widgets/newversionwidget.h>
#include <widgets/waitanimationwidget.h>

#include "recognizesystem.h"

namespace Ui {
class VersionSelectWidget;
}

class VersionSelectWidget : public QWidget
{
    Q_OBJECT

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

    void initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController, RecognizeSystem *recognizeSystem);
    void fillView(QList<StreamingVersionData*> *serverData);
    void sendCopyEmit(QString newName);
    void setAuthor(QString name);

public:
    void resizeEvent(QResizeEvent *event) override;

private slots:
    void on_createDuplicateButton_clicked();
    void on_DeleteVersionButton_clicked();
    void on_switchServerVersionButton_clicked();
    void on_verListView_itemClicked(QListWidgetItem *item);
    void slot_activateLoadAnimation(bool flag);

signals:
    void sigSendDeleteVersion(StreamingVersionData *streaming);
    void sigSendSwitchVersion(StreamingVersionData *selectVersion);
    void sigSendCopyVersion(QString versionPair);
    void sigSendNotify(QString message);

private:

    Ui::VersionSelectWidget *ui;
    SendSystem *sendSystem;
    QList<StreamingVersionData*> *serverDataList;
    VersionContainer *versionContainer;
    NotifyController *notifyController;
    StreamingVersionData *selectedVersion;
    WaitAnimationWidget *waitAnimationWidget;
    RecognizeSystem *recognizeSystem;

    QString authorName;
    QString changableText(bool flag);
};

#endif // VERSIONSELECTWIDGET_H
