#pragma once

#include <string>

#include <QPixmap>
#include <QString>
#include <QWidget>

#include "SelectionContext.h"

class QLabel;

// One buffered item: its icon, its count in a larger type, and a sub-line beneath the
// count (REQ-UI-SINGLE-SELECTION). Boxed so a row of them reads as separate quantities
// rather than as a run of text.
//
// Hovering or clicking it explains where its item comes from (REQ-UI-ITEM-TOOLTIP).
class ItemChip : public QWidget
{
    Q_OBJECT

public:
    // An empty icon leaves the icon off and the chip laid out around the text alone.
    ItemChip(const SelectionContext& context, const std::string& itemId,
             const QPixmap& icon, QWidget* parent = nullptr);

    void setCount(const QString& count);
    // Left empty for an item with nothing to say beneath its count.
    void setSubLine(const QString& subLine);

private:
    QLabel* m_iconLabel;
    QLabel* m_countLabel;
    QLabel* m_subLineLabel;
};
