using w4c_workflows.Models.Nodes;
namespace w4c_workflows.Services.Nodes.Binary;
// ---------------------------------------------------------------------------
// Binary payloads never travel inline through the item graph: a FlowItem only
// holds a BinaryAttachment reference, and the bytes live in a store reached
// through this interface. That keeps run history small, lets large downloads
// stream to disk instead of item JSON, and leaves the concrete backing store
// swappable (local volume today, the product asset service later).
// ---------------------------------------------------------------------------
///
/// Persists and retrieves binary payloads by an opaque, content-addressed id.
/// Implementations must be safe to call concurrently and must reject ids that
/// do not belong to them.
///
public interface IBinaryStore
{
///
/// Stores and returns a reference to it. The same
/// bytes stored twice yield the same ,
/// so repeated downloads do not duplicate the payload.
///
Task SaveAsync(
Stream content,
string? fileName,
string? mimeType,
CancellationToken ct = default);
///
/// Opens a stored payload for reading. Returns null when the asset is
/// unknown or the id is malformed; the caller decides whether that is fatal.
///
Task OpenAsync(string assetId, CancellationToken ct = default);
///
/// Reads an asset's metadata without opening the payload, or null when
/// it is unknown.
///
Task DescribeAsync(string assetId, CancellationToken ct = default);
}