# CreateValuationPolicy

## Overview

createValuationPolicy creates a new valuation policy that defines the costing method used to calculate inventory value. Supported costing methods are FIFO (First In, First Out), AVCO (Average Cost), and STANDARD_COST (fixed standard cost rate).

## Business Rules

- Name is required
- costingMethod is required and must be one of: FIFO, AVCO, STANDARD_COST
- standardCostRate is required when costingMethod is STANDARD_COST
- standardCostRate is not required for FIFO or AVCO methods

## Process Flow

```mermaid
flowchart TD
    A[Receive create request] --> B{Name provided?}
    B -->|No| C[Return error: name required]
    B -->|Yes| D{Valid costingMethod?}
    D -->|No| E[Return error: INVALID_COSTING_METHOD]
    D -->|Yes| F{costingMethod is STANDARD_COST?}
    F -->|Yes| G{standardCostRate provided?}
    G -->|No| H[Return error: STANDARD_COST_RATE_REQUIRED]
    G -->|Yes| I[Create valuation policy]
    F -->|No| I
    I --> J[Return created policy]
```

## External Dependencies

- None

## Error Scenarios

- **INVALID_COSTING_METHOD**: costingMethod is not a recognized value (must be FIFO, AVCO, or STANDARD_COST)
- **STANDARD_COST_RATE_REQUIRED**: costingMethod is STANDARD_COST but no standardCostRate was provided

## Test Cases

- returns error when invalid costing method
- returns error when standard cost without rate
- creates FIFO policy
- creates AVCO policy
- creates standard cost policy with rate
