---
title: ISegmentData
summary: API reference for ISegmentData.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common.Files
reference_type: package
---

# ISegmentData

`ISegmentData` is the uniform contract implemented by all 43 typed X12 segment classes in this library (AK1 through TRN). It defines the symmetric object-to-segment (`Build`) and segment-to-object (`Fill`) mapping that lets EDI parsing/serialization code work against a single abstraction instead of switching on concrete segment types, with `SegmentId` supplying the literal X12 segment identifier each implementation carries.

## Purpose
- Establishes the segment identity contract (`SegmentId`) that callers use to recognize and route a raw `IEdiSegment` to the correct typed wrapper, consistent with the rule that a segment's first element is its identifier ([BR-020](../../business-rules.md#br-020-first-element-is-the-segment-identifier)).
- Establishes `Build()` as the outbound direction: converting a populated typed object into an `IEdiSegment` ready for serialization.
- Establishes `Fill(IEdiSegment segment)` as the inbound direction: populating a typed object's properties from a raw parsed `IEdiSegment`.

## Context
- Namespace: `SAIF.Common.Files.Edi.Segments`
- Assembly/package: `SAIF.Framework.Common.Files`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| SegmentId | `string SegmentId { get; }` | The literal X12 segment identifier (e.g. `"ISA"`, `"CLP"`) that this implementation represents. |
| Build | `IEdiSegment Build()` | Produces an `IEdiSegment` populated from this object's properties, for outbound serialization. |
| Fill | `void Fill(IEdiSegment segment)` | Populates this object's properties by reading elements from the supplied raw `IEdiSegment`, for inbound parsing. |

## Behavioral notes
- Every implementing class also exposes a `static Parse(IEdiSegment segment)` factory method that constructs a new instance and calls `Fill` on it, though `Parse` is not itself part of this interface*.

## Constraints and usage notes
- Implementations are expected to map every documented X12 element position for their segment; some implementations throw `NotImplementedException` from `Build()` for segments that are inbound-only ([BR-054](../../business-rules.md#br-054-dmg-hi-sv1-sv2-sv3-are-inbound-only-segments)).

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- Common\SAIF.Common.Files\Edi\Segments\ISegmentData.cs
