# SetDefaultPartnerAddress

## Permission Scope

partnerDetail

## Overview

setDefaultPartnerAddress designates a specific address as the default for its address type within a partner. The previous default address of the same type for the same partner is automatically unset. This ensures that each partner has at most one default address per address type, which is used as the preferred address for that type in business transactions.

## Business Rules

- Address must exist in the system
- The previous default address of the same type for the same partner is automatically unset
- Each partner can have at most one default address per address type

## Process Flow

```mermaid
flowchart TD
    A[Receive set default request] --> B{Address exists?}
    B -->|No| C[Return error: address not found]
    B -->|Yes| D{Partner has existing default of same type?}
    D -->|Yes| E[Unset previous default]
    E --> F[Set new default address]
    D -->|No| F
    F --> G[Return updated address]
```

## External Dependencies

- None

## Error Scenarios

- **ADDRESS_NOT_FOUND**: Specified address ID does not exist

## Test Cases

- sets address as default
- unsets previous default of same type
- returns error when address not found
