{
  "info": {
    "_postman_id": "7a0a48ca-cc6f-4a70-bf9f-f497ceacf799",
    "name": "Restaurant POS - Staff Mobile API",
    "description": "Staff-only mobile authentication API. Run Login first; its token is saved automatically for Me and Logout.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "http://127.0.0.1:8000"
    },
    {
      "key": "staff_token",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "1. Staff Login",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Login succeeded', function () {",
              "    pm.response.to.have.status(200);",
              "});",
              "",
              "if (pm.response.code === 200) {",
              "    const response = pm.response.json();",
              "    pm.collectionVariables.set('staff_token', response.token);",
              "}"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"phone\": \"9876543210\",\n    \"password\": \"password\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{base_url}}/api/staff/login",
          "host": ["{{base_url}}"],
          "path": ["api", "staff", "login"]
        },
        "description": "Replace phone and password with an active account whose role is staff. A successful response automatically saves the token."
      }
    },
    {
      "name": "2. Get Logged-in Staff",
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{staff_token}}",
              "type": "string"
            }
          ]
        },
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/staff/me",
          "host": ["{{base_url}}"],
          "path": ["api", "staff", "me"]
        }
      }
    },
    {
      "name": "3. Staff Logout",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "if (pm.response.code === 200) {",
              "    pm.collectionVariables.unset('staff_token');",
              "}"
            ]
          }
        }
      ],
      "request": {
        "auth": {
          "type": "bearer",
          "bearer": [
            {
              "key": "token",
              "value": "{{staff_token}}",
              "type": "string"
            }
          ]
        },
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/staff/logout",
          "host": ["{{base_url}}"],
          "path": ["api", "staff", "logout"]
        }
      }
    }
  ]
}
