# DeactivateStorageLocation

## Permission Scope

location

## Overview

deactivateStorageLocation transitions a storage location from ACTIVE to INACTIVE status. Once deactivated, the location rejects new stock placement while historical records remain intact.

## Business Rules

- Storage location must exist
- Storage location must be in ACTIVE status

## Process Flow

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

## External Dependencies

- None

## Error Scenarios

- **STORAGE_LOCATION_NOT_FOUND**: Referenced storage location does not exist
- **STORAGE_LOCATION_NOT_ACTIVE**: Referenced storage location is not in ACTIVE status

## Test Cases

- returns error when not found
- returns error when already inactive
- deactivates location
