# DetectBillOfMaterialCircularReference

## Overview

DetectBillOfMaterialCircularReference checks whether adding or activating a manufactured-child component would introduce a direct or indirect loop in the BOM graph.

## Business Rules

- Company scope and both item references are required.
- The query traverses only manufactured-child BOM references.
- The result returns whether a loop exists and the detected item path when one is found.

## Process Flow

```mermaid
flowchart TD
    A[Receive company and item references] --> B[Traverse manufactured-child BOM graph]
    B --> C{Loop found?}
    C -->|Yes| D[Return loop path]
    C -->|No| E[Return no circular reference]
```

## External Dependencies

- None

## Error Scenarios

- **COMPANY_SCOPE_REQUIRED**: Company scope was not provided.
- **ITEM_REFERENCE_REQUIRED**: Parent or child item reference is missing.

## Test Cases

- detects a direct BOM loop
- detects an indirect BOM loop across multiple subassemblies
- returns no loop when the graph is acyclic
- scopes detection to the requested company
- returns error when parent or child reference is missing
- returns error when company scope is missing
