# UpdatePartnerAddress

## Permission Scope

partnerDetail

## Overview

updatePartnerAddress modifies the fields of an existing partner address. Address type is fixed by the existing record and is not part of the update input. All other address fields (line1, line2, city, state, postalCode, country) can be updated individually. Country validation is enforced when a new country value is provided. Updates are permitted regardless of the parent partner's lifecycle status (DRAFT, ACTIVE, or INACTIVE) — existing addresses always remain updatable.

## Business Rules

- Address must exist in the system
- Parent partner's lifecycle status is not checked — updates are permitted in any state (DRAFT, ACTIVE, or INACTIVE)
- Address type is not part of the update input
- Country, if provided, must be a valid ISO 3166-1 alpha-2 code
- Only provided fields are updated; omitted fields retain their current values

## Process Flow

```mermaid
flowchart TD
    A[Receive update request] --> B{Address exists?}
    B -->|No| C[Return error: address not found]
    B -->|Yes| D{Country provided?}
    D -->|Yes| E{Country code valid?}
    E -->|No| F[Return error: invalid country code]
    E -->|Yes| G[Update address record]
    D -->|No| G
    G --> H[Return updated address]
```

## External Dependencies

- None

## Error Scenarios

- **ADDRESS_NOT_FOUND**: Specified address ID does not exist
- **INVALID_COUNTRY_CODE**: Country is not a valid ISO 3166-1 alpha-2 code

## Test Cases

- updates address fields
- updates address for DRAFT partner
- updates address for ACTIVE partner
- updates address for INACTIVE partner
- returns error when address not found
- returns error when country code is invalid
- returns error when country code is lowercase
