namespace DocumentService.Client.Interfaces;
///
/// Client for ZUGFeRD operations (detection, extraction).
///
public interface IZugferdClient
{
///
/// Checks whether a PDF contains a ZUGFeRD XML attachment (multipart).
///
/// PDF file stream
/// Cancellation token
/// ZUGFeRD check result
Task HasZugferdAsync(Stream pdfStream, CancellationToken cancellationToken = default);
///
/// Checks whether a PDF contains a ZUGFeRD XML attachment (Base64).
///
/// PDF file as byte array
/// Cancellation token
/// ZUGFeRD check result
Task HasZugferdAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
///
/// Extracts the ZUGFeRD XML from a PDF and returns the raw XML stream (multipart).
///
/// PDF file stream
/// Cancellation token
/// ZUGFeRD XML content as stream
Task ExtractZugferdAsync(Stream pdfStream, CancellationToken cancellationToken = default);
///
/// Extracts the ZUGFeRD XML from a PDF and returns the raw XML stream (Base64).
///
/// PDF file as byte array
/// Cancellation token
/// ZUGFeRD XML content as stream
Task ExtractZugferdAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
///
/// Extracts ZUGFeRD metadata and XML content as a structured result (multipart).
///
/// PDF file stream
/// Cancellation token
/// Structured ZUGFeRD extraction result
Task ExtractZugferdAsResultAsync(Stream pdfStream, CancellationToken cancellationToken = default);
///
/// Extracts ZUGFeRD metadata and XML content as a structured result (Base64).
///
/// PDF file as byte array
/// Cancellation token
/// Structured ZUGFeRD extraction result
Task ExtractZugferdAsResultAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
}
/// DTO for ZUGFeRD detection result
public record ZugferdCheckResult
{
/// Whether the document contains a ZUGFeRD XML attachment.
public bool HasZugferd { get; init; }
/// Detected ZUGFeRD version (e.g. "2.1"), or null if not present.
public string? Version { get; init; }
/// ZUGFeRD profile name (e.g. "EN 16931"), or null if not present.
public string? Profile { get; init; }
}
/// DTO for ZUGFeRD extraction result
public record ZugferdExtractionResult
{
/// File name of the extracted XML attachment (e.g. "factur-x.xml").
public string FileName { get; init; } = string.Empty;
/// Full XML content of the ZUGFeRD attachment.
public string XmlContent { get; init; } = string.Empty;
/// ZUGFeRD version (e.g. "2.1"), or null if not detected.
public string? Version { get; init; }
/// ZUGFeRD profile name (e.g. "EN 16931"), or null if not detected.
public string? Profile { get; init; }
}