# DeactivatePurchasePriceList

## Permission Scope

purchasePricing

## Overview

DeactivatePurchasePriceList retires a supplier price list from future defaulting while preserving all orders that already used one of its rules.

## Business Rules

- Target price list must exist
- Deactivating an already inactive list returns success without changing state
- Deactivated lists are ignored by price resolution for new draft orders
- Historical purchase orders keep their ordered prices and matched rule references

## Process Flow

```mermaid
flowchart TD
    A[Receive deactivate request] --> B{Price list exists?}
    B -->|No| C[Return PRICE_LIST_NOT_FOUND]
    B -->|Yes| D{Already inactive?}
    D -->|Yes| E[Return success with no-op]
    D -->|No| F[Set status to INACTIVE]
    F --> G[Return deactivated list]
```

## External Dependencies

- None

## Error Scenarios

- **PRICE_LIST_NOT_FOUND**: Referenced purchase price list does not exist

## Test Cases

- deactivates an active price list
- returns success when the list is already inactive
- preserves historical purchase-order snapshots after deactivation
- returns error when price list does not exist
