/**********************************************************************
 * 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 <QObject>
#include <interfaces/azoth/iclentry.h>
#include "types.h"

namespace LC::Azoth::Sarin
{
	class ToxAccount;
	class ChatMessage;

	class ToxContact : public QObject
					 , public ICLEntry
	{
		Q_OBJECT
		Q_INTERFACES (LC::Azoth::ICLEntry)

		const Pubkey Pubkey_;
		const QString EntryId_;
		ToxAccount * const Acc_;

		QList<ChatMessage*> AllMessages_;

		QString PublicName_;

		EntryStatus Status_;
	public:
		ToxContact (Pubkey pubkey, ToxAccount *account);

		Pubkey GetPubKey () const;

		QObject* GetQObject () override;
		IAccount* GetParentAccount () const override;
		Features GetEntryFeatures () const override;
		EntryType GetEntryType () const override;

		QString GetEntryName () const override;
		void SetEntryName (const QString&) override;
		QString GetEntryID () const override;
		QString GetHumanReadableID () const override;
		QStringList Groups () const override;
		void SetGroups (const QStringList&) override;

		QStringList Variants () const override;

		void SendMessage (const OutgoingMessage&) override;
		QList<IMessage*> GetAllMessages () const override;
		void PurgeMessages (const QDateTime&) override;

		void SetChatPartState (ChatPartState, const QString&) override;

		EntryStatus GetStatus (const QString&) const override;
		void ShowInfo () override;
		QList<QAction*> GetActions () const override;
		QMap<QString, QVariant> GetClientInfo (const QString&) const override;

		void MarkMsgsRead () override;
		void ChatTabClosed () override;

		void SetStatus (const EntryStatus&);
		void SetTyping (bool);

		void HandleMessage (ChatMessage*);
	};
}
