using DocumentService.Client.Models.Requests;
namespace DocumentService.Client.Interfaces;
///
/// Client for PDF attachment operations (check, extract, add).
///
public interface IPdfAttachmentClient
{
///
/// Checks if PDF contains attachments (multipart).
///
/// PDF file stream
/// Cancellation token
/// Attachment check result with metadata
Task CheckAttachmentsAsync(Stream pdfStream, CancellationToken cancellationToken = default);
///
/// Checks if PDF contains attachments (Base64).
///
/// PDF file as byte array
/// Cancellation token
/// Attachment check result with metadata
Task CheckAttachmentsAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
///
/// Extracts all embedded attachments from a PDF (multipart).
/// The returned dictionary maps each file name to its decompressed content stream.
///
/// PDF file stream
/// Cancellation token
/// Dictionary of file name ? content stream for each extracted attachment
Task> ExtractAttachmentsAsync(Stream pdfStream, CancellationToken cancellationToken = default);
///
/// Extracts all embedded attachments from a PDF (Base64).
/// The returned dictionary maps each file name to its decompressed content stream.
///
/// PDF file as byte array
/// Cancellation token
/// Dictionary of file name ? content stream for each extracted attachment
Task> ExtractAttachmentsAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
///
/// Adds attachments to PDF (multipart). ?? Not implemented yet in API.
///
/// PDF file stream
/// Attachments to add
/// Cancellation token
/// Modified PDF as stream
[Obsolete("API endpoint not implemented yet")]
Task AddAttachmentsAsync(Stream pdfStream, List attachments, CancellationToken cancellationToken = default);
///
/// Adds attachments to PDF (Base64). ?? Not implemented yet in API.
///
/// PDF file as byte array
/// Attachments to add
/// Cancellation token
/// Modified PDF as stream
[Obsolete("API endpoint not implemented yet")]
Task AddAttachmentsAsync(byte[] pdfBytes, List attachments, CancellationToken cancellationToken = default);
}
///
/// DTO for attachment check result
///
public record AttachmentCheckResult
{
/// Whether the document contains any embedded file attachments.
public bool HasAttachments { get; init; }
/// Number of embedded file attachments found.
public int AttachmentCount { get; init; }
/// Metadata for each attachment found in the document.
public List Attachments { get; init; } = new();
}
///
/// DTO for attachment metadata
///
public record AttachmentMetadata
{
/// Name of the embedded file.
public string FileName { get; init; } = string.Empty;
/// MIME type of the embedded file (e.g. "application/xml"), or null if unknown.
public string? MimeType { get; init; }
/// Size of the embedded file in bytes.
public long Size { get; init; }
}