# DeleteItem

## Permission Scope

item

## Overview

deleteItem permanently removes a DRAFT item from the system. Only items in DRAFT status can be deleted — ACTIVE and INACTIVE items are preserved for audit trails and historical reference. This supports draft cleanup workflows where unwanted items are removed before activation.

## Business Rules

- Target item must exist in the system
- Target item must be in DRAFT status
- ACTIVE and INACTIVE items cannot be deleted — they must be preserved for audit trails
- Deletion is permanent and cannot be undone
- Any taxonomy assignments for the item should be removed before or as part of deletion

## Process Flow

```mermaid
flowchart TD
    A[Receive delete request] --> B{Item exists?}
    B -->|No| C[Return error: not found]
    B -->|Yes| D{Status is DRAFT?}
    D -->|No| E[Return error: cannot delete non-draft item]
    D -->|Yes| F[Remove taxonomy assignments]
    F --> G[Delete item record]
    G --> H[Return success]
```

## External Dependencies

- None

## Error Scenarios

- **ITEM_NOT_FOUND**: Specified item ID does not exist
- **DELETE_NON_DRAFT**: Item is in ACTIVE or INACTIVE status — only DRAFT items can be deleted

## Test Cases

- returns error when item does not exist
- returns error when item is ACTIVE
- returns error when item is INACTIVE
- deletes a DRAFT item and removes taxonomy assignments
