# UpdateLot

## Permission Scope

inventoryMaster

## Overview

updateLot modifies the mutable fields of a lot record, including manufactureDate, expirationDate, and supplierLotReference. `lotNumber` is fixed by the existing record and is not part of the update input.

## Business Rules

- Lot must exist
- Lot must not be in FULLY_CONSUMED status
- lotNumber is not part of the update input
- Can update manufactureDate, expirationDate, and supplierLotReference

## Process Flow

```mermaid
flowchart TD
    A[Receive update request] --> B{Lot exists?}
    B -->|No| C[Return error: LOT_NOT_FOUND]
    B -->|Yes| D{Status is FULLY_CONSUMED?}
    D -->|Yes| E[Return error: LOT_FULLY_CONSUMED]
    D -->|No| F[Update mutable fields]
    F --> G[Return updated lot]
```

## External Dependencies

- None

## Error Scenarios

- **LOT_NOT_FOUND**: Referenced lot does not exist
- **LOT_FULLY_CONSUMED**: Lot is in FULLY_CONSUMED status and cannot be updated

## Test Cases

- returns error when lot not found
- returns error when lot is FULLY_CONSUMED
- updates expiration date
- updates supplier lot reference
- lot number is not part of the update input
