{
	"info": {
		"_postman_id": "7d9e2b1c-5a4d-4e3f-9b2c-1a8d7f6e5d4c",
		"name": "Maintenance Visit Execution (GPS & Geofencing)",
		"description": "Collection for testing maintenance visit lifecycle with GPS geofencing and supervisor overrides.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Execution Lifecycle",
			"item": [
				{
					"name": "1. Confirm Receipt",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/confirm-receipt",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"confirm-receipt"
							]
						}
					},
					"response": []
				},
				{
					"name": "2. Depart (Warn if far)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"lat\": 24.7136,\n    \"lng\": 46.6753\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/depart",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"depart"
							]
						}
					},
					"response": []
				},
				{
					"name": "3. Arrive (Blocks if > 100m)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"lat\": 24.7136,\n    \"lng\": 46.6753\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/arrive",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"arrive"
							]
						}
					},
					"response": []
				},
				{
					"name": "4. Arrive Override (Supervisor Only)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"reason\": \"Technician GPS is drifting significantly due to tall buildings.\",\n    \"technician_gps_lat\": 24.7136,\n    \"technician_gps_lng\": 46.6753\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/arrive-override",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"arrive-override"
							]
						}
					},
					"response": []
				},
				{
					"name": "5. Start Work",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/start-work",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"start-work"
							]
						}
					},
					"response": []
				},
				{
					"name": "6. Complete Visit",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"lat\": 24.7136,\n    \"lng\": 46.6753\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/complete",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"complete"
							]
						}
					},
					"response": []
				},
				{
					"name": "7. Close Visit",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/close",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"close"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Reporting",
			"item": [
				{
					"name": "Get Daily Logs",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/daily-logs",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"daily-logs"
							]
						}
					},
					"response": []
				},
				{
					"name": "Store Daily Log",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"description\": \"Finished initial assessment of the HVAC system.\",\n    \"status\": \"in_progress\"\n}"
						},
						"url": {
							"raw": "{{baseUrl}}/api/maintenance/visits/{{visitId}}/execution/daily-logs",
							"host": [
								"{{baseUrl}}"
							],
							"path": [
								"api",
								"maintenance",
								"visits",
								"{{visitId}}",
								"execution",
								"daily-logs"
							]
						}
					},
					"response": []
				}
			]
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "{{bearerToken}}",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "baseUrl",
			"value": "http://localhost",
			"type": "string"
		},
		{
			"key": "visitId",
			"value": "1",
			"type": "string"
		},
		{
			"key": "bearerToken",
			"value": "YOUR_TOKEN_HERE",
			"type": "string"
		}
	]
}
