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
RecordsFromDatewheneverRecordsThruDateis 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 theSAIF.SAIFCode.CoreNuGet 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¶
ContainsValidRecipientDatadispatches per recipient bySubpoenaType.Code:MedicalRecords/Claimsrecipients are checked viaIsValidMedicalOrClaimsRecipient(provider location ID present and a 9-character TIN);OtherMedical/Parties/Nonpartiesrecipients are checked viaIsValidWitnessRecipient(first/last name length bounds plus either a policy location ID or a complete physical address); any other type code fails validation outright.IsValidWitnessRecipientaccepts a witness recipient if it has a valid name and aPolicyLocationId, 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
falseimmediately fromContainsValidRecipientDataif the subpoena has no recipients at all, short-circuiting the per-recipient loop. - Carries a
CA1710:IdentifiersShouldHaveCorrectSuffixclass-level suppression and aCA1820:TestForEmptyStringsUsingStringLengthsuppression 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 bothRecordsFromDateandRecordsThruDateare 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