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

# ServiceCodeManager

`ServiceCodeManager` is the single lookup point CBP generation (OP-DOM-06) and other Ebilling code use to resolve a raw service-code string to a CBP service code and its type code, backed by `IEbillingQueryProvider`'s CBP bill queries (operation OP-DOM-08). It implements `IServiceCodeManager` so callers can be composed against the interface, and `GenerateCbpBills` receives it through dependency injection rather than resolving codes itself.

## Purpose
- Resolves a service-code string to its CBP service-type code, preferring a non-expired code over an expired one, and returning Unknown when there is no service date or the date falls outside the code's effective/expiration range ([DOM-BR-080](../../business-rules.md#dom-br-080-code-lookup), [DOM-BR-081](../../business-rules.md#dom-br-081-code-lookup)).
- Resolves a service-code string to its canonical CBP service code, again preferring the non-expired match and falling back to the expired one, or to the original input when neither is found.

## Context
- Namespace: `SAIF.Domain.Claims.Ebilling`
- Assembly/package: `SAIF.Domain` (`Domain/SAIF.Domain/SAIF.Domain.csproj`, .NET Framework 4.6.2 class library)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| ServiceCodeManager (constructor) | `public ServiceCodeManager(IEbillingQueryProvider queryProvider)` | Initializes the manager with the query provider used to look up CBP service codes; throws if `queryProvider` is null. |
| GetServiceTypeCode | `public string GetServiceTypeCode(string serviceCodes, DateTime? serviceDate)` | Returns the service's type code: Unknown when no service date is supplied, the matched code's type when the service date falls within its effective/expiration range, otherwise Unknown ([DOM-BR-081](../../business-rules.md#dom-br-081-code-lookup)). |
| GetServiceCode | `public string GetServiceCode(string serviceCodes)` | Returns the canonical CBP service code for the input, preferring a non-expired match, then an expired match, then the original input unchanged ([DOM-BR-080](../../business-rules.md#dom-br-080-code-lookup)). |

## Behavioral notes
- `GetServiceTypeCode` always looks up the non-expired code first and only falls back to the expired code when no non-expired match exists, matching the preference rule used by `GetServiceCode` ([DOM-BR-080](../../business-rules.md#dom-br-080-code-lookup)).

## Sources
- `Domain/SAIF.Domain/Claims/Ebilling/ServiceCodeManager.cs`
