# ReactivateWarehouse

## Permission Scope

location

## Overview

reactivateWarehouse transitions a warehouse from INACTIVE back to ACTIVE status, allowing it to resume accepting stock movements and other inventory operations. The referenced site must still be active.

## Business Rules

- Warehouse must exist
- Warehouse must be in INACTIVE status
- Referenced site must still be in ACTIVE status

## Process Flow

```mermaid
flowchart TD
    A[Receive reactivate request] --> B{Warehouse exists?}
    B -->|No| C[Return error: WAREHOUSE_NOT_FOUND]
    B -->|Yes| D{Status is INACTIVE?}
    D -->|No| E[Return error: WAREHOUSE_NOT_INACTIVE]
    D -->|Yes| F{Site still ACTIVE?}
    F -->|No| G[Return error: SITE_INACTIVE]
    F -->|Yes| H[Update status to ACTIVE]
    H --> I[Return updated warehouse]
```

## External Dependencies

- [organization::Site](../../../organization/docs/models/Site.md) - Validates that the referenced site is still active

## Error Scenarios

- **WAREHOUSE_NOT_FOUND**: Referenced warehouse does not exist
- **WAREHOUSE_NOT_INACTIVE**: Warehouse is not in INACTIVE status
- **SITE_INACTIVE**: Referenced site is no longer in ACTIVE status

## Test Cases

- returns error when warehouse not found
- returns error when warehouse already active
- returns error when site is inactive
- reactivates inactive warehouse
