// SPDX-FileCopyrightText: 2026 Melvin Keskin <melvo@olomono.de>
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

// Kaidan
#include "Account.h"

// Qt
class QQuickItem;
class QPixmap;

using ChatJid = QString;
using Avatar = QPixmap;

/**
 * Caches avatars generated by QML and used for notifications.
 */
class AvatarCache : public QObject
{
    Q_OBJECT

public:
    explicit AvatarCache(AccountSettings *accountSettings, QObject *parent = nullptr);

    QPixmap avatar(const QString &chatJid);
    Q_INVOKABLE void addAvatar(const QString &chatJid, QQuickItem *avatarItem);
    void removeAvatar(const QString &accountJid, const QString &chatJid);

private:
    AccountSettings *const m_accountSettings;

    QHash<ChatJid, Avatar> m_avatars;
};
