PolicyDocumentExtensions¶
Provides extension methods that convert the internal PolicyDocument data model into the PolicyDocumentModel view/contract shape consumed by PolicyDocumentsApiService, deriving derived flags (invoice/payroll-report detection, packet ID) from the document's description and type fields.
Purpose¶
- Converts a single
PolicyDocumentinto aPolicyDocumentModel, including a nestedDocumentCategoryand derivedIsInvoice/IsPayrollReportflags based on the document's description text. - Converts a collection of
PolicyDocumentinstances into theirPolicyDocumentModelequivalents in bulk.
Context¶
- Namespace:
SAIF.Services.Policies.PolicyDocumentsApi - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ToDocumentModels | public static IEnumerable<PolicyDocumentModel> ToDocumentModels(this IEnumerable<PolicyDocument> documents) |
Maps each document in the sequence to a PolicyDocumentModel via ToDocumentModel and returns the resulting collection. |
| ToDocumentModel | public static PolicyDocumentModel ToDocumentModel(this PolicyDocument document) |
Builds a PolicyDocumentModel from the document's ID, packet flag, description, document date, policy-period effective date, and a DocumentCategory built from the document type; sets PacketId only for packet documents, and flags IsInvoice/IsPayrollReport by case-insensitive comparison of the description against "INVOICE"/"PAYROLL REPORT". |
Behavioral notes¶
ToDocumentModelthrowsArgumentNullExceptionifdocumentisnull.IsInvoiceandIsPayrollReportare determined purely by exact (uppercased) string match ondocument.Description, not by a document-type code.*
Constraints and usage notes¶
PacketIdis populated only whendocument.IsPacketistrue; non-packet documents get an empty string.
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Policies/PolicyDocumentsApi/PolicyDocumentsApiService.cs