# ProfitCenterHierarchyAssignment

## Description

ProfitCenterHierarchyAssignment represents the assignment of a profit center to a specific node within a profit center hierarchy. Each assignment links a profit center to exactly one node per hierarchy, enabling hierarchical roll-up reporting across multiple hierarchy dimensions simultaneously. A profit center can be assigned to nodes in multiple hierarchies, but within a given hierarchy it can only be assigned to one node at a time. Reassigning a profit center to a different node within the same hierarchy replaces the previous assignment.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [assignProfitCenterToHierarchyNode](../commands/AssignProfitCenterToHierarchyNode.md) - Assign a profit center to a hierarchy node, replacing any existing assignment within the same hierarchy

### Query Definitions

- [GetProfitCenterHierarchy](../queries/GetProfitCenterHierarchy.md) - Retrieve hierarchy nodes and their associated profit center assignments

### Models

- ProfitCenterHierarchyAssignment

### Invariants

- A profit center can be assigned to exactly one node within a given hierarchy (enforced by a unique index on profitCenterId and hierarchyId)
- A profit center can be assigned to nodes in multiple different hierarchies simultaneously
- Assigning a profit center to a new node within the same hierarchy replaces the previous assignment
- Both the profit center and the target hierarchy node must exist before an assignment can be created

### Relationships

- **References ProfitCenter**: Each assignment references a ProfitCenter via profitCenterId
- **References ProfitCenterHierarchy**: Each assignment references a ProfitCenterHierarchy via hierarchyId
- **References ProfitCenterHierarchyNode**: Each assignment references a ProfitCenterHierarchyNode via hierarchyNodeId
