{
  "info": {
    "name": "SPARESHUB — Ratings (Order-based)",
    "description": "تقييمات مربوطة بالطلب.\n\nbase_url لازم يوصل لمجلد public + بادئة api:\n- php artisan serve: http://127.0.0.1:8000/api\n- WAMP (مثال): http://localhost/SPARESHUB/public/api\n\nلا تستخدم http://localhost/api وحده — غالباً 404 من Apache لأن المسار مو Laravel.\n\nغيّر التوكنات و order_id.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "http://127.0.0.1:8000/api" },
    { "key": "customer_token", "value": "" },
    { "key": "store_token", "value": "" },
    { "key": "admin_token", "value": "" },
    { "key": "super_admin_token", "value": "" },
    { "key": "order_id", "value": "1" },
    { "key": "rating_id", "value": "1" },
    { "key": "customer_user_id", "value": "1" }
  ],
  "item": [
    {
      "name": "Customer — Get order review",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{customer_token}}" }
        ],
        "url": "{{base_url}}/user/orders/{{order_id}}/reviews"
      }
    },
    {
      "name": "Customer — Upsert order review",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Content-Type", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{customer_token}}" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"score\": 5,\n  \"review\": \"Excellent\"\n}"
        },
        "url": "{{base_url}}/user/orders/{{order_id}}/reviews"
      }
    },
    {
      "name": "Customer — Get order (ratings if loaded)",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{customer_token}}" }
        ],
        "url": "{{base_url}}/user/orders/{{order_id}}"
      }
    },
    {
      "name": "Store — Reviews report",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{store_token}}" }
        ],
        "url": "{{base_url}}/store/reviews"
      }
    },
    {
      "name": "Store — Dashboard reviews",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{store_token}}" }
        ],
        "url": "{{base_url}}/shop/dashboard/reviews"
      }
    },
    {
      "name": "Admin — List ratings",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{admin_token}}" }
        ],
        "url": "{{base_url}}/admin/ratings?is_handled=false"
      }
    },
    {
      "name": "Admin — Set rating handled",
      "request": {
        "method": "PUT",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Content-Type", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{admin_token}}" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"is_handled\": true\n}"
        },
        "url": "{{base_url}}/admin/ratings/{{rating_id}}"
      }
    },
    {
      "name": "Super Admin — Customer (ratings_and_reviews)",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{super_admin_token}}" }
        ],
        "url": "{{base_url}}/super_admin/customers/{{customer_user_id}}"
      }
    },
    {
      "name": "Super Admin — Customer orders",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Accept", "value": "application/json" },
          { "key": "Authorization", "value": "Bearer {{super_admin_token}}" }
        ],
        "url": "{{base_url}}/super_admin/customers/{{customer_user_id}}/orders"
      }
    }
  ]
}
