#pragma once

#include <vector>

#include <QPixmap>

#include "entt/entity/entity.hpp"

#include "SelectionContent.h"
#include "SelectionContentFactory.h"

class StatRow;

// The count summary for a field selection holding more than one object that does not
// aggregate (REQ-UI-FIELD-MULTI-SELECTION): several actors, or actors together with
// debris. A count per type, and the debris' summed scrap when debris is part of it.
class FieldMultiContent : public SelectionContent
{
    Q_OBJECT

public:
    FieldMultiContent(const SelectionContext& context, const SelectionRequest& request,
                      QWidget* parent = nullptr);

protected:
    void refreshRuntime() override;

private:
    void buildSummary(const std::vector<entt::entity>& actors);

    std::vector<entt::entity> m_debris;
    // Null unless debris is part of the selection; the only value here that changes
    // while the selection stands.
    StatRow*                  m_scrapRow;
    // The bare scrap icon the sub-row states its total with, or null where there is no
    // icon file and the total names the item in words instead (REQ-UI-DEBRIS-PANEL).
    QPixmap                   m_scrapIcon;
};
