# ReactivateProfitCenter

## Permission Scope

accounting

## Overview

reactivateProfitCenter transitions a profit center from INACTIVE status back to ACTIVE status, making it available again for transaction assignments and profitability reporting. Only profit centers currently in INACTIVE status can be reactivated.

## Business Rules

- Profit center must exist
- Profit center must be in INACTIVE status to be reactivated
- Reactivating a DRAFT or already ACTIVE profit center is rejected as an invalid state transition
- Upon reactivation, the profit center becomes available for transaction assignments again
- Emits an audit event recording the status transition and acting user

## Process Flow

```mermaid
flowchart TD
    A[Receive reactivate profit center request] --> B{Profit center exists?}
    B -->|No| C[Return error: PROFIT_CENTER_NOT_FOUND]
    B -->|Yes| D{Status is INACTIVE?}
    D -->|No| E[Return error: INVALID_STATE]
    D -->|Yes| F[Transition status from INACTIVE to ACTIVE]
    F --> G[Emit audit event]
    G --> H[Return reactivated profit center]
```

## External Dependencies

- None

## Error Scenarios

- **PROFIT_CENTER_NOT_FOUND**: Profit center with the specified ID does not exist
- **INVALID_STATE**: Target entity is not in a valid status for this operation

## Test Cases

- reactivates an INACTIVE profit center transitioning it to ACTIVE status
- returns error when profit center does not exist
- returns error when profit center is in DRAFT status
- returns error when profit center is already ACTIVE
- emits audit event recording the status transition and acting user
