# ActivateUnit

## Permission Scope

unit

## Overview

ActivateUnit re-enables a previously deactivated unit of measure, making it available for new product assignments and quantity conversions. This command supports scenarios where a temporarily suspended unit needs to be restored to active use.

## Business Rules

- Target unit must exist in the system
- Target unit must be in Inactive status
- Activating an already active unit returns success with no state change
- The unit's category must be active for the unit to be usable in new assignments
- Historical transactions using this unit are not affected by activation

## Process Flow

```mermaid
flowchart TD
    A[Receive activate request] --> B{Unit exists?}
    B -->|No| C[Return error: not found]
    B -->|Yes| D{Current status?}
    D -->|Active| E[Return success: already active]
    D -->|Inactive| F[Update status to Active]
    F --> G[Return activated unit]
```

## External Dependencies

- None

## Error Scenarios

- **UNIT_NOT_FOUND**: Specified unit ID does not exist

## Test Cases

- throws when unit doesn't exist
- returns unit unchanged when already active
- activates inactive unit
