{
  "info": {
    "_postman_id": "dashboard-collection-001",
    "name": "Maham Expo - Dashboard",
    "description": "Dashboard & Analytics collection — statistics, metrics, and reporting.\n\nFocused on:\n- /v1/manage/dashboard — Overview stats\n- /v1/manage/statistics — Detailed statistics\n- /v1/manage/analytics/* — Views, actions, users analytics\n\n**Headers (auto-added via pre-request):**\n- Accept: application/json\n- Accept-Language: {{language}}\n- X-Platform: {{platform}}",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{admin_token}}", "type": "string" }]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "pm.request.headers.add({ key: 'Accept', value: 'application/json' });",
          "pm.request.headers.add({ key: 'Accept-Language', value: pm.environment.get('language') || 'ar' });",
          "pm.request.headers.add({ key: 'X-Platform', value: pm.environment.get('platform') || 'web' });"
        ]
      }
    }
  ],
  "variable": [],
  "item": [
    {
      "name": "🔐 Auth",
      "item": [
        {
          "name": "Login as Admin",
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["var jsonData = pm.response.json();", "if (jsonData.data && jsonData.data.access_token) {", "    pm.environment.set('admin_token', jsonData.data.access_token);", "    pm.environment.set('auth_token', jsonData.data.access_token);", "}", "if (jsonData.data && jsonData.data.user) {", "    pm.environment.set('user_id', jsonData.data.user.id);", "}"] } }],
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "header": [],
            "body": { "mode": "raw", "raw": "{\n    \"identifier\": \"admin@example.com\",\n    \"password\": \"password\",\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{auth_url}}/v1/auth/login", "host": ["{{auth_url}}"], "path": ["v1", "auth", "login"] },
            "description": "Login as Admin for dashboard access. Saves `admin_token` and `auth_token`.\n\nCan also use `supervisor_token` or `super_admin_token`."
          }
        },
        {
          "name": "Login as SuperAdmin",
          "event": [{ "listen": "test", "script": { "type": "text/javascript", "exec": ["var jsonData = pm.response.json();", "if (jsonData.data && jsonData.data.access_token) {", "    pm.environment.set('super_admin_token', jsonData.data.access_token);", "    pm.environment.set('auth_token', jsonData.data.access_token);", "}"] } }],
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "header": [],
            "body": { "mode": "raw", "raw": "{\n    \"identifier\": \"superadmin@example.com\",\n    \"password\": \"password\",\n}", "options": { "raw": { "language": "json" } } },
            "url": { "raw": "{{auth_url}}/v1/auth/login", "host": ["{{auth_url}}"], "path": ["v1", "auth", "login"] }
          }
        }
      ]
    },
    {
      "name": "📊 Dashboard",
      "description": "Main dashboard overview.\n\n**Permission:** dashboard.view",
      "item": [
        { "name": "Dashboard Overview", "request": { "method": "GET", "header": [], "url": { "raw": "{{expo_url}}/v1/manage/dashboard", "host": ["{{expo_url}}"], "path": ["v1", "manage", "dashboard"] }, "description": "Returns dashboard overview: total events, users, revenue, recent activity, etc." } }
      ]
    },
    {
      "name": "📈 Statistics",
      "description": "Detailed statistics.\n\n**Permission:** dashboard.view",
      "item": [
        { "name": "Statistics", "request": { "method": "GET", "header": [], "url": { "raw": "{{expo_url}}/v1/manage/statistics", "host": ["{{expo_url}}"], "path": ["v1", "manage", "statistics"] }, "description": "Returns detailed statistics across all entities." } }
      ]
    },
    {
      "name": "🔍 Analytics",
      "description": "Analytics endpoints with period, platform, and action filters.\n\n**Permission:** reports.view\n\n**Query Parameters:**\n- `period` — day, week, month, year (default: month)\n- `platform` — web, mobile, api\n- `action` — filter by specific action type",
      "item": [
        { "name": "Analytics Overview", "request": { "method": "GET", "header": [], "url": { "raw": "{{expo_url}}/v1/manage/analytics", "host": ["{{expo_url}}"], "path": ["v1", "manage", "analytics"], "query": [{ "key": "period", "value": "month", "disabled": true, "description": "day | week | month | year" }, { "key": "platform", "value": "", "disabled": true, "description": "web | mobile | api" }] }, "description": "Aggregated analytics overview." } },
        { "name": "Views Analytics", "request": { "method": "GET", "header": [], "url": { "raw": "{{expo_url}}/v1/manage/analytics/views", "host": ["{{expo_url}}"], "path": ["v1", "manage", "analytics", "views"], "query": [{ "key": "period", "value": "month", "disabled": true, "description": "day | week | month | year" }, { "key": "platform", "value": "", "disabled": true, "description": "web | mobile | api" }] }, "description": "Page/entity view analytics." } },
        { "name": "Actions Analytics", "request": { "method": "GET", "header": [], "url": { "raw": "{{expo_url}}/v1/manage/analytics/actions", "host": ["{{expo_url}}"], "path": ["v1", "manage", "analytics", "actions"], "query": [{ "key": "period", "value": "month", "disabled": true, "description": "day | week | month | year" }, { "key": "action", "value": "", "disabled": true, "description": "Filter by action type" }, { "key": "platform", "value": "", "disabled": true, "description": "web | mobile | api" }] }, "description": "User action analytics (clicks, bookmarks, etc.)." } },
        { "name": "Users Analytics", "request": { "method": "GET", "header": [], "url": { "raw": "{{expo_url}}/v1/manage/analytics/users", "host": ["{{expo_url}}"], "path": ["v1", "manage", "analytics", "users"], "query": [{ "key": "period", "value": "month", "disabled": true, "description": "day | week | month | year" }, { "key": "platform", "value": "", "disabled": true, "description": "web | mobile | api" }] }, "description": "User activity and registration analytics." } }
      ]
    }
  ]
}
