diff --git a/DocumentOperator.Application/Common/DTOs/PdfAMetadata.cs b/DocumentOperator.Application/Common/DTOs/PdfAMetadata.cs
deleted file mode 100644
index 1b2c3ea..0000000
--- a/DocumentOperator.Application/Common/DTOs/PdfAMetadata.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-namespace DocumentService.Application.Common.DTOs;
-
-///
-/// PDF/A validation metadata including conformance level and validation errors/warnings
-///
-public sealed class PdfAMetadata(
- bool isValid,
- string pdfVersion,
- int pageCount,
- long fileSizeBytes,
- bool encrypted,
- string? pdfaVersion,
- bool pdfaCompliant,
- IReadOnlyList errors,
- IReadOnlyList warnings)
-{
- public bool IsValid { get; } = isValid;
- public string PdfVersion { get; } = pdfVersion;
- public int PageCount { get; } = pageCount;
- public long FileSizeBytes { get; } = fileSizeBytes;
- public bool Encrypted { get; } = encrypted;
- public string? PdfAVersion { get; } = pdfaVersion;
- public bool PdfACompliant { get; } = pdfaCompliant;
- public IReadOnlyList Errors { get; } = errors;
- public IReadOnlyList Warnings { get; } = warnings;
-
- // Computed property
- public double FileSizeMB => FileSizeBytes / 1024.0 / 1024.0;
-
- public override string ToString()
- {
- return $"PDF/A: {PdfAVersion ?? "None"}, {PageCount} pages, {FileSizeMB:F2} MB, Compliant: {PdfACompliant}";
- }
-}
diff --git a/DocumentOperator.Application/Common/DTOs/PdfMetadata.cs b/DocumentOperator.Application/Common/DTOs/PdfMetadata.cs
deleted file mode 100644
index 7f3ebfc..0000000
--- a/DocumentOperator.Application/Common/DTOs/PdfMetadata.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace DocumentService.Application.Common.DTOs;
-
-public sealed class PdfMetadata(
- int pageCount,
- long fileSizeBytes,
- string pdfVersion,
- bool hasAttachments,
- int attachmentCount)
-{
- public int PageCount { get; } = pageCount;
- public long FileSizeBytes { get; } = fileSizeBytes;
- public string PdfVersion { get; } = pdfVersion;
- public bool HasAttachments { get; } = hasAttachments;
- public int AttachmentCount { get; } = attachmentCount;
-
- // Computed Property (berechnet aus FileSizeBytes)
- public double FileSizeMB => FileSizeBytes / 1024.0 / 1024.0;
-
- public override string ToString()
- {
- return $"PDF: {PageCount} pages, {FileSizeMB:F2} MB, Version {PdfVersion}, Attachments: {AttachmentCount}";
- }
-}
\ No newline at end of file
diff --git a/DocumentOperator.Application/Common/DTOs/PdfValidationResult.cs b/DocumentOperator.Application/Common/DTOs/PdfValidationResult.cs
index 1a4f330..a868831 100644
--- a/DocumentOperator.Application/Common/DTOs/PdfValidationResult.cs
+++ b/DocumentOperator.Application/Common/DTOs/PdfValidationResult.cs
@@ -9,10 +9,12 @@ namespace DocumentService.Application.Common.DTOs;
/// PDF-Version (z.B. "1.4")
/// Hat das PDF Anhänge?
/// Anzahl der Anhänge
+/// Ist das PDF passwortgeschützt/verschlüsselt?
public record PdfValidationResult(
int PageCount,
long FileSizeBytes,
double FileSizeMB,
string PdfVersion,
bool HasAttachments,
- int AttachmentCount);
+ int AttachmentCount,
+ bool IsEncrypted);
diff --git a/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs b/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs
index f66644d..d7d4e1d 100644
--- a/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs
+++ b/DocumentOperator.Application/Common/Interfaces/IPdfProcessor.cs
@@ -15,7 +15,7 @@ public interface IPdfProcessor
///
/// Thrown when stream is empty, invalid, or not positioned at the beginning
///
- Task ValidateAsync(Stream pdfStream);
+ Task ValidateAsync(Stream pdfStream);
///
/// Validates a PDF/A document and checks conformance level.
@@ -28,7 +28,7 @@ public interface IPdfProcessor
///
/// Thrown when stream is empty, invalid, or not positioned at the beginning
///
- Task ValidatePdfAAsync(Stream pdfStream);
+ Task ValidatePdfAAsync(Stream pdfStream);
///
/// Checks for embedded files (attachments) in a PDF document and returns detailed metadata.
diff --git a/DocumentOperator.Application/Common/Mapping/MappingProfile.cs b/DocumentOperator.Application/Common/Mapping/MappingProfile.cs
index 97fb0eb..cce5568 100644
--- a/DocumentOperator.Application/Common/Mapping/MappingProfile.cs
+++ b/DocumentOperator.Application/Common/Mapping/MappingProfile.cs
@@ -13,12 +13,6 @@ public class MappingProfile : Profile
{
public MappingProfile()
{
- // PdfMetadata -> PdfValidationResult
- CreateMap();
-
- // PdfAMetadata -> PdfAValidationResult
- CreateMap()
- .ForMember(dest => dest.FileSize, opt => opt.MapFrom(src => src.FileSizeBytes));
// Codecrete Bill -> SwissQrBillDto
CreateMap()
diff --git a/DocumentOperator.Application/ValidatePdf/Queries/ValidatePdfQuery.cs b/DocumentOperator.Application/ValidatePdf/Queries/ValidatePdfQuery.cs
index 22e8935..283831d 100644
--- a/DocumentOperator.Application/ValidatePdf/Queries/ValidatePdfQuery.cs
+++ b/DocumentOperator.Application/ValidatePdf/Queries/ValidatePdfQuery.cs
@@ -1,4 +1,3 @@
-using AutoMapper;
using DocumentService.Application.Common.DTOs;
using DocumentService.Application.Common.Interfaces;
using MediatR;
@@ -18,20 +17,12 @@ public record ValidatePdfQuery : IRequest
///
/// Handler for ValidatePdfQuery
-/// Orchestrates PDF validation using IPdfProcessor and AutoMapper
///
-public class ValidatePdfQueryHandler(IPdfProcessor PdfProcessor, IMapper Mapper)
+public class ValidatePdfQueryHandler(IPdfProcessor pdfProcessor)
: IRequestHandler
{
- ///
- /// Validates PDF and returns metadata
- ///
public async Task Handle(ValidatePdfQuery request, CancellationToken cancellationToken)
{
- // Call DevExpress service directly with stream (exceptions propagate naturally)
- var metadata = await PdfProcessor.ValidateAsync(request.PdfStream);
-
- // Map DTO to response DTO using AutoMapper
- return Mapper.Map(metadata);
+ return await pdfProcessor.ValidateAsync(request.PdfStream);
}
}
diff --git a/DocumentOperator.Application/ValidatePdfA/Queries/ValidatePdfAQuery.cs b/DocumentOperator.Application/ValidatePdfA/Queries/ValidatePdfAQuery.cs
index 002d905..51e09d4 100644
--- a/DocumentOperator.Application/ValidatePdfA/Queries/ValidatePdfAQuery.cs
+++ b/DocumentOperator.Application/ValidatePdfA/Queries/ValidatePdfAQuery.cs
@@ -1,4 +1,3 @@
-using AutoMapper;
using DocumentService.Application.Common.DTOs;
using DocumentService.Application.Common.Interfaces;
using MediatR;
@@ -18,20 +17,12 @@ public record ValidatePdfAQuery : IRequest
///
/// Handler for ValidatePdfAQuery
-/// Orchestrates PDF/A validation using IPdfProcessor and AutoMapper
///
-public class ValidatePdfAQueryHandler(IPdfProcessor PdfProcessor, IMapper Mapper)
+public class ValidatePdfAQueryHandler(IPdfProcessor pdfProcessor)
: IRequestHandler
{
- ///
- /// Validates PDF/A and returns metadata with conformance level
- ///
public async Task Handle(ValidatePdfAQuery request, CancellationToken cancellationToken)
{
- // Call DevExpress service directly with stream (exceptions propagate naturally)
- var metadata = await PdfProcessor.ValidatePdfAAsync(request.PdfStream);
-
- // Map DTO to response DTO using AutoMapper
- return Mapper.Map(metadata);
+ return await pdfProcessor.ValidatePdfAAsync(request.PdfStream);
}
}