namespace ERPCore.Infra.Storage;

/// <summary>
/// File storage abstraction (docs/12-BACKEND-HRM.md A.1, C.10) — the first
/// attachment mechanism in this codebase. <see cref="LocalFileStorageService"/> is
/// the only implementation today; swapping to cloud blob storage later means
/// adding a new implementation + one DI registration change, no controller/service
/// change. Never exposes a path the client can dictate — callers pass only a
/// suggested filename, and get back a server-generated one.
/// </summary>
public interface IFileStorageService
{
    /// <summary>Saves the stream under a server-generated name; returns the stored name, its relative path, and size.</summary>
    Task<(string StoredFileName, string RelativePath, long SizeBytes)> SaveAsync(
        Stream content, string suggestedFileName, string contentType, CancellationToken ct = default);

    Task<Stream> OpenReadAsync(string relativePath, CancellationToken ct = default);

    Task DeleteAsync(string relativePath, CancellationToken ct = default);

    Task<bool> ExistsAsync(string relativePath, CancellationToken ct = default);
}
