# Provider API Reference Updates

This document summarizes all the new Endpoints and JSON Response Keys added for Providers regarding Teams, Negotiation, and Pricing/Discounts.

## 1. New Provider Endpoints

### **Teams Management**
Providers can fetch the teams they have been added to by the admin.
*   **Endpoint:** `GET /api/provider/teams`
*   **Details:** Returns a list of all teams the provider belongs to, including the team members and whether the provider is the leader (`am_i_leader`).
*   **Endpoint:** `GET /api/provider/teams/{id}`
*   **Details:** Show details for a specific team.

### **Order Negotiation Response**
Providers use this to respond to client negotiations.
*   **Endpoint:** `POST /api/provider/service-orders/{id}/negotiation/respond`
*   **Body Parameters:**
    *   `action` (required, string): Must be `accept`, `reject`, or `counter`.
    *   `counter_price` (required if action = counter, numeric).

### **Filtering by Team or Individual Orders**
The existing provider list endpoints now support filtering by team.
*   **Pending Requests:** `GET /api/provider/service-order-requests?type=team` (or `type=individual`)
*   **All Orders:** `GET /api/provider/service-orders?status=active&type=individual` (or `type=team`)

---

## 2. New Keys in Provider Order Resources

The API responses for Service Orders (`GET /api/provider/service-orders/{id}`) now include the following newly added keys:

### **Team Information Keys**
If the order is a team order, the response includes a `team_data` object. If it is an individual order, it will be `null`.
```json
"team_data": {
    "id": 1,
    "name": "Design Masters",
    "avatar": "https://example.com/avatar.jpg"
}
```

### **Pricing**
The provider only sees their final cut for the service (total minus VAT).
```json
"service_price": 500.00
```

### **Negotiation Keys**
Providers can see the negotiation state for both pending requests and active orders:
```json
"is_negotiated": true,
"negotiation_price": 450.00,
"negotiation_turn": "client",
"negotiation_accepted_at": 1718302910
```
