# SubmitStockAdjustment

## Permission Scope

inventoryControl

## Overview

submitStockAdjustment transitions a stock adjustment from DRAFT to SUBMITTED status. This submits the adjustment for review by an authorized approver. No inventory changes occur at this stage; the adjustment lines are frozen and can no longer be modified.

## Business Rules

- Stock adjustment must exist
- Stock adjustment must be in DRAFT status
- Transitions status from DRAFT to SUBMITTED
- No inventory or ledger changes occur

## Process Flow

```mermaid
flowchart TD
    A[Submit stock adjustment request] --> B{Adjustment exists?}
    B -->|No| C[Return error: STOCK_ADJUSTMENT_NOT_FOUND]
    B -->|Yes| D{Status is DRAFT?}
    D -->|No| E[Return error: INVALID_STATUS]
    D -->|Yes| F[Transition to SUBMITTED]
    F --> G[Return updated stock adjustment]
```

## External Dependencies

- [inventory::StockAdjustment](../models/StockAdjustment.md) - Validates existence and current status, updates status to SUBMITTED

## Error Scenarios

- **STOCK_ADJUSTMENT_NOT_FOUND**: Referenced stock adjustment does not exist
- **INVALID_STATUS**: Target entity is not in a valid status for this operation

## Test Cases

- returns error when stock adjustment does not exist
- returns error when stock adjustment is not in DRAFT status
- transitions stock adjustment from DRAFT to SUBMITTED
