Skip to content

PacketDefinition

PacketDefinition describes one packeting rule — a code, description, and set of eligibility/grouping requirements (primary/secondary document codes, minimum document count, market type, relationship and effective-date constraints) — that PacketGenerator evaluates against a group of documents. GetPacketDefinitions supplies the full, hard-coded catalog of roughly 38 definitions (PKT001–PKT038) that drive OP-DOM-19's packeting behaviour (DOM-BR-202, DOM-BR-203).

Purpose

  • Validates and captures a packet definition's code, description, and optional primary/secondary document type codes, included document codes, and market type, applying sensible defaults (minimum document count 2, RequiresPeriod and RequiresSamePolicyPeriodEffDate both true, all other requirement flags false) when a constructor overload omits them.
  • Supplies, via GetPacketDefinitions, the complete catalog of packet definitions the business has configured, each expressing a specific document-bundling policy (e.g., new-business issuance, renewal issuance, reinstatement) (DOM-BR-203).
  • Resolves a single definition from that catalog by its code via GetPacketDefinition, used by PacketManager.GetDocumentsForPacket.

Context

  • Namespace: SAIF.Domain.Tasks.Documents.Packets
  • Assembly/package: SAIF.Domain (packaged in SAIF.SAIFCode.Core)
  • Nine public constructor overloads exist to let callers supply only the fields relevant to a given definition; all funnel through the same validation and default-setting helpers.

Public members

Member Signature Purpose
PacketDefinition (code, description, includedDocCodes, marketTypeCode) public PacketDefinition(string code, string description, IList<string> includedDocCodes, string marketTypeCode) Defines a packet with no primary/secondary document requirement, scoped to includedDocCodes and marketTypeCode.
PacketDefinition (code, description, primary, secondary, includedDocCodes, marketTypeCode) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode, string secondaryOutputDocumentTypeCode, IList<string> includedDocCodes, string marketTypeCode) Defines a packet requiring both a primary and secondary document type, scoped to includedDocCodes and marketTypeCode.
PacketDefinition (code, description, primary, secondary, includedDocCodes) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode, string secondaryOutputDocumentTypeCode, IList<string> includedDocCodes) The same as the six-argument overload but without a market-type restriction.
PacketDefinition (code, description, primary, secondary) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode, string secondaryOutputDocumentTypeCode) Defines a packet requiring both a primary and secondary document type, with no included-document-code or market-type restriction.
PacketDefinition (code, description, primary, secondary, marketTypeCode) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode, string secondaryOutputDocumentTypeCode, string marketTypeCode) Defines a packet requiring both a primary and secondary document type, scoped to marketTypeCode.
PacketDefinition (code, description, primary, includedDocCodes, marketTypeCode) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode, IList<string> includedDocCodes, string marketTypeCode) Defines a packet requiring only a primary document type, scoped to includedDocCodes and marketTypeCode.
PacketDefinition (code, description, primary, includedDocCodes) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode, IList<string> includedDocCodes) Defines a packet requiring only a primary document type, scoped to includedDocCodes, with no market-type restriction.
PacketDefinition (code, description, primary) public PacketDefinition(string code, string description, string primaryOutputDocumentTypeCode) Defines a packet requiring only a primary document type, with no secondary requirement or included-document/market-type restriction.
PacketDefinition (code, description) public PacketDefinition(string code, string description) Defines the most permissive packet: no primary/secondary document requirement, no included-document/market-type restriction.
Code public string Code { get; } The packet definition's unique code (e.g., "PKT001"), used to look it up via GetPacketDefinition.
Description public string Description { get; } The human-readable name of the packet (e.g., "New Business Issuance"), copied onto generated PolicyDocument packets.
PrimaryCode public string PrimaryCode { get; } The output-document-type code that must be present to anchor the packet; empty when the definition has no primary-document requirement.
SecondaryCode public string SecondaryCode { get; } The output-document-type code that must also be present alongside the primary document; empty when the definition has no secondary-document requirement.
MarketType public string MarketType { get; } The market-type code the policy must match for this definition to apply; empty when the definition is not market-type restricted.
MinimumDocumentCount public int MinimumDocumentCount { get; } The minimum number of documents the filtered working list must contain for a packet to be created; defaults to 2.
RequiresPeriod public bool RequiresPeriod { get; } When true (the default), only documents with a non-null policy-period effective date are eligible for this packet.
RequiresRelationshipParent public bool RequiresRelationshipParent { get; } When true, the packet's policy must itself be its own relationship-policy parent (defaults to false).
RequiresRelationshipChild public bool RequiresRelationshipChild { get; } When true, the packet's policy must have a distinct relationship-policy parent (defaults to false).
RequiresSamePolicyPeriodEffDate public bool RequiresSamePolicyPeriodEffDate { get; } When true (the default), documents in the packet must share the primary document's policy-period effective date.
IncludeChildDocuments public bool IncludeChildDocuments { get; } When false (the default), documents belonging to a policy other than the packet's relationship-parent policy are excluded from the packet.
PrimaryParentCode public string PrimaryParentCode { get; } An output-document-type code that must already exist for the primary document before this packet can be created; empty when there is no such requirement.
RequiresSameSourceKeyText public bool RequiresSameSourceKeyText { get; } When true, documents in the packet must share the primary document's source-key text; defaults to false.
IncludedDocumentCodes public IEnumerable<string> IncludedDocumentCodes { get; } The specific output-document-type codes eligible for this packet; empty when the definition places no such restriction.
IncludedRelationshipTypes public IList<string> IncludedRelationshipTypes { get; set; } The relationship-type codes (e.g., "SUBAC", "OREGN") the packet's policy relationship must match; empty by default, settable via object initializer syntax.
GetPacketDefinition public static PacketDefinition GetPacketDefinition(string packetId, IUnitOfWork unitOfWork) Returns the single definition from GetPacketDefinitions whose Code matches packetId case-insensitively; null when none matches.
GetPacketDefinitions public static List<PacketDefinition> GetPacketDefinitions(IUnitOfWork unitOfWork) Returns the full hard-coded catalog of packet definitions (PKT001 through roughly PKT038), each expressing one document-bundling policy for the business (DOM-BR-203).

Behavioral notes

  • The catalog returned by GetPacketDefinitions is positional: a source comment explicitly states that when multiple definitions could match the same document, the first one in list order wins, so more restrictive definitions are deliberately placed before more general ones (e.g., leasing/subaccount packets ahead of individual-policy packets).
  • GetPacketDefinitions first computes docCodesInRenewalPackets and reuses it across several renewal-related definitions, so a document code added to that shared list (via GetNewIListWithItemAdded) affects multiple PKT0xx definitions at once*.
  • Each PacketDefinition instance in the catalog is newly constructed on every call to GetPacketDefinitions, so the catalog is recomputed rather than cached*.

Constraints and usage notes

  • All nine constructors validate code/description as non-null/non-whitespace and, where applicable, primary/secondary codes and included-document lists as non-null (and non-empty for the included-document-code list); an invalid argument to any overload throws immediately rather than producing a partially-configured definition.
  • GetPacketDefinition compares codes with ToLower() (culture-dependent, not ordinal), so unusual culture settings on the executing thread could in principle affect the match*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Domain/SAIF.Domain/Tasks/Documents/Packets/PacketDefinition.cs
  • Domain/SAIF.Domain/Tasks/Documents/Packets/PacketGenerator.cs
  • Domain/SAIF.Domain/Tasks/Documents/Packets/PacketManager.cs