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

# LegalTaskValidator

FluentValidation validator for `LegalTask` that extends the shared `TaskValidator<LegalTask>` base with legal-activity-specific rules: valid claim number (via `ILegalTaskService.IsValidClaim`), valid/authorized assigned user or group (via `ILegalTaskService.CanUserEdit` and `ValidGroups`), a task date within an allowed range (adjusted for the work calendar), a required case ID for legal-category tasks, and a required note category for legal-category tasks.

## Purpose
- Rejects a task whose claim number does not resolve to a valid claim.
- Rejects a task assigned to a user (not a valid group) who is not authorized to edit it, unless the assignee is the reserved "additional info" task user.
- Rejects a task date that is not within the work-calendar-adjusted range from today through two years in the future, when the date has actually changed and the task is not an "additional info" task.
- Requires a case ID for tasks in the Legal (`LGLT`) category.
- Requires a legal note category for tasks in the Legal (`LGLT`) category, unless the assignee is the "additional info" task user.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| LegalTaskValidator (constructor) | `public LegalTaskValidator(ILegalTaskService taskService, IWorkCalendarService workCalendarService)` | Passes the work-calendar service to the base `TaskValidator<LegalTask>` constructor and configures the claim-number, task-user, task-date, case-ID, and note-category FluentValidation rules using the injected `ILegalTaskService`. |

## Behavioral notes
- The `TaskUser` rule only applies (`.When(...)`) when the user is not the "additional info" (`INFO`) task user and is not a recognized group (from `ILegalTaskService.ValidGroups`), i.e., group-assigned and "additional info" tasks bypass the per-user authorization check.
- The `TaskDate` rule only applies when the date differs from `PreviousTaskDate`, so re-saving an unchanged date does not re-trigger the range check.
- The `CaseId` and `LegalNoteCategory` rules only apply when `TaskCategory.Code` equals the Legal activity category (`LGLT`); non-legal tasks are exempt from both.

## Constraints and usage notes
- Carries a `CA1710:IdentifiersShouldHaveCorrectSuffix` suppression, since FluentValidation's naming convention ("Validator") does not match the `IValidator` interface-suffix rule.*
- Depends on `ILegalTaskService.IsValidClaim`, `CanUserEdit`, `AdjustTaskDate`, and `ValidGroups` at validation time, coupling this validator to a fully constructed task service rather than pure data rules.*

> **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/Tasks/LegalTaskValidator.cs`
