# Manage Attribute Values

<!-- User story defining a specific requirement within a business flow.
The name of the story should start with the actor followed by `--` and the story name.
 -->

<!-- This section should contain the following subsections in order: -->
<!-- 1. ## User Story (required) -->
<!-- 2. ## Story Diagram (required) -->
<!-- 3. ## Scenario Patterns (required) -->
<!-- 4. ## Test Cases (required) -->
<!-- 5. ## Screens (required) -->
<!-- 6. ## Resolvers (required) -->

## User Story

<!-- Define the user story in the format:
As a [role], I want [goal], so that [benefit].
 -->

As a product manager, I want to add, edit, and delete values for an attribute, so that the attribute has the correct set of options available for product variant generation.

## Story Diagram

<!-- Mermaid flowchart showing user interactions with screens.
Focus on actors, UI screens, and business outcomes.
Avoid technical details (APIs, databases, endpoints).
 -->

<!-- Code block requirements: -->
<!-- Minimum 1 mermaid code blocks required -->

```mermaid
flowchart TD
    A([Product Manager]) --> B[Attribute Detail Screen]
    B --> C{Choose Action}
    C -- Add Value --> D[Add Attribute Value Form]
    D --> E{Validate}
    E -- Missing required field --> F[Show Error: Required Field Missing]
    E -- Valid --> G[Attribute Value Added]
    G --> B
    F --> D
    C -- Edit Value --> H[Edit Attribute Value Form]
    H --> I{Validate}
    I -- Missing required field --> J[Show Error: Required Field Missing]
    I -- Valid --> K[Attribute Value Updated]
    K --> B
    J --> H
    C -- Delete Value --> L{Confirm Delete}
    L -- Cancel --> B
    L -- Confirm --> M[Attribute Value Deleted]
    M --> B
```

## Scenario Patterns

<!-- List requirements: -->
<!-- Minimum 1 unordered lists required -->
<!-- Minimum 1 items per list -->

- Product manager adds a new value (e.g., Red) to an attribute (e.g., Color) and the value appears in the attribute's value list.
- Product manager edits an existing value and the updated name is reflected.
- Product manager deletes a value that is not in use and it is removed from the list.
- If a required field is missing when adding or editing a value, an error is shown.

## Test Cases

<!-- List requirements: -->
<!-- Minimum 1 items per list -->

- Given a valid value name, when adding a value, then the value is created and listed under the attribute.
- Given a missing required field, when adding or editing a value, then a validation error is shown.
- Given an existing value, when edited with a valid name, then the value is updated.
- Given an existing value, when deleted, then the value is removed from the attribute.

## Screens

<!-- Link to screen docs that implement this story's UI.
 -->

<!-- List requirements: -->
<!-- Minimum 1 unordered lists required -->
<!-- Minimum 1 items per list -->

- [attribute-detail](../../../screen/attribute-detail.md)

## Resolvers

<!-- Link to resolver docs that implement this story's backend operations.
Write "None" if this story does not require any resolvers.
 -->

<!-- List requirements: -->
<!-- Minimum 1 items per list -->

- [updateAttribute](../../../resolver/updateAttribute.md)
