# DeletePurchaseItem

## Permission Scope

purchaseItem

## Overview

DeletePurchaseItem withdraws an item from purchasing by removing the purchase module's record for it. The item itself is untouched and may still be sold or stocked; it simply can no longer be put on a new purchase order line.

## Business Rules

- The referenced item must already hold a purchasing record
- Purchase orders that already reference the item are left untouched — they carry their own frozen line values and remain receivable and billable
- Withdrawal is reversible by adopting the item again, which starts a fresh purchasing record

## Process Flow

```mermaid
flowchart TD
    A[Receive withdrawal request for an item] --> B{Item has a purchasing record?}
    B -->|No| C[Return ITEM_NOT_PURCHASABLE]
    B -->|Yes| D[Delete the purchasing record]
    D --> E[Item can no longer be put on new purchase order lines]
```

## External Dependencies

- None

## Error Scenarios

- **ITEM_NOT_PURCHASABLE**: Referenced item holds no purchasing record and cannot be purchased

## Test Cases

- withdraws an adopted item from purchasing
- returns error when the item has no purchasing record
