#pragma once

#include <vector>

#include <QWidget>

#include "BuildingId.h"
#include "SelectionContext.h"

// The "Clear stuck items" action of the card's runtime group (REQ-UI-BELT-CLEAR): it
// removes every item from the selected belt, splitter and tunnel tiles, which is how a
// stalled line is resolved.
//
// It acts on the whole selection rather than on one tile, which is why a selection of
// belts and tunnel ends aggregates into a single card instead of a count summary
// (REQ-UI-SELECTION-AGGREGATE), and why the count summary shows the action too when a
// belt is among the selected buildings.
class ClearBeltControl : public QWidget
{
    Q_OBJECT

public:
    ClearBeltControl(const SelectionContext& context,
                     const std::vector<BuildingId>& ids, QWidget* parent = nullptr);

private:
    void clearSelectedTiles() const;

    SelectionContext        m_context;
    std::vector<BuildingId> m_ids;
};
