Repository Interfaces (Clean Architecture - Application Layer): - IRepository<T>: Base repository interface with common CRUD operations - IEmailAccountRepository: Email account operations (GetActive, GetByName, GetWithProfiles) - IEmailProfileRepository: Profile operations (GetActive, GetDueForPolling, GetWithRelated) - IEmailProcessRepository: Process operations (GetWithSteps, GetByType) - IEmailHistoryRepository: History operations (pagination, duplicate detection, date range queries) - IEmailOutboxRepository: Outbox operations (GetPending, GetForRetry, MarkAsSent/Failed) - IUnitOfWork: Transaction management and repository aggregation Service Interfaces (Abstraction for Infrastructure): - IEmailService: IMAP/SMTP operations with OAuth2 support (MailKit wrapper) - IPdfProcessingService: PDF validation, embedded file extraction, ZUGFeRD support - IDmsService: windream DMS integration (archive, search, update index fields) - IEncryptionService: Data protection for passwords and OAuth tokens - IEmailQueue: Async email queue (in-memory Channel, future: RabbitMQ) Dependencies: - Added MimeKit 4.17.0 for email service interface definitions All interfaces follow Clean Architecture principles: - Interfaces in Application layer - Implementations will be in Infrastructure layer
60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
namespace DigitalData.EmailProfiler.Application.Interfaces.Services;
|
|
|
|
/// <summary>
|
|
/// PDF processing service interface for validation and embedded file extraction.
|
|
/// </summary>
|
|
public interface IPdfProcessingService
|
|
{
|
|
/// <summary>
|
|
/// Validate if file is a valid PDF.
|
|
/// </summary>
|
|
Task<bool> IsValidPdfAsync(string filePath, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Validate if stream contains a valid PDF.
|
|
/// </summary>
|
|
Task<bool> IsValidPdfAsync(Stream stream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extract embedded files from PDF (e.g., ZUGFeRD XML).
|
|
/// </summary>
|
|
Task<IEnumerable<EmbeddedFile>> ExtractEmbeddedFilesAsync(string pdfPath, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extract embedded files from PDF stream.
|
|
/// </summary>
|
|
Task<IEnumerable<EmbeddedFile>> ExtractEmbeddedFilesAsync(Stream pdfStream, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Check if PDF contains ZUGFeRD data.
|
|
/// </summary>
|
|
Task<bool> HasZugFeRDDataAsync(string pdfPath, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extract ZUGFeRD XML from PDF.
|
|
/// </summary>
|
|
Task<string?> ExtractZugFeRDXmlAsync(string pdfPath, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Get PDF metadata (title, author, creation date, etc.).
|
|
/// </summary>
|
|
Task<PdfMetadata> GetMetadataAsync(string pdfPath, CancellationToken cancellationToken = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents an embedded file extracted from a PDF.
|
|
/// </summary>
|
|
public record EmbeddedFile(string FileName, byte[] Content, string? Description = null);
|
|
|
|
/// <summary>
|
|
/// Represents PDF metadata.
|
|
/// </summary>
|
|
public record PdfMetadata(
|
|
string? Title,
|
|
string? Author,
|
|
string? Subject,
|
|
string? Keywords,
|
|
DateTime? CreationDate,
|
|
DateTime? ModificationDate,
|
|
int PageCount);
|