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

# Worker

`Worker` wraps a `ClaimPerson` entity and is the injured-worker read model `Claim.Worker`, `BillAssignment`, and `PatientIndexer` rely on for name, phone, address, and claim-count data. It resolves the worker's mailing address by preference order (mailing, then home, then primary) and formats phone numbers with a sensible extension fallback, providing the consistent worker-identity shape consumed across bill assignment, patient indexing, and CBP generation ([OP-DOM-01](../../operations-processes.md#op-dom-01), [OP-DOM-02](../../operations-processes.md#op-dom-02), [OP-DOM-06](../../operations-processes.md#op-dom-06)).

## Purpose
- Resolves a worker's preferred mailing address by trying mailing, then home, then primary address types in order, returning the first one with a non-blank line 1 ([OP-DOM-06](../../operations-processes.md#op-dom-06) worker-data assembly).
- Builds a consistently formatted `PersonName` from either a `ClaimPerson` or a Guidewire `BulkClaimClaimant`, used by claim navigation links and CBP worker-name generation ([DOM-BR-054](../../business-rules.md#dom-br-054-cbp-generation)).
- Formats home/message phone numbers with a phone-type tag and computes the worker's current age from their birth date.

## Context
- Namespace: `SAIF.Domain.Model.Claims`
- Assembly/package: `SAIF.Domain` (packaged in `SAIF.SAIFCode.Core`)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Worker (constructor by id) | `public Worker(IRepositoryFactory factory, IWorkerQueryProvider queryProvider, long workerId)` | Loads the worker by `workerId`, guarding that `queryProvider` and `factory` are non-null. |
| Worker (constructor from entity) | `public Worker(IRepositoryFactory factory, IWorkerQueryProvider workerQueryProvider, ClaimPerson person)` | Wraps an already-loaded `ClaimPerson` entity. |
| Data | `public ClaimPerson Data { get; }` | Exposes the underlying `ClaimPerson` entity. |
| WorkerName | `public PersonName WorkerName { get; }` | The worker's name, built via `BuildWorkerName(DataItem)`. |
| HomePhone | `public PhoneNumber HomePhone { get; }` | The worker's home phone tagged with phone type `"H"`/"Home"; `null` when there is no home phone number. |
| MessagePhone | `public PhoneNumber MessagePhone { get; }` | The worker's message phone tagged with phone type `"M"`/"Message"; `null` when there is no message phone number. |
| ClaimCount | `public int ClaimCount { get; }` | The number of claims associated with the worker's person ID, from `IWorkerQueryProvider.GetClaimCount`. |
| BuildWorkerName (from ClaimPerson) | `public static PersonName BuildWorkerName(ClaimPerson person)` | Builds a `PersonName` from a `ClaimPerson`'s first/last/middle/suffix name fields. |
| BuildWorkerName (from BulkClaimClaimant) | `public static PersonName BuildWorkerName(BulkClaimClaimant person)` | Builds a `PersonName` from a Guidewire `BulkClaimClaimant`'s first/last/middle name fields, with an empty suffix. |
| GetWorkerAddress (no args) | `public ClaimPersonAddress GetWorkerAddress()` | Resolves the worker's preferred address from `DataItem.Addresses`; `null` when the worker has no addresses. |
| GetWorkerAddress (from list) | `public ClaimPersonAddress GetWorkerAddress(IEnumerable<ClaimPersonAddress> addressList)` | Picks the first non-blank mailing address, else home address, else primary address (in that preference order) from `addressList`, ordered by most recent update first; `null` when none of the three types has a non-blank line 1. |
| WorkerAddress | `public Address WorkerAddress()` | The worker's preferred address (via `GetWorkerAddress()`), mapped to the `Address` contract by `BuildWorkerAddress`. |
| MapWorkerAddress | `public Address MapWorkerAddress(ClaimPersonAddress addr)` | Maps a `ClaimPersonAddress` to the `Address` contract via AutoMapper; `null` when `addr` is `null`. |
| BuildWorkerAddress | `public static Address BuildWorkerAddress(ClaimPersonAddress addr)` | Builds an `Address` contract from `addr` field-by-field, formatting a zero zip code as empty and setting the country code to `"US"` unless the address is foreign; an empty `Address` when `addr` is `null`. |
| GetPreferredContactCode | `public string GetPreferredContactCode()` | The description of the worker's preferred contact method; empty when the worker has no data. |
| WorkerAge | `public string WorkerAge { get; }` | The worker's current age in years, computed from their birth date and adjusted for whether their birthday has occurred yet this year; empty when there is no birth date. |

## Inherited public members

Members in this section are inherited from `DomainBase<TItem>` in `SAIF.Domain`. They are available on this type through inheritance (via the intermediate `DomainRepositoryBase<TItem>` base).

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| HasData | `public virtual bool HasData { get; }` | Reports whether the wrapped `ClaimPerson` entity is present, evaluated as `!DataItem.IsNull()`. | `SAIF.Domain` — `DomainBase<TItem>` |

## Behavioral notes
- The static constructor calls `ClaimsMappingHelper.MapForWorker()`, registering the address AutoMapper maps `MapWorkerAddress` relies on, once per process the first time a `Worker` is constructed.
- `GetWorkerAddress(addressList)` orders candidates by `UpdateDate` descending before applying the mailing/home/primary preference, so among multiple addresses of the preferred type the most recently updated one wins*.
- `MapWorkerAddress` and `BuildWorkerAddress` overlap in purpose — one uses AutoMapper, the other builds the contract manually — and both are present in the type's public surface*.

## Constraints and usage notes
- `GetWorkerAddress(addressList)` is marked as not requiring a static implementation despite having no instance-state dependency (a `CA1822` suppression is present in source), so it remains an instance method by design rather than static*.

> **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/Model/Claims/Worker.cs`
- `Domain/SAIF.Domain/Model/Claims/ClaimsMappingHelper.cs`
- `Domain/SAIF.Domain/DomainBase.cs`
- `Domain/SAIF.Domain/DomainRepositoryBase.cs`
