# GetProductAttributeValue

## Overview

GetProductAttributeValue retrieves a single product attribute value record by id or by the combination of attributeId and label. Used for existence checks before updating or removing attribute values, validating attribute value references in attribute assignment commands, and enforcing label uniqueness within an attribute.

## Business Rules

- Accepts one of two lookup variants:
  - `{ id }` — retrieves by unique identifier (used for existence/state checks in lifecycle commands)
  - `{ attributeId, label }` — retrieves by attribute and label combination (used for uniqueness validation during creation; label must be unique within an attribute)
- Returns the full attribute value record including all fields (id, attributeId, label, timestamps)
- Returns null if no matching attribute value is found
- Label comparison is exact (case-sensitive)

## Process Flow

```mermaid
flowchart TD
    A[Receive input] --> B{Which lookup?}
    B -->|id| C[SELECT from ProductAttributeValue where id = input.id]
    B -->|attributeId + label| D[SELECT from ProductAttributeValue where attributeId = input.attributeId AND label = input.label]
    C --> E{Value found?}
    D --> E
    E -->|Yes| F[Return value record]
    E -->|No| G[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **VALUE_NOT_FOUND**: Specified attribute value ID does not exist

## Test Cases

- returns value when found
- returns null when not found
