# RemoveRoleFromPartner

## Permission Scope

partner

## Overview

removeRoleFromPartner removes a business role (CUSTOMER or SUPPLIER) from an active partner. This restricts which business processes the partner can participate in going forward. The operation is idempotent — removing a role that is not currently assigned does not produce an error.

## Business Rules

- Partner must exist in the system
- Partner must be in ACTIVE status
- Removal is idempotent — removing a role that is not present succeeds without error

## Process Flow

```mermaid
flowchart TD
    A[Receive remove role request] --> D{Partner exists?}
    D -->|No| E[Return error: partner not found]
    D -->|Yes| F{Partner is ACTIVE?}
    F -->|No| G[Return error: partner not active]
    F -->|Yes| H{Role currently assigned?}
    H -->|No| I[Return success - idempotent]
    H -->|Yes| J[Remove role from partner]
    J --> K[Return updated partner]
```

## External Dependencies

- None

## Error Scenarios

- **PARTNER_NOT_FOUND**: Specified partner ID does not exist
- **PARTNER_NOT_ACTIVE**: Partner is not in ACTIVE status

## Test Cases

- removes CUSTOMER from partner holding both roles
- idempotent when role not present
- returns error when partner not found
- returns error when partner is INACTIVE
