# DeactivatePartnerAddress

## Permission Scope

partnerDetail

## Overview

deactivatePartnerAddress sets an address's `active` flag to `false`. The address remains readable for existing usages and historical records but cannot be assigned to a newly created CustomerAccount or SupplierAccount.

## Business Rules

- Address must exist
- Address must currently be active
- Deactivation never removes the address or its existing usage references

## Process Flow

```mermaid
flowchart TD
    A[Receive address ID] --> B{Address exists and is active?}
    B -->|No| C[Return domain error]
    B -->|Yes| D[Set active to false]
    D --> E[Save BusinessPartner aggregate]
```

## External Dependencies

- None

## Error Scenarios

- **ADDRESS_NOT_FOUND**: Specified address ID does not exist
- **INVALID_STATE_TRANSITION**: Requested state transition is not allowed from the current status

## Test Cases

- deactivates an address without removing it
- returns an error when the address does not exist
