---
title: Classify a contract
summary: Translate agency-contract codes into domain classifications.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Agency
reference_type: package
operation_id: OP-007
trigger: A caller inspects contract type or commission classification behavior.
---

# Classify a contract

This operation converts persisted contract and commission codes into domain enums and applies the producer-commission check used elsewhere in the library.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-007 |
| **Trigger** | A caller reads classification properties or invokes conversion helpers on `clsAgencyContract`. |
| **Inputs** | Contract-type code, commission GL code, or enum value |
| **Outputs** | Domain enum, code string, or Boolean result |
| **Primary components** | `clsAgencyContract.Convert`, `ConvertCommissionGeneralLedgerType`, `IsProducerCommissionContract` |
| **Entry point** | `Business\SAIF.Business.Policy.Agency\clsAgencyContract.vb` |

## Steps
1. Read the persisted contract-type code and map it to an `AgencyContractTypes` value ([BR-011](../business-rules.md#br-011-agency-contract-and-commission-codes-map-to-fixed-domain-values)).
2. Read the persisted commission GL code and map it to a `CommissionGeneralLedgerTypes` value.
3. When a code is not recognized, return `Unassigned` instead of failing ([BR-012](../business-rules.md#br-012-unknown-contract-or-commission-codes-become-unassigned)).
4. When converting in the opposite direction, throw an exception if the enum value is not mapped to a persisted code ([BR-014](../business-rules.md#br-014-unmapped-enum-to-code-conversions-raise-exceptions)).
5. Treat a contract as producer-commission-bearing only when the mapped GL type is `ProducerCommission` (`AGT`) ([BR-013](../business-rules.md#br-013-producer-commission-contracts-require-gl-code-agt)).

## Process flow

The following diagram visualizes contract classification.

```mermaid
flowchart TD
  Start([Contract classification]) --> MapType[Map contract type code]
  MapType --> MapGL[Map GL code]
  MapGL --> Producer{GL type = AGT?}
  Producer -->|Yes| True[Producer commission contract]
  Producer -->|No| False[Not a producer commission contract]
```

## Failure and edge-case behavior
- Unknown persisted codes degrade to `Unassigned`.
- Unknown enum inputs fail fast during enum-to-code conversion.

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [API reference](../api/index.md)

## Sources
- `Business\SAIF.Business.Policy.Agency\clsAgencyContract.vb`
