#pragma once

#include <vector>

#include <QPoint>

#include "Rotation.h"

// One tile of a belt drag-placement path: the tile coordinate and the belt
// orientation it should be given (REQ-BLD-BELT-DRAG).
struct BeltPathTile
{
    QPoint   tile;
    Rotation rotation;
};

// Computes the rectilinear (L-shaped) belt path from `anchor` to `cursor` for a
// belt whose current orientation is `orientation` (REQ-BLD-BELT-DRAG). The path
// first runs along the axis parallel to `orientation` (horizontal for East/West,
// vertical for North/South), stepping toward the cursor's coordinate on that axis
// to the corner tile, then runs along the orthogonal axis to the cursor tile. Each
// tile is oriented to point toward the next tile along the path; the final tile
// keeps the direction of its incoming step, and a single-tile path keeps
// `orientation`. Returned tiles are ordered from anchor to cursor with no duplicate
// corner tile.
std::vector<BeltPathTile> computeBeltDragPath(QPoint anchor, QPoint cursor,
                                              Rotation orientation);
