{
	"info": {
		"_postman_id": "emergency-maintenance-automated-dispatch",
		"name": "Emergency Maintenance: Automated Dispatch & SLA",
		"description": "Postman collection for the Emergency Maintenance Lifecycle and Automated Technician Dispatch system as per US-015 documentation.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Discovery",
			"item": [
				{
					"name": "Client Search & Validation",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/projects/clients/search?q=Al",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"projects",
								"clients",
								"search"
							],
							"query": [
								{
									"key": "q",
									"value": "Al",
									"description": "Required, String, Minimum 2 characters."
								}
							]
						},
						"description": "Optimized search for clients with active contracts. Returns hierarchical JSON including client_id, active_contracts, and associated locations with asset_types."
					},
					"response": []
				}
			]
		},
		{
			"name": "Request Management",
			"item": [
				{
					"name": "Emergency Request Submission",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"incident_type\": \"full_cooling_failure\",\n    \"site_contact_phone\": \"+966500000000\",\n    \"asset_type_ids\": [1, 2],\n    \"attachments\": [\n        {\n            \"temporary_folder\": \"tmp_uploads/incident_evidence_001\"\n        }\n    ]\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/requests",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"requests"
							]
						},
						"description": "Submits an emergency request and triggers the Automated Geospatial Dispatch Engine.\n\nValidation:\n- incident_type: leak, power_outage, fire, full_cooling_failure, other.\n- site_contact_phone: Required, Max 20.\n- asset_type_ids: Array of existing asset type IDs."
					},
					"response": []
				},
				{
					"name": "SLA Status Tracking",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/requests/:id/sla-status",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"requests",
								":id",
								"sla-status"
							],
							"variable": [
								{
									"key": "id",
									"value": "1",
									"description": "Maintenance Request ID"
								}
							]
						},
						"description": "Calculates remaining time and breach status (response/arrival) for a specific request."
					},
					"response": []
				}
			]
		},
		{
			"name": "Visit Lifecycle Controls",
			"item": [
				{
					"name": "Pause Visit",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/visits/:id/pause",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"visits",
								":id",
								"pause"
							],
							"variable": [
								{
									"key": "id",
									"value": "1",
									"description": "Visit ID"
								}
							]
						},
						"description": "Halts the current visit timer and sets status to PAUSED."
					},
					"response": []
				},
				{
					"name": "Resume Visit",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/visits/:id/resume",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"visits",
								":id",
								"resume"
							],
							"variable": [
								{
									"key": "id",
									"value": "1",
									"description": "Visit ID"
								}
							]
						},
						"description": "Restarts a paused visit timer and sets status back to IN_PROGRESS."
					},
					"response": []
				},
				{
					"name": "Faulted Units Reporting",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"faulted_units\": [\n        {\n            \"contract_unit_id\": 101,\n            \"is_faulted\": true\n        }\n    ]\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/visits/:id/faulted-units",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"visits",
								":id",
								"faulted-units"
							],
							"variable": [
								{
									"key": "id",
									"value": "1",
									"description": "Visit ID"
								}
							]
						},
						"description": "Logs specific unit failures during execution. Validates against contract units."
					},
					"response": []
				}
			]
		},
		{
			"name": "Logistics & Live Map",
			"item": [
				{
					"name": "Technician Map",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/v1/maintenance/emergency/technicians-map",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"v1",
								"maintenance",
								"emergency",
								"technicians-map"
							]
						},
						"description": "Returns live location and status (Active/Paused) of technicians for logistics monitoring."
					},
					"response": []
				}
			]
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost",
			"type": "string"
		}
	]
}
