using SeaHaven.DataServices.Interfaces; namespace SeaHaven.Services.Helpers { public static class WorkOrderUpliftEvidenceAssociation { public static IReadOnlyList Normalize(int? single, IEnumerable? many) { var ids = new List(); if (single is int one && one > 0) ids.Add(one); if (many == null) return ids; foreach (var id in many) { if (id > 0 && !ids.Contains(id)) ids.Add(id); } return ids; } public static async Task RequirePassedAsync( IVendorDocumentDataService documents, IReadOnlyList documentIds, int dispatchId, int vendorId, CancellationToken cancellationToken) { foreach (var documentId in documentIds) { var evidence = await documents.GetUpliftEvidenceAsync( documentId, dispatchId, vendorId, cancellationToken); if (evidence == null) { throw new InvalidOperationException( "The selected evidence document is not available or has not passed scanning"); } } } } }