# AbolishPosition

## Permission Scope

`position`

## Overview

AbolishPosition closes the current generation of a Position when the post is eliminated, preserving it for historical org-chart reconstruction rather than hard-deleting it.

## Business Rules

- Abolishing closes the current generation (sets `effectiveEnd`); the Position is not hard-deleted while Assignments reference it
- Any open Assignment on the Position must be closed (EndAssignment) as part of, or prior to, abolition
- An abolished Position cannot be the target of a new CreateAssignment or TransferAssignment

## Process Flow

```mermaid
flowchart TD
    A[Abolish Position on date] --> B{Position exists and open?}
    B -- No --> X[Reject: POSITION_NOT_FOUND / POSITION_ALREADY_ABOLISHED]
    B -- Yes --> C{Any open Assignment on this Position?}
    C -- Yes, not yet closed --> Y[Reject: POSITION_HAS_OPEN_ASSIGNMENT]
    C -- No --> D[Close current Position generation: effectiveEnd = date]
    D --> E[Position preserved for history; no longer assignable]
```

## External Dependencies

- [workforce::Assignment](../model/Assignment.md) model — open Assignments affected by abolition

## Error Scenarios

- **POSITION_NOT_FOUND**: the specified Position does not exist
- **POSITION_ALREADY_ABOLISHED**: the Position's current generation is already closed
- **POSITION_HAS_OPEN_ASSIGNMENT**: an open Assignment still references the Position and must be closed first

## Test Cases

- abolishing a Position preserves it while Assignments reference it
- abolishing an already-abolished Position is rejected
- abolishing a non-existent Position returns POSITION_NOT_FOUND
- an abolished Position can no longer receive new Assignments
- abolishing a Position with an open Assignment is rejected

