{
	"info": {
		"_postman_id": "staff-login-api",
		"name": "Staff Login API",
		"description": "API collection for staff authentication endpoints",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Staff Login",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"email\": \"admin@example.com\",\n    \"password\": \"password\",\n    \"device_name\": \"Postman Client\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{baseUrl}}/api/staff/login",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"api",
						"staff",
						"login"
					]
				},
				"description": "Authenticate staff member and receive access token"
			},
			"response": []
		},
		{
			"name": "Get Staff Info",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{authToken}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{baseUrl}}/api/staff/me",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"api",
						"staff",
						"me"
					]
				},
				"description": "Get authenticated staff member information"
			},
			"response": []
		},
		{
			"name": "Refresh Token",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{authToken}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{baseUrl}}/api/staff/refresh",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"api",
						"staff",
						"refresh"
					]
				},
				"description": "Refresh authentication token"
			},
			"response": []
		},
		{
			"name": "Staff Logout",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{authToken}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{baseUrl}}/api/staff/logout",
					"host": [
						"{{baseUrl}}"
					],
					"path": [
						"api",
						"staff",
						"logout"
					]
				},
				"description": "Logout staff member and revoke token"
			},
			"response": []
		}
	],
	"variable": [
		{
			"key": "baseUrl",
			"value": "http://localhost:8001",
			"type": "string"
		},
		{
			"key": "authToken",
			"value": "",
			"type": "string"
		}
	],
	"event": [
		{
			"listen": "test",
			"script": {
				"exec": [
					"// Auto-extract token from login response",
					"if (pm.response.code === 200 && pm.request.url.path.includes('login')) {",
					"    const response = pm.response.json();",
					"    if (response.status === 'success' && response.data.token) {",
					"        pm.collectionVariables.set('authToken', response.data.token);",
					"        console.log('Token extracted and saved:', response.data.token);",
					"    }",
					"}",
					"",
					"// Clear token on logout",
					"if (pm.response.code === 200 && pm.request.url.path.includes('logout')) {",
					"    pm.collectionVariables.set('authToken', '');",
					"    console.log('Token cleared after logout');",
					"}",
					"",
					"// Update token on refresh",
					"if (pm.response.code === 200 && pm.request.url.path.includes('refresh')) {",
					"    const response = pm.response.json();",
					"    if (response.status === 'success' && response.data.token) {",
					"        pm.collectionVariables.set('authToken', response.data.token);",
					"        console.log('Token updated:', response.data.token);",
					"    }",
					"}"
				],
				"type": "text/javascript"
			}
		}
	]
}
