---
title: PacketRequest
summary: API reference for PacketRequest.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Domain
reference_type: package
---

# PacketRequest

`PacketRequest` is the working-state container `PacketManager.CreatePackets` builds for a single packeting run: it holds the packet definitions to evaluate (defaulting to every configured definition when none are supplied), the document groupings produced along the way, and the accumulating list of packets already created, tying together the grouping step of [OP-DOM-19](../../operations-processes.md#op-dom-19) ([DOM-BR-201](../../business-rules.md#dom-br-201-packet-creation)).

## Purpose
- Resolves the set of packet definitions to evaluate for the request — either the caller-supplied definitions, or, when none are given, every definition from `PacketDefinition.GetPacketDefinitions` — and initializes empty collections for packets and document groupings.
- Exposes the document groupings and accumulated packets `PacketManager` reads and populates during a packeting run.

## Context
- Namespace: `SAIF.Domain.Tasks.Documents.Packets`
- Assembly/package: `SAIF.Domain` (packaged in `SAIF.SAIFCode.Core`)
- Declares two `internal` grouping methods (`CreateGroups`, `CreateGroupsByPeriod`) that populate `DocumentGroups`/`DocumentGroupsByPeriod`; they are not part of this type's public surface and are described here only as context for how the public properties get populated.

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| PacketRequest (constructor) | `public PacketRequest(IUnitOfWork unitOfWork, params PacketDefinition[] definitions)` | Sets `Definitions` to `definitions` when any are supplied, else to every definition from `PacketDefinition.GetPacketDefinitions(unitOfWork)`; initializes `Packets`, `DocumentGroups`, and `DocumentGroupsByPeriod` as empty lists. |
| DocumentGroups | `public IList<IList<PolicyOutputDocument>> DocumentGroups { get; }` | The document groups keyed by policy/document-date/release-date, populated by the internal `CreateGroups` method ([DOM-BR-201](../../business-rules.md#dom-br-201-packet-creation)). |
| DocumentGroupsByPeriod | `public IList<IList<PolicyOutputDocument>> DocumentGroupsByPeriod { get; }` | The document groups keyed additionally by policy-period effective date, populated by the internal `CreateGroupsByPeriod` method for documents left over after the first grouping pass ([DOM-BR-201](../../business-rules.md#dom-br-201-packet-creation)). |
| Definitions | `public IList<PacketDefinition> Definitions { get; }` | The packet definitions this request will evaluate against each document group. |
| Packets | `public IList<PolicyDocument> Packets { get; set; }` | The packets accumulated so far by `PacketGenerator.CreatePacket` calls run against this request's document groups. |

## Behavioral notes
- `Definitions`, `DocumentGroups`, `DocumentGroupsByPeriod` have `private set` accessors, so once constructed they can only be mutated through the internal grouping methods; `Packets` alone has a public setter, letting callers replace the entire packet collection outright*.
- Because the grouping methods are `internal`, code outside this assembly can construct a `PacketRequest` and read its definitions, but cannot itself populate `DocumentGroups`/`DocumentGroupsByPeriod` — only `SAIF.Domain` types such as `PacketManager` can drive the grouping step*.

## Constraints and usage notes
- Passing no `definitions` to the constructor causes a query for every configured packet definition; passing an explicit set (as some tests or specialized flows might) scopes the request to just those.

> **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/PacketRequest.cs`
- `Domain/SAIF.Domain/Tasks/Documents/Packets/PacketDefinition.cs`
- `Domain/SAIF.Domain/Tasks/Documents/Packets/PacketManager.cs`
