# ActivateProduct

## Permission Scope

product

## Overview

activateProduct transitions a product from DRAFT to ACTIVE status, enabling variant generation and downstream operations. Once active, the set of assigned attributes and their values become locked to preserve variant consistency.

## Business Rules

- Target product must exist
- Target product must be in DRAFT status
- After activation, the attribute structure is locked: assigned attributes cannot be added or removed, and existing attribute values cannot be modified or removed. New values can still be added to existing attributes to support incremental variant generation
- After activation, UoM is locked and cannot be changed

## Process Flow

```mermaid
flowchart TD
    A[Receive activate request] --> B{Product exists?}
    B -->|No| C[Return error: PRODUCT_NOT_FOUND]
    B -->|Yes| D{Status is DRAFT?}
    D -->|No| E[Return error: INVALID_STATE_TRANSITION]
    D -->|Yes| F[Update status to ACTIVE]
    F --> G[Return activated product]
```

## External Dependencies

- None

## Error Scenarios

- **PRODUCT_NOT_FOUND**: Specified product ID does not exist
- **INVALID_STATE_TRANSITION**: Requested state transition is not allowed from the current status

## Test Cases

- returns error when product not found
- returns error when not in DRAFT status
- activates DRAFT product to ACTIVE
