// SPDX-FileCopyrightText: 2021 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef DETAILSPACEHELPER_H
#define DETAILSPACEHELPER_H

#include "dfmplugin_detailspace_global.h"

#include <dfm-base/widgets/filemanagerwindowsmanager.h>
#include <dfm-base/widgets/filemanagerwindow.h>

#include <QMap>
#include <QUrl>
#include <QMutex>
#include <QEasingCurve>

namespace dfmplugin_detailspace {

class DetailSpaceWidget;
class DetailSpaceHelper
{
public:
    static DetailSpaceWidget *findDetailSpaceByWindowId(quint64 windowId);
    static quint64 findWindowIdByDetailSpace(DetailSpaceWidget *widget);
    static void addDetailSpace(quint64 windowId);
    static void removeDetailSpace(quint64 windowId);
    static void showDetailView(quint64 windowId, bool checked, bool userAction = true);
    static void setDetailViewSelectFileUrl(quint64 windowId, const QUrl &url);
    static void setDetailViewByUrl(DetailSpaceWidget *w, const QUrl &url);

private:
    static QMutex &mutex();
    static QMap<quint64, DetailSpaceWidget *> kDetailSpaceMap;
    static void updateWorkspaceWidth(quint64 windowId, DetailSpaceWidget *widget, bool show, int targetWidth);
};

}   // namespace dfmplugin_detailspace

#endif   // DETAILSPACEHELPER_H
