# DeleteAllocationCycle

## Overview

deleteAllocationCycle permanently removes an allocation cycle that is in DRAFT status. Cycles in VALIDATED, EXECUTED, POSTED, or REVERSED status cannot be deleted.

## Business Rules

- Allocation cycle must exist
- Only DRAFT allocation cycles can be deleted
- Cycles in VALIDATED, EXECUTED, POSTED, or REVERSED status cannot be deleted
- Deletion removes the cycle and all associated allocation rules
- Emits an audit event recording the deletion and acting user

## Process Flow

```mermaid
flowchart TD
    A[Receive delete allocation cycle request] --> B{Allocation cycle exists?}
    B -->|No| C[Return error: ALLOCATION_CYCLE_NOT_FOUND]
    B -->|Yes| D{Status is DRAFT?}
    D -->|No| E[Return error: INVALID_STATE]
    D -->|Yes| F[Delete allocation cycle and associated rules]
    F --> G[Emit audit event]
    G --> H[Return success]
```

## External Dependencies

- None

## Error Scenarios

- **ALLOCATION_CYCLE_NOT_FOUND**: Allocation cycle with the specified ID does not exist
- **INVALID_STATE**: Allocation cycle is not in DRAFT status

## Test Cases

- deletes a DRAFT allocation cycle successfully
- deletes a DRAFT allocation cycle and removes associated rules
- returns error when allocation cycle does not exist
- returns error when allocation cycle is in VALIDATED status
- returns error when allocation cycle is in EXECUTED status
- returns error when allocation cycle is in POSTED status
- returns error when allocation cycle is in REVERSED status
- emits audit event recording the deletion and acting user
