# DeletePipelineItem

## Permission Scope

item

## Overview

Deletes an item from a pipeline. The item is permanently removed regardless of its current stage, along with all of its dependent rows (label attachments, comments, change history, and stage transitions), since no DB-level cascade exists.

## Business Rules

- PipelineItem must exist
- PipelineItem is permanently removed
- Dependent rows are cascaded in the same transaction: PipelineItemLabel, PipelineItemComment, PipelineItemChange, and PipelineStageTransition rows referencing the item are deleted

## Process Flow

```mermaid
flowchart TD
    A[Receive deletePipelineItem input] --> B{PipelineItem exists?}
    B -->|No| C[Return ITEM_NOT_FOUND]
    B -->|Yes| D[Delete PipelineItemLabel / PipelineItemComment / PipelineItemChange / PipelineStageTransition rows]
    D --> E[Delete item]
    E --> F[Return deleted PipelineItem]
```

## External Dependencies

- None

## Error Scenarios

- **ITEM_NOT_FOUND**: Specified item ID does not exist

## Test Cases

- deletes the item and cascades its dependent rows
- returns error when item not found
