# DeactivateWarehouse

## Overview

deactivateWarehouse transitions a warehouse from ACTIVE to INACTIVE status. Once deactivated, the warehouse no longer accepts new stock movements, but all historical records are preserved for auditing and reporting purposes.

## Business Rules

- Warehouse must exist
- Warehouse must be in ACTIVE status

## Process Flow

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

## External Dependencies

- None

## Error Scenarios

- **WAREHOUSE_NOT_FOUND**: Referenced warehouse does not exist
- **WAREHOUSE_NOT_ACTIVE**: Warehouse is not in ACTIVE status

## Test Cases

- returns error when warehouse not found
- returns error when warehouse already inactive
- deactivates active warehouse
- historical records preserved after deactivation
