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

# SubpoenaValidator

A FluentValidation `AbstractValidator<Subpoena>` that enforces the mandatory-field and cross-field business rules a subpoena must satisfy before it can be saved — required type, recipients, appearance date/time, hearing location, compliance date, special handling, and requesting attorney — plus a records-date range check and per-recipient-type completeness check (medical/claims recipients need a valid provider location and TIN; witness recipients need a valid name and either a policy location or a complete physical address).

## Purpose
- Requires a subpoena to have a designated type, at least one recipient, an appearance date and time, a hearing location, a compliance date, a special handling selection, and a requesting attorney (`RequestedByEmployeeId`).
- Requires `RecordsFromDate` whenever `RecordsThruDate` is present, and vice versa, and rejects a records date range where the thru date precedes the from date.
- Rejects a subpoena whose recipient data is invalid or incomplete for its subpoena type — provider location and 9-digit TIN for medical-records/claims subpoenas, or valid name plus policy location/complete address for other-medical/parties/nonparties (witness) subpoenas.

## Context
- Namespace: `SAIF.Services.Legal.Subpoenas`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package).

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| SubpoenaValidator (constructor) | `public SubpoenaValidator()` | Registers all FluentValidation rules for the required subpoena fields, the conditional records-date-range rules, and the recipient-completeness rule, each with a specific "Error: ..." message. |

## Behavioral notes
- `ContainsValidRecipientData` dispatches per recipient by `SubpoenaType.Code`: `MedicalRecords`/`Claims` recipients are checked via `IsValidMedicalOrClaimsRecipient` (provider location ID present and a 9-character TIN); `OtherMedical`/`Parties`/`Nonparties` recipients are checked via `IsValidWitnessRecipient` (first/last name length bounds plus either a policy location ID or a complete physical address); any other type code fails validation outright.
- `IsValidWitnessRecipient` accepts a witness recipient if it has a valid name and a `PolicyLocationId`, *or*, failing that, a valid name plus a fully-formed physical address (line1 5–40 chars, optional line2 up to 40 chars, city 2–30 chars, 2-character state, 5-digit zip, optional 4-digit plus-four).
- Returns `false` immediately from `ContainsValidRecipientData` if the subpoena has no recipients at all, short-circuiting the per-recipient loop.
- Carries a `CA1710:IdentifiersShouldHaveCorrectSuffix` class-level suppression and a `CA1820:TestForEmptyStringsUsingStringLength` suppression on the constructor.*

## Constraints and usage notes
- This validator enforces subpoena-level required fields and recipient-type completeness; it does not validate individual recipients' payment amounts — that is handled separately by `SubpoenaRecipientValidator`.*
- The records-date-range rule (`HasProperRecordsDateRange`) only runs when both `RecordsFromDate` and `RecordsThruDate` are present and non-empty; it is not evaluated for subpoenas without a records date range.

> **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/Legal/Subpoenas/SubpoenaValidator.cs`
