namespace MS.Microservice.Core.IO;
/// Immutable file writes and retrieval by canonical generated keys; callers own authorization.
public interface IFileStorage
{
/// Writes the entire remaining stream under a caller-created key, without replacing an existing file.
Task WriteNewAsync(string key, Stream content, CancellationToken cancellationToken = default);
/// Returns a stream owned by the caller; a missing file throws FileNotFoundException.
Task OpenReadAsync(string key, CancellationToken cancellationToken = default);
Task GetMetadataAsync(string key, CancellationToken cancellationToken = default);
/// Deletes the current file; absence succeeds. Cancellation does not undo a completed deletion.
Task DeleteAsync(string key, CancellationToken cancellationToken = default);
}
public sealed record StoredFileMetadata(string Key, long Length, DateTimeOffset LastModifiedUtc);