# DeletePartner

## Permission Scope

partner

## Overview

deletePartner permanently removes a business partner from the system. Only partners in DRAFT status can be deleted, ensuring that partners who have been activated and potentially referenced in transactions cannot be accidentally removed. For partners that have been activated, use deactivatePartner instead.

## Business Rules

- Partner must exist in the system
- Partner must be in DRAFT status
- Deletion is permanent and cannot be undone
- ACTIVE and INACTIVE partners cannot be deleted

## Process Flow

```mermaid
flowchart TD
    A[Receive delete request] --> B{Partner exists?}
    B -->|No| C[Return error: not found]
    B -->|Yes| D{Status is DRAFT?}
    D -->|No| E[Return error: invalid state transition]
    D -->|Yes| F[Delete partner record]
    F --> G[Return success]
```

## External Dependencies

- None

## Error Scenarios

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

## Test Cases

- deletes a DRAFT partner
- returns error when partner not found
- returns error when partner is ACTIVE
- returns error when partner is INACTIVE
