# DeactivateContactPerson

## Overview

deactivateContactPerson transitions a contact person from ACTIVE to INACTIVE status. This is used when a contact person is no longer a valid point of contact for the organization. If the contact person holds the primary designation, that designation is automatically removed upon deactivation.

## Business Rules

- Contact person must exist in the system
- Contact person must be in ACTIVE status
- If the contact person is the primary contact, the primary designation is removed upon deactivation

## Process Flow

```mermaid
flowchart TD
    A[Receive deactivate request] --> B{Contact person exists?}
    B -->|No| C[Return error: contact person not found]
    B -->|Yes| D{Status is ACTIVE?}
    D -->|No| E[Return error: invalid state transition]
    D -->|Yes| F{Is primary contact?}
    F -->|Yes| G[Remove primary designation]
    G --> H[Update status to INACTIVE]
    F -->|No| H
    H --> I[Return deactivated contact person]
```

## External Dependencies

- None

## Error Scenarios

- **CONTACT_PERSON_NOT_FOUND**: Specified contact person ID does not exist
- **INVALID_STATE_TRANSITION**: Contact person is not in ACTIVE status

## Test Cases

- deactivates an active contact person
- removes primary designation when deactivating primary contact
- returns error when contact not found
- returns error when contact is already inactive
