# DeleteBudget

## Overview

deleteBudget permanently removes a budget that is in DRAFT status. Deletion also removes all associated line items. Budgets in SUBMITTED, APPROVED, ACTIVE, or CLOSED status cannot be deleted.

## Business Rules

- Budget must exist
- Only DRAFT budgets can be deleted
- Budgets in SUBMITTED, APPROVED, ACTIVE, or CLOSED status cannot be deleted
- Deletion removes the budget and all associated line items
- Emits an audit event recording the deletion and acting user

## Process Flow

```mermaid
flowchart TD
    A[Receive delete budget request] --> B{Budget exists?}
    B -->|No| C[Return error: BUDGET_NOT_FOUND]
    B -->|Yes| D{Status is DRAFT?}
    D -->|No| E[Return error: INVALID_STATE]
    D -->|Yes| F[Delete budget and all associated line items]
    F --> G[Emit audit event]
    G --> H[Return success]
```

## External Dependencies

- None

## Error Scenarios

- **BUDGET_NOT_FOUND**: Budget with the specified ID does not exist
- **INVALID_STATE**: Budget is not in DRAFT status

## Test Cases

- deletes a DRAFT budget successfully
- deletes a DRAFT budget and removes all associated line items
- returns error when budget does not exist
- returns error when budget is in SUBMITTED status
- returns error when budget is in APPROVED status
- returns error when budget is in ACTIVE status
- returns error when budget is in CLOSED status
- emits audit event recording the deletion and acting user
