# UpdateBudget

## Overview

updateBudget modifies fields on an existing budget. Updates are only permitted when the budget is in DRAFT status. Name, description, and budget holder can be updated while in DRAFT.

## Business Rules

- Budget must exist
- Budget must be in DRAFT status to be updated
- Name, description, and budget holder can be updated
- Updates to budgets in SUBMITTED, APPROVED, ACTIVE, or CLOSED status are rejected
- Emits an audit event recording previous and new field values

## Process Flow

```mermaid
flowchart TD
    A[Receive update 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[Apply updates to budget]
    F --> G[Emit audit event]
    G --> H[Return updated budget]
```

## 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

- updates name on a DRAFT budget
- updates description on a DRAFT budget
- updates budget holder on a DRAFT budget
- 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 previous and new field values
