# ProductCategoryAssignment

## Description

ProductCategoryAssignment is the junction entity that links products to product categories in a many-to-many relationship. A product can belong to multiple categories (e.g., a "Unisex T-Shirt" in both "Men's > T-Shirts" and "Women's > T-Shirts"), and a category can contain multiple products.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [assignProductToCategory](../command/AssignProductToCategory.md) - Assign a product to a category
- [removeProductFromCategory](../command/RemoveProductFromCategory.md) - Remove a product from a category

### Query Definitions

- GetProductCategoryAssignment - Retrieve a specific assignment by productId and categoryId
- ListProductCategoryAssignments - Retrieve all product assignments for a given category
- ListCategoryAssignmentsByProduct - Retrieve all category assignments for a given product

### Models

- ProductCategoryAssignment

### Invariants

- Each assignment references a valid Product and a valid ProductCategory
- The combination of (productId, categoryId) must be unique (no duplicate assignments)
- Assignment is idempotent -- assigning an already-assigned product returns the existing record

### Relationships

- **Belongs To Product**: Each assignment links to exactly one product
- **Belongs To ProductCategory**: Each assignment links to exactly one category
