{
	"info": {
		"_postman_id": "witride-api-collection",
		"name": "WITRIDE API",
		"description": "Complete API collection for WITRIDE ride-sharing application",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:8000/api",
			"type": "string"
		},
		{
			"key": "token",
			"value": "",
			"type": "string"
		},
		{
			"key": "phone",
			"value": "201012345678",
			"type": "string"
		}
	],
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Send Verification Code",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"if (pm.response.code === 200) {",
									"    pm.test(\"Verification code sent successfully\", function () {",
									"        var jsonData = pm.response.json();",
									"        pm.expect(jsonData.success).to.eql(true);",
									"    });",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"phone\": \"{{phone}}\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/auth/send-verification",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"auth",
								"send-verification"
							]
						},
						"description": "Send verification code to user's phone via WhatsApp"
					},
					"response": []
				},
				{
					"name": "Verify Code",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"if (pm.response.code === 200) {",
									"    var jsonData = pm.response.json();",
									"    pm.environment.set(\"token\", jsonData.token);",
									"    pm.collectionVariables.set(\"token\", jsonData.token);",
									"    pm.test(\"Token received and saved\", function () {",
									"        pm.expect(jsonData.token).to.not.be.undefined;",
									"    });",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"phone\": \"{{phone}}\",\n    \"code\": \"123456\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/auth/verify",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"auth",
								"verify"
							]
						},
						"description": "Verify the code sent to user and receive authentication token"
					},
					"response": []
				},
				{
					"name": "Logout",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/auth/logout",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"auth",
								"logout"
							]
						},
						"description": "Logout current user and invalidate token"
					},
					"response": []
				}
			]
		},
		{
			"name": "User Profile",
			"item": [
				{
					"name": "Get Profile",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/user/profile",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"user",
								"profile"
							]
						},
						"description": "Get current user profile information"
					},
					"response": []
				},
				{
					"name": "Update Profile",
					"request": {
						"method": "PUT",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"name\": \"Ahmed Hassan\",\n    \"email\": \"ahmed@example.com\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/user/profile",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"user",
								"profile"
							]
						},
						"description": "Update user profile information"
					},
					"response": []
				}
			]
		},
		{
			"name": "Routes",
			"item": [
				{
					"name": "Search Routes",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"origin_lat\": 30.0444,\n    \"origin_lng\": 31.2357,\n    \"destination_lat\": 30.0626,\n    \"destination_lng\": 31.2497,\n    \"passengers\": 2\n}"
						},
						"url": {
							"raw": "{{base_url}}/routes/search",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"routes",
								"search"
							]
						},
						"description": "Search for available routes based on origin, destination, and number of passengers"
					},
					"response": []
				},
				{
					"name": "Get Route History",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/routes/history",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"routes",
								"history"
							]
						},
						"description": "Get user's route booking history"
					},
					"response": []
				}
			]
		}
	]
}
