#ifndef STORYCONCEPTSPRESENT_H
#define STORYCONCEPTSPRESENT_H

#include "DocsManager.h"
#include "appcore.h"
#include "tools.h"
#include <libParse.h>

#include <QObject>
#include <QTextBrowser>
#include <QTreeView>
#include <QWidget>

namespace DataModel {

    class StoryconceptsPresentModel : public Schedule::AccessibleObject {
      public:
        StoryconceptsPresentModel(Core::AppCore *core);
        virtual ~StoryconceptsPresentModel();

        QStandardItemModel *treeModel() const;
        QTextDocument *detailsBackend() const;

        void refreshTree();
        void detailsShow(const QList<QString> &path);

        // AccessibleObject interface
      public:
        virtual QString name() const override;

      private:
        Core::AppCore *const core_ins;
        QStandardItemModel *const model_base;
        QTextDocument *const detail_backend;
        Tools::TreeSyncs<Parse::Result::DesNode *> *concept_model;
    };

} // namespace DataModel

namespace Components {
    class StoryconceptsPresent : public QWidget, public MakeTools::PresentBase {
      public:
        StoryconceptsPresent(Schedule::CommandsDispatcher *core, DataModel::StoryconceptsPresentModel *backend, QWidget *parent = nullptr);

      private:
        Schedule::CommandsDispatcher *const core_ins;
        QTreeView *const tree_view;
        QTextBrowser *const details_view;

        void show_details(const QModelIndex &curr);
        void jump_to(const QModelIndex &curr);

        // PresentBase interface
      public:
        virtual QWidget *widget() const override;
        virtual QString name() const override;
    };
} // namespace Components

#endif // STORYCONCEPTSPRESENT_H
