# RecallPurchaseRequisition

## Permission Scope

purchaseRequisition

## Overview

RecallPurchaseRequisition returns a submitted purchase requisition's `status` to `DRAFT` before the approver has reviewed it, allowing the requester to revise the document.

## Business Rules

- Target purchase requisition must exist
- Only requisitions with `status` = `SUBMITTED` can be recalled
- Only the original requester can recall the requisition
- Recall does not alter line content; it only changes `status` back to `DRAFT`

## Process Flow

```mermaid
flowchart TD
    A[Receive recall request] --> B{Purchase requisition exists?}
    B -->|No| C[Return PURCHASE_REQUISITION_NOT_FOUND]
    B -->|Yes| D{Status is SUBMITTED?}
    D -->|No| E[Return PURCHASE_REQUISITION_NOT_SUBMITTED]
    D -->|Yes| F{Caller is the original requester?}
    F -->|No| G[Return RECALL_NOT_AUTHORIZED]
    F -->|Yes| H["Set status to DRAFT"]
    H --> I[Return recalled requisition]
```

## External Dependencies

- None

## Error Scenarios

- **PURCHASE_REQUISITION_NOT_FOUND**: Referenced purchase requisition does not exist
- **PURCHASE_REQUISITION_NOT_SUBMITTED**: Purchase requisition is not in `SUBMITTED` status
- **RECALL_NOT_AUTHORIZED**: Caller is not the original requester of the requisition

## Test Cases

- recalls a submitted purchase requisition back to draft
- returns error when purchase requisition does not exist
- returns error when purchase requisition is not submitted
- returns error when caller is not the original requester
