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

# HierarchialLevel

`HierarchialLevel` represents one HL-rooted hierarchical level nested within a `HierarchialTransaction`, keyed by the HL segment's hierarchical ID number (HL01) ([BR-034](../../business-rules.md#br-034-group-keys-derived-from-control-number-elements)). Instances are produced by `EdiGroupParser.CreateHierarchialTransactions` and are added to the owning `HierarchialTransaction.Levels` collection to express the nesting required by [BR-035](../../business-rules.md#br-035-hierarchical-levels-nested-inside-hierarchical-transaction).

## Purpose
- Provides typed access to the parsed HL segment for this level via `LevelData`, in addition to the raw `HierarchySegment`.
- Initializes `Segments` to an empty list in its constructor so consumers never encounter a null collection before parsing populates it.

## Context
- Namespace: `SAIF.Common.Files.Edi`
- Assembly/package: `SAIF.Framework.Common.Files`
- Base class: `GroupContainer`
- Also derives (transitively) from `SegmentGroup` and `List<IEdiSegment>` (framework-standard collection base)
- Implements: `IHierarchialLevel`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| LevelData | `public HlSegment LevelData { get; internal set; }` | The strongly-typed HL segment for this hierarchical level. |
| HierarchySegment | `public IEdiSegment HierarchySegment { get; internal set; }` | The raw HL segment used as the source for `LevelData`. |

## Inherited public members

Members in this section are inherited from `GroupContainer` in `SAIF.Framework.Common.Files`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| HeaderSegment | `public IEdiSegment HeaderSegment { get; internal set; }` | The raw control segment that opens this group; not separately populated for hierarchical levels since they are not delimited by a distinct trailer control segment.* | `SAIF.Framework.Common.Files` — `GroupContainer` |
| TrailerSegment | `public IEdiSegment TrailerSegment { get; internal set; }` | The raw control segment that closes this group; not separately populated for hierarchical levels.* | `SAIF.Framework.Common.Files` — `GroupContainer` |
| Segments | `public IEnumerable<IEdiSegment> Segments { get; internal set; }` | This level's member segments with the HL/ST/SE control segments excluded ([BR-033](../../business-rules.md#br-033-control-segments-excluded-from-member-segments-collections)). | `SAIF.Framework.Common.Files` — `GroupContainer` |

Members in this section are also inherited from `SegmentGroup` in `SAIF.Framework.Common.Files` (the next ancestor up the chain).

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| SegmentGroupId | `public string SegmentGroupId { get; set; }` | The segment tag (`"HL"`) that this group was delimited by during parsing. | `SAIF.Framework.Common.Files` — `SegmentGroup` |
| Index | `public int Index { get; set; }` | The sequential ordinal assigned to this level among its siblings. | `SAIF.Framework.Common.Files` — `SegmentGroup` |
| Key | `public string Key { get; set; }` | The HL01 hierarchical ID number value that uniquely identifies this level ([BR-034](../../business-rules.md#br-034-group-keys-derived-from-control-number-elements)). | `SAIF.Framework.Common.Files` — `SegmentGroup` |
| Level | `public int Level { get; set; }` | The nesting depth of this group, defaulted to `0`; conceptually related to (but not automatically derived from) the HL segment's own hierarchical level code element. | `SAIF.Framework.Common.Files` — `SegmentGroup` |

## Constraints and usage notes
- A `HierarchialLevel` is only meaningful as a child of a `HierarchialTransaction`'s `Levels` collection; the parser never produces one independently ([BR-035](../../business-rules.md#br-035-hierarchical-levels-nested-inside-hierarchical-transaction)).

> **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\HierarchialLevel.cs
- Common\SAIF.Common.Files\Edi\IHierarchialLevel.cs
