# Supply Agent Assignment Endpoints

## Overview
This document lists the endpoints for assigning purchasing representatives (supply agents) to supply order items.

## Endpoints

### 1. Get List of Supply Agents (Representatives)
**URL:** `GET /api/v1/supply/representatives`

---

### 2. Assign Representative to Single Item
**URL:** `POST /api/v1/supply/orders/{order}/items/{item}/assign-delegate`
---

### 3. Bulk Assign Representatives to Multiple Items
**URL:** `POST /api/v1/supply/orders/{order}/items/assign-delegate-bulk`
---

### 4. Get My Delegated Items (For Agents)
**URL:** `GET /api/v1/supply/order-items/my-delegated-items`

---

## Workflow

1. **Create Supply Order:** User creates a supply order with items.

2. **Select Representative:** 
   - Call `GET /api/v1/supply/representatives` to get the list of available representatives
   - Display in dropdown/select within each item's line in the items table
   - User selects a representative for one or more items

3. **Assign Representative:**
   - For single item: Use `POST /api/v1/supply/orders/{order}/items/{item}/assign-delegate`
   - For multiple items: Use `POST /api/v1/supply/orders/{order}/items/assign-delegate-bulk`

4. **Save Order:** Order is saved with associated representatives.

5. **Agent View:** Agents can view their delegated items using `GET /api/v1/supply/order-items/my-delegated-items`

---

## Frontend Integration Points

### Create Supply Order - Items Table
- Each item row should have a dropdown/select field
- Call `GET /api/v1/supply/representatives` to populate the dropdown
- On selection, call `POST /api/v1/supply/orders/{order}/items/{item}/assign-delegate`

### Order List - Item Dropdown
- Each item in the order list should have an optional select field
- Call `GET /api/v1/supply/representatives` to populate the dropdown
- Support bulk selection: select multiple items and assign representatives using `POST /api/v1/supply/orders/{order}/items/assign-delegate-bulk`

### Delegated Items Page (For Agents)
- Call `GET /api/v1/supply/order-items/my-delegated-items` to display items assigned to the current agent
- Agents can track assigned items and submit price quotes to suppliers

