# Remove Product From Category

<!-- 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

As a product manager, I want to remove a product from a category, so that I can correct mis-categorisations or reorganise product placement.

## 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[Category Detail Screen]
    B --> C{Confirm remove product}
    C -- Confirmed --> D{Assignment exists?}
    D -- Yes --> E[Product removed from category]
    D -- No --> F[Error: Product is not assigned to this category]
    E --> B
```

## Scenario Patterns

- Successful removal: the product is currently assigned to the category; the assignment is deleted
- Not assigned error: the product is not assigned to the given category; the request is rejected

## Test Cases

- Given a category and a product that is currently assigned to it, the assignment is removed successfully
- Given a category and a product that is not assigned to it, the removal fails with a not assigned error

## Screens

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

## Resolvers

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

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