using DocumentService.Application.Common.DTOs; using DocumentService.Client.Models.Results; namespace DocumentService.Client.Interfaces; /// /// Orchestrated multi-step workflows that combine multiple DocumentService operations into /// a single, higher-level call. Prefer these over manually chaining individual clients. /// public interface IWorkflowsClient { /// /// Validates the PDF and attempts Swiss QR Code extraction in a single call, /// returning both results together. The method never throws on invalid documents – /// the caller receives the full regardless of outcome, /// enabling detailed logging, diagnostics, or batch processing without try/catch. /// /// PDF file as byte array. /// /// false (default) – returns a parsed object.
/// true – returns raw QR text lines without parsing. /// /// Cancellation token. /// /// A containing the /// (always populated) and the (null if the /// document was invalid). /// Task InspectSwissQrCodeAsync( byte[] pdfBytes, bool raw = false, CancellationToken cancellationToken = default); /// /// PDF file as a stream. /// /// Cancellation token. Task InspectSwissQrCodeAsync( Stream pdfStream, bool raw = false, CancellationToken cancellationToken = default); } /// /// Convenience extensions for that accept a file path as input. /// Defined alongside so they are discoverable without an additional using directive. /// public static class WorkflowsClientExtensions { /// /// Validates the PDF at and attempts Swiss QR Code extraction /// in a single call. Opens a and delegates to /// . /// /// The workflows client. /// Absolute or relative path to the PDF file. /// /// false (default) – returns a parsed Bill object.
/// true – returns raw QR text lines without parsing. /// /// Cancellation token. public static async Task InspectSwissQrCodeAsync( this IWorkflowsClient client, string filePath, bool raw = false, CancellationToken cancellationToken = default) { using var stream = File.OpenRead(filePath); return await client.InspectSwissQrCodeAsync(stream, raw, cancellationToken); } }