{
  "info": {
    "name": "Profile Update Request API",
    "description": "Complete API collection for Profile Update Request system",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost:8000",
      "type": "string"
    },
    {
      "key": "vendor_token",
      "value": "",
      "type": "string"
    },
    {
      "key": "admin_token",
      "value": "",
      "type": "string"
    },
    {
      "key": "logo_media_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "file_media_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "request_id",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "1. Media Upload",
      "item": [
        {
          "name": "Upload Logo (Image)",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    var jsonData = pm.response.json();",
                  "    pm.collectionVariables.set('logo_media_id', jsonData.data.id);",
                  "    console.log('Logo Media ID saved: ' + jsonData.data.id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": []
                },
                {
                  "key": "model",
                  "value": "Profile",
                  "type": "text"
                },
                {
                  "key": "media_type",
                  "value": "image",
                  "type": "text"
                },
                {
                  "key": "width",
                  "value": "800",
                  "type": "text"
                },
                {
                  "key": "height",
                  "value": "800",
                  "type": "text"
                },
                {
                  "key": "quality",
                  "value": "85",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/media",
              "host": ["{{base_url}}"],
              "path": ["api", "media"]
            }
          }
        },
        {
          "name": "Upload Commercial Register (PDF)",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    var jsonData = pm.response.json();",
                  "    pm.collectionVariables.set('file_media_id', jsonData.data.id);",
                  "    console.log('File Media ID saved: ' + jsonData.data.id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": []
                },
                {
                  "key": "model",
                  "value": "Profile",
                  "type": "text"
                },
                {
                  "key": "media_type",
                  "value": "pdf",
                  "type": "text"
                },
                {
                  "key": "generate_thumbnail",
                  "value": "true",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/api/media",
              "host": ["{{base_url}}"],
              "path": ["api", "media"]
            }
          }
        }
      ]
    },
    {
      "name": "2. Vendor - Profile Update Requests",
      "item": [
        {
          "name": "Create Profile Update Request",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200 || pm.response.code === 201) {",
                  "    var jsonData = pm.response.json();",
                  "    pm.collectionVariables.set('request_id', jsonData.data.id);",
                  "    console.log('Request ID saved: ' + jsonData.data.id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"logo\": \"{{logo_media_id}}\",\n  \"commercial_register_file\": \"{{file_media_id}}\",\n  \"commercial_register_number\": \"CR-2024-123456\",\n  \"ar\": {\n    \"name\": \"متجر الإلكترونيات الحديثة\",\n    \"description\": \"نحن متجر متخصص في بيع الأجهزة الإلكترونية والهواتف الذكية بأفضل الأسعار وأعلى جودة في المملكة\"\n  },\n  \"en\": {\n    \"name\": \"Modern Electronics Store\",\n    \"description\": \"We are a store specialized in selling electronic devices and smartphones at the best prices and highest quality in the Kingdom\"\n  },\n  \"location\": {\n    \"country_id\": 1,\n    \"city_id\": 5,\n    \"lat\": 24.7136,\n    \"lng\": 46.6753,\n    \"name\": \"Main Branch - Riyadh\",\n    \"property_number\": \"1234\",\n    \"details\": \"Building 15, Floor 2, Office 201\",\n    \"url\": \"https://maps.google.com/?q=24.7136,46.6753\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests"]
            }
          }
        },
        {
          "name": "Get Vendor's Requests (List)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests?per_page=15",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests"],
              "query": [
                {
                  "key": "per_page",
                  "value": "15"
                },
                {
                  "key": "status",
                  "value": "pending",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Get Request Details",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests/{{request_id}}",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests", "{{request_id}}"]
            }
          }
        },
        {
          "name": "Delete Request (Pending Only)",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests/{{request_id}}",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests", "{{request_id}}"]
            }
          }
        }
      ]
    },
    {
      "name": "3. Admin - Profile Update Requests",
      "item": [
        {
          "name": "Get All Requests (List)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/dashboard/admin/profile-update-requests?per_page=15",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "admin", "profile-update-requests"],
              "query": [
                {
                  "key": "per_page",
                  "value": "15"
                },
                {
                  "key": "status",
                  "value": "pending",
                  "disabled": true
                },
                {
                  "key": "vendor_id",
                  "value": "1",
                  "disabled": true
                },
                {
                  "key": "search",
                  "value": "electronics",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Get Request Details (Admin View)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/dashboard/admin/profile-update-requests/{{request_id}}",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "admin", "profile-update-requests", "{{request_id}}"]
            }
          }
        },
        {
          "name": "Approve Request",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{}"
            },
            "url": {
              "raw": "{{base_url}}/api/dashboard/admin/profile-update-requests/{{request_id}}/approve",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "admin", "profile-update-requests", "{{request_id}}", "approve"]
            }
          }
        },
        {
          "name": "Reject Request",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"reason\": \"The commercial register file is not clear. Please upload a higher quality document.\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/dashboard/admin/profile-update-requests/{{request_id}}/reject",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "admin", "profile-update-requests", "{{request_id}}", "reject"]
            }
          }
        },
        {
          "name": "Delete Request",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/dashboard/admin/profile-update-requests/{{request_id}}",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "admin", "profile-update-requests", "{{request_id}}"]
            }
          }
        }
      ]
    },
    {
      "name": "4. Example Requests",
      "item": [
        {
          "name": "Minimal Request (Required Only)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"ar\": {\n    \"name\": \"متجر الإلكترونيات\",\n    \"description\": \"متجر متخصص في بيع الأجهزة الإلكترونية\"\n  },\n  \"en\": {\n    \"name\": \"Electronics Store\",\n    \"description\": \"Store specialized in selling electronic devices\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests"]
            }
          }
        },
        {
          "name": "With Logo Only",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"logo\": \"{{logo_media_id}}\",\n  \"ar\": {\n    \"name\": \"متجر الإلكترونيات\",\n    \"description\": \"متجر متخصص في بيع الأجهزة الإلكترونية\"\n  },\n  \"en\": {\n    \"name\": \"Electronics Store\",\n    \"description\": \"Store specialized in selling electronic devices\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests"]
            }
          }
        },
        {
          "name": "With Location Only",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{vendor_token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"ar\": {\n    \"name\": \"متجر الإلكترونيات\",\n    \"description\": \"متجر متخصص في بيع الأجهزة الإلكترونية\"\n  },\n  \"en\": {\n    \"name\": \"Electronics Store\",\n    \"description\": \"Store specialized in selling electronic devices\"\n  },\n  \"location\": {\n    \"country_id\": 1,\n    \"city_id\": 5,\n    \"lat\": 24.7136,\n    \"lng\": 46.6753,\n    \"name\": \"Main Branch\",\n    \"property_number\": \"1234\",\n    \"details\": \"Near King Fahd Road\",\n    \"url\": \"https://maps.google.com/?q=24.7136,46.6753\"\n  }\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/dashboard/vendor/profile-update-requests",
              "host": ["{{base_url}}"],
              "path": ["api", "dashboard", "vendor", "profile-update-requests"]
            }
          }
        }
      ]
    }
  ]
}
