# Vendor Profile Update - Quick Reference

## Endpoint
```
PATCH /api/dashboard/admin/vendors/{vendor}/profile
```

## Your Example Request
```json
{
  "logo": "d3082cdc-9e8b-49d5-828b-61163d2abe63",
  "commercial_register_number": "1010897654",
  "commercial_register_file": "142bbd15-6082-41ae-aba3-c9d31424af74",
  "stock_alert_threshold": 5,
  "expiry_alert_before_days": 30,
  "ar": {
    "name": "متجر السعيد",
    "description": "متجر متخصص في بيع المنتجات الإلكترونية والإكسسوارات"
  },
  "en": {
    "name": "saed store",
    "description": "A store specialized in selling electronics and accessories"
  }
}
```

## Optional Fields (Don't Send If Not Changing)

### Location
```json
{
  "location": {
    "city_id": 1,
    "lat": "24.713552",
    "lng": "46.675296",
    "name": "Main Branch",
    "property_number": "Building 25",
    "details": "King Fahd Road, Al Olaya District",
    "url": "https://maps.google.com/?q=24.713552,46.675296"
  }
}
```

### Categories
```json
{
  "category_ids": [1, 10]
}
```

### Delivery Settings
```json
{
  "delivery_type": "merchant",
  "delivery_cities": [
    {
      "country_id": 1,
      "city_id": 5,
      "delivery_price": 25.50
    }
  ]
}
```

## All Available Fields

| Field | Type | Example |
|-------|------|---------|
| `logo` | UUID | `"d3082cdc-9e8b-49d5-828b-61163d2abe63"` |
| `commercial_register_file` | UUID | `"142bbd15-6082-41ae-aba3-c9d31424af74"` |
| `commercial_register_number` | string | `"1010897654"` |
| `stock_alert_threshold` | integer | `5` |
| `expiry_alert_before_days` | integer | `30` |
| `iban` | string | `"SA1234567890123456789012"` |
| `delivery_type` | string | `"merchant"` or `"platform"` |
| `delivery_cities` | array | See example above |
| `ar.name` | string | `"متجر السعيد"` |
| `ar.description` | string | `"وصف المتجر"` |
| `en.name` | string | `"Saed Store"` |
| `en.description` | string | `"Store description"` |
| `location` | object | See example above |
| `category_ids` | array | `[1, 10, 15]` |

## Rules

✅ **DO:**
- Send only fields you want to update
- Send complete delivery_cities array (replaces all)
- Include city_id when sending location
- Use UUIDs for logo and commercial_register_file

❌ **DON'T:**
- Send null values for fields you don't want to update
- Send location without city_id
- Try to update categories without permission
- Forget to include existing cities when updating delivery_cities

## Quick Examples

### Update Only Stock Alert
```json
{"stock_alert_threshold": 10}
```

### Update Only Arabic Name
```json
{"ar": {"name": "متجر جديد"}}
```

### Update Delivery to Platform
```json
{"delivery_type": "platform"}
```

### Update Delivery to Merchant with Cities
```json
{
  "delivery_type": "merchant",
  "delivery_cities": [
    {"country_id": 1, "city_id": 5, "delivery_price": 25.50}
  ]
}
```

## Response
```json
{
  "status": "success",
  "message": "Vendor profile updated successfully",
  "data": {
    "id": 123,
    "merchant": {...},
    "locations": [...],
    "specialties": [...]
  }
}
```

## Errors
- `404` - Vendor merchant not found
- `403` - Cannot change categories
- `422` - Validation error
- `400` - Update failed
