{
	"info": {
		"_postman_id": "sla-governance-re",
		"name": "RE Dealer Onboarding - SLA Governance",
		"description": "Collection for testing and debugging Royal Enfield Dealer Onboarding SLA engine and Escalation matrix.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Login (Admin)",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var jsonData = pm.response.json();",
									"if(jsonData.token) {",
									"    pm.environment.set(\"token\", jsonData.token);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"email\": \"admin@royalenfield.com\",\n    \"password\": \"Admin@123\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/auth/login",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"auth",
								"login"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "SLA Governance",
			"item": [
				{
					"name": "Initialize Default SLA Matrix",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/master/sla-configs/initialize",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"master",
								"sla-configs",
								"initialize"
							]
						},
						"description": "Seeds/Resets the system with the 48+ SLA configurations across all modules as per doc requirements."
					},
					"response": []
				},
				{
					"name": "Get All SLA Configs",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/sla/configs",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"sla",
								"configs"
							]
						}
					},
					"response": []
				},
				{
					"name": "Save SLA Config (Update Logic)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"activityName\": \"Level 1 Interview\",\n    \"ownerRole\": \"RBM, DD-ZM\",\n    \"tatHours\": 2,\n    \"tatUnit\": \"days\",\n    \"isActive\": true,\n    \"reminders\": [\n        { \"timeValue\": 24, \"timeUnit\": \"hours\" },\n        { \"timeValue\": 4, \"timeUnit\": \"hours\" }\n    ],\n    \"escalationConfigs\": [\n        { \"level\": 1, \"timeValue\": 4, \"timeUnit\": \"hours\", \"notifyRole\": \"ZBH\" },\n        { \"level\": 2, \"timeValue\": 12, \"timeUnit\": \"hours\", \"notifyRole\": \"DD Lead\" },\n        { \"level\": 3, \"timeValue\": 24, \"timeUnit\": \"hours\", \"notifyRole\": \"NBH\" }\n    ]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/master/sla-configs",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"master",
								"sla-configs"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Monitoring & Debugging",
			"item": [
				{
					"name": "View SLA Queue & Database Internal Status",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/sla/debug/queue",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"sla",
								"debug",
								"queue"
							]
						},
						"description": "Debug endpoint to see active SLA tracks in DB and jobs in Redis."
					},
					"response": []
				},
				{
					"name": "Get Tracking for App",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/sla/tracking/:applicationId",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"sla",
								"tracking",
								":applicationId"
							],
							"variable": [
								{
									"key": "applicationId",
									"value": "ENTER_APP_ID_HERE"
								}
							]
						}
					},
					"response": []
				}
			]
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:5000/api"
		},
		{
			"key": "token",
			"value": "your_token_here"
		}
	]
}
