/**********************************************************************
 * LeechCraft - modular cross-platform feature rich internet client.
 * Copyright (C) 2006-2014  Georg Rudoy
 *
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
 **********************************************************************/

#pragma once

#include <QStandardItemModel>
#include <interfaces/core/ihookproxy.h>

namespace LC::Azoth
{
	class CLTooltipManager;

	class CLModel : public QStandardItemModel
	{
		Q_OBJECT

		CLTooltipManager * const TooltipManager_;
	public:
		explicit CLModel (CLTooltipManager*, QObject* = nullptr);

		QVariant data (const QModelIndex&, int) const override;

		QStringList mimeTypes () const override;
		QMimeData* mimeData (const QModelIndexList&) const override;
		bool dropMimeData (const QMimeData*, Qt::DropAction, int, int, const QModelIndex&) override;
		Qt::DropActions supportedDropActions () const override;
	private:
		void CheckRequestUpdateTooltip (const QModelIndex&, int) const;

		bool PerformHooks (const QMimeData*, int, const QModelIndex&);
		bool CheckHookDnDEntry2Entry (const QMimeData*, int, const QModelIndex&);

		bool TryInvite (const QMimeData*, int, const QModelIndex&);
		bool TryDropContact (const QMimeData*, int, const QModelIndex&);
		bool TryDropFile (const QMimeData*, const QModelIndex&);
	signals:
		void hookDnDEntry2Entry (LC::IHookProxy_ptr,
				QObject*, QObject*);
		void rebuiltTooltip ();
	};
}
