# ProductAttribute

## Description

ProductAttribute defines a variant axis that can be assigned to products. Each attribute is identified by a unique code and has a display name. Attributes hold predefined values (e.g., "Red", "Blue", "Green" for a Color attribute) that drive variant generation. All attributes are variant axes — there are no descriptive-only attributes in this module.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createProductAttribute](../command/CreateProductAttribute.md) - Create a new attribute
- [updateProductAttribute](../command/UpdateProductAttribute.md) - Update the display name of an existing attribute
- [deleteProductAttribute](../command/DeleteProductAttribute.md) - Delete an attribute that is not assigned to any product

### Query Definitions

- GetProductAttribute - Retrieve an attribute by id or code

### Models

- ProductAttribute

### Invariants

- Attribute code is required, globally unique, and immutable after creation
- Attribute name is required and must be non-empty
- Attributes must have at least one ProductAttributeValue before being used for variant generation
- Attribute deletion is blocked if the attribute is assigned to any product

### Relationships

- **Has Many ProductAttributeValues**: Attributes have a set of predefined values
- **Referenced By ProductAttributeAssignments**: Attributes are assigned to products via attribute assignment records
