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

# PayrollReportService

Retrieves a single payroll audit report by report ID through `IPolicyQueryProvider` and maps the resulting `PolicyPeriodPayrollAudit`/`AuditStatus`/`Policy` data-layer objects into their `SAIF.Core.Contracts.Policies.PayrollReport`/`SAIF.Core.Contracts.OutputDocuments` contract equivalents via AutoMapper maps registered in its static constructor; consumed by `PolicyDocumentsApiService` to resolve the policy behind a payroll report.*

## Purpose
- Looks up a payroll period audit report by its report ID and returns it in the contract shape expected by API/document-generation callers.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| PayrollReportService (constructor) | `public PayrollReportService(IUnitOfWork unitOfWork, IPolicyQueryProvider policyQueryProvider)` | Wires the policy query provider used to load payroll report data; the injected `IUnitOfWork` is validated but not retained (its field is commented out). |
| GetPayrollReport | `public PolicyPeriodPayrollAudit GetPayrollReport(long reportId)` | Retrieves the data-layer payroll report for the given report ID via `IPolicyQueryProvider.GetPayrollReportForReportId` and maps it to the contract `PolicyPeriodPayrollAudit` type. |

## Behavioral notes
- A static constructor registers AutoMapper maps for `PolicyPeriodPayrollAudit`, `AuditStatus`, and `Policy` from their `SAIF.Data.Model.Policies` data-layer types to their `SAIF.Core.Contracts.Policies.PayrollReport`/`SAIF.Core.Contracts.OutputDocuments` contract equivalents.
- `GetPayrollReport` returns `null` (via `Mapper.Map`) if `IPolicyQueryProvider.GetPayrollReportForReportId` finds no matching report, rather than throwing.*

## Constraints and usage notes
- Both constructor parameters are null-checked via `Enforce.ArgumentNotNull`, even though `unitOfWork` is not stored as a field.
- Callers that need to distinguish "report not found" from "report has a zero ID" must inspect the returned object themselves, as this service performs no such validation (that logic lives in `PolicyDocumentsApiService.ValidateReportId`).*

> **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/Policies/PayrollReport/PayrollReportService.cs`
