# ListPartnerAddressesByPartner

## Overview

ListPartnerAddressesByPartner retrieves all addresses belonging to a given partner, with optional filtering by address type. This supports downstream modules that need to display or select from a partner's full set of addresses, as well as type-specific lookups (e.g., all SHIPPING addresses for a partner).

## Business Rules

- Accepts `{ partnerId, addressType? }` as input
- When `addressType` is provided, returns only addresses of that type for the partner
- When `addressType` is omitted, returns all addresses for the partner regardless of type
- Returns an empty array when the partner has no addresses (or none of the requested type) — not an error
- Results include both default and non-default addresses
- Reading addresses is permitted regardless of partner status (DRAFT, ACTIVE, or INACTIVE)

## Process Flow

```mermaid
flowchart TD
    A[Receive input] --> B{addressType provided?}
    B -->|Yes| C[SELECT from PartnerAddress where partnerId = input.partnerId AND addressType = input.addressType]
    B -->|No| D[SELECT from PartnerAddress where partnerId = input.partnerId]
    C --> E[Return matching addresses]
    D --> E
```

## External Dependencies

- None

## Error Scenarios

- No explicit error — returns an empty array when no addresses match the criteria

## Test Cases

- returns all addresses for a partner with multiple addresses
- returns only SHIPPING addresses when addressType filter is provided
- returns empty array when partner has no addresses
- returns empty array when partner has no addresses of the requested type
- includes both default and non-default addresses in results
