/*
   SPDX-FileCopyrightText: 2020-2022 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#pragma once

#include "libruqolawidgets_export.h"
#include <QLabel>
#include <QWidget>

class LIBRUQOLAWIDGETS_EXPORT ClickableLabel : public QLabel
{
    Q_OBJECT
public:
    explicit ClickableLabel(QWidget *parent = nullptr);
    ~ClickableLabel() override;

Q_SIGNALS:
    void clicked();

protected:
    void mousePressEvent(QMouseEvent *event) override;
};

class LIBRUQOLAWIDGETS_EXPORT ClickableWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ClickableWidget(const QString &userName, QWidget *parent = nullptr);
    ~ClickableWidget() override;

    Q_REQUIRED_RESULT QString name() const;
    void setName(const QString &userName);

    Q_REQUIRED_RESULT QString identifier() const;
    void setIdentifier(const QString &userId);

Q_SIGNALS:
    void removeClickableWidget(const QString &username);

private:
    void slotRemove();
    QString mName;
    QString mIdentifier;
    QLabel *const mLabel;
    ClickableLabel *const mClickableLabel;
};
