{
	"info": {
		"_postman_id": "public-api-notification-microservice",
		"name": "Notification Microservice - Public API",
		"description": "Complete Postman collection for integrating your application with the Notification Microservice.\n\n**This collection includes all essential endpoints for the integration workflow:**\n1. Health Check - Verify service connectivity\n2. Authentication - User registration, login, and token refresh\n3. User Management - Create users, sync users, approve users, get profile, update push tokens, and Pusher authentication\n4. Events - Send events from your application to trigger notifications\n5. Rules Management - Create notification rules\n6. Notifications - List, acknowledge, and get unread count\n\n**Integration Flow:**\n- Your Application → Sends Events → Notification Service → Evaluates Rules → Creates Notifications → Delivers to Users → Your Application\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md for detailed integration examples and patterns.**",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "notification-microservice-public"
	},
	"item": [
		{
			"name": "1. Health Check",
			"item": [
				{
					"name": "Health Check",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response has status field\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('status');",
									"    pm.expect(jsonData.status).to.eql('ok');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{BASE_URL}}/health",
							"host": ["{{BASE_URL}}"],
							"path": ["health"]
						},
						"description": "Basic health check endpoint. No authentication required. Use this to verify the service is running."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "{{BASE_URL}}/health",
									"host": ["{{BASE_URL}}"],
									"path": ["health"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"status\": \"ok\",\n  \"timestamp\": \"2024-01-15T10:30:00.000Z\"\n}"
						}
					]
				}
			],
			"description": "Health check endpoint to verify the notification service is running and accessible."
		},
		{
			"name": "2. Authentication",
			"item": [
				{
					"name": "User Registration",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 201\", function () {",
									"    pm.response.to.have.status(201);",
									"});",
									"",
									"pm.test(\"Response contains access token\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('accessToken');",
									"    pm.expect(jsonData).to.have.property('refreshToken');",
									"    ",
									"    // Save tokens to collection variables",
									"    pm.collectionVariables.set('jwt_token', jsonData.accessToken);",
									"    pm.collectionVariables.set('refresh_token', jsonData.refreshToken);",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "X-API-Key",
								"value": "{{API_KEY}}",
								"description": "Your project API key"
							},
							{
								"key": "X-API-Secret",
								"value": "{{API_SECRET}}",
								"description": "Your project API secret"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123!\",\n  \"fullName\": \"John Doe\",\n  \"externalUserId\": \"ext_user_123\",\n  \"roles\": [\"user\"]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/auth/register",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "auth", "register"]
						},
						"description": "Register a new user in the notification service.\n\n**Flow:**\n1. User registers with email/password\n2. User is created with status = 'pending'\n3. JWT tokens are returned BUT user cannot use them yet\n4. Admin must approve user via POST /api/v1/users/:id/approve\n5. User status changes to 'active'\n6. User can now login via POST /api/v1/auth/login\n\n**Important:**\n- Requires API key authentication (X-API-Key and X-API-Secret)\n- User receives tokens but cannot login until approved\n- See AUTHENTICATION_FLOW.md for complete workflow\n\n**Alternative:** Use POST /api/v1/users for server-to-server user creation (no tokens returned)"
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "X-API-Key",
										"value": "{{API_KEY}}"
									},
									{
										"key": "X-API-Secret",
										"value": "{{API_SECRET}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123!\",\n  \"fullName\": \"John Doe\",\n  \"externalUserId\": \"ext_user_123\",\n  \"roles\": [\"user\"]\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/auth/register",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "auth", "register"]
								}
							},
							"status": "Created",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"accessToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC05YWJjLWRlZmctMDEyMy00NTY3LTg5MGFiY2RlZjAxMiIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsInJvbGVzIjpbInVzZXIiXSwicHJvamVjdElkIjoicHJvamVjdF8xMjMiLCJpYXQiOjE3MDUzMjE4MDAsImV4cCI6MTcwNTMyNTQwMH0.example\",\n  \"refreshToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC05YWJjLWRlZmctMDEyMy00NTY3LTg5MGFiY2RlZjAxMiIsInR5cGUiOiJyZWZyZXNoIiwiaWF0IjoxNzA1MzIxODAwLCJleHAiOjE3MDYxODU4MDB9.example\",\n  \"user\": {\n    \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n    \"email\": \"user@example.com\",\n    \"fullName\": \"John Doe\",\n    \"roles\": [\"user\"],\n    \"status\": \"pending\"\n  }\n}"
						}
					]
				},
				{
					"name": "User Login",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains access token\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('accessToken');",
									"    pm.expect(jsonData).to.have.property('refreshToken');",
									"    ",
									"    // Save tokens to collection variables",
									"    pm.collectionVariables.set('jwt_token', jsonData.accessToken);",
									"    pm.collectionVariables.set('refresh_token', jsonData.refreshToken);",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "X-API-Key",
								"value": "{{API_KEY}}",
								"description": "Your project API key"
							},
							{
								"key": "X-API-Secret",
								"value": "{{API_SECRET}}",
								"description": "Your project API secret"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123!\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/auth/login",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "auth", "login"]
						},
						"description": "Login and receive JWT access token and refresh token.\n\n**Requirements:**\n- User must exist in the project\n- User must have status = 'active' (not 'pending', 'disabled', or 'unverified')\n- Correct email and password\n\n**Flow:**\n1. User provides email/password\n2. System verifies credentials\n3. System checks user status (must be 'active')\n4. If valid, returns JWT tokens\n5. User can now access protected endpoints\n\n**Note:** This endpoint requires API key authentication (X-API-Key and X-API-Secret headers) to identify the project.\n\n**If user is pending:** You'll get error: \"User account is pending. Please contact an administrator.\"\n**Solution:** Admin must approve user via POST /api/v1/users/:id/approve"
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "X-API-Key",
										"value": "{{API_KEY}}"
									},
									{
										"key": "X-API-Secret",
										"value": "{{API_SECRET}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123!\"\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/auth/login",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "auth", "login"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"accessToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC05YWJjLWRlZmctMDEyMy00NTY3LTg5MGFiY2RlZjAxMiIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsInJvbGVzIjpbInVzZXIiXSwicHJvamVjdElkIjoicHJvamVjdF8xMjMiLCJpYXQiOjE3MDUzMjE4MDAsImV4cCI6MTcwNTMyNTQwMH0.example\",\n  \"refreshToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC05YWJjLWRlZmctMDEyMy00NTY3LTg5MGFiY2RlZjAxMiIsInR5cGUiOiJyZWZyZXNoIiwiaWF0IjoxNzA1MzIxODAwLCJleHAiOjE3MDYxODU4MDB9.example\",\n  \"user\": {\n    \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n    \"email\": \"user@example.com\",\n    \"fullName\": \"John Doe\",\n    \"roles\": [\"user\"],\n    \"status\": \"active\"\n  }\n}"
						}
					]
				},
				{
					"name": "Refresh Token",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains new access token\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('accessToken');",
									"    pm.expect(jsonData).to.have.property('refreshToken');",
									"    ",
									"    // Save new tokens to collection variables",
									"    pm.collectionVariables.set('jwt_token', jsonData.accessToken);",
									"    pm.collectionVariables.set('refresh_token', jsonData.refreshToken);",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"refreshToken\": \"{{refresh_token}}\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/auth/refresh",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "auth", "refresh"]
						},
						"description": "Refresh the access token using a refresh token. This endpoint is public and doesn't require authentication. Use this when your access token expires (typically after 1 hour)."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"refreshToken\": \"{{refresh_token}}\"\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/auth/refresh",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "auth", "refresh"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"accessToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC05YWJjLWRlZmctMDEyMy00NTY3LTg5MGFiY2RlZjAxMiIsImVtYWlsIjoidXNlckBleGFtcGxlLmNvbSIsInJvbGVzIjpbInVzZXIiXSwicHJvamVjdElkIjoicHJvamVjdF8xMjMiLCJpYXQiOjE3MDUzMjU0MDAsImV4cCI6MTcwNTMyOTAwMH0.new\",\n  \"refreshToken\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC05YWJjLWRlZmctMDEyMy00NTY3LTg5MGFiY2RlZjAxMiIsInR5cGUiOiJyZWZyZXNoIiwiaWF0IjoxNzA1MzI1NDAwLCJleHAiOjE3MDYxODk0MDB9.new\",\n  \"user\": {\n    \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n    \"email\": \"user@example.com\",\n    \"fullName\": \"John Doe\",\n    \"roles\": [\"user\"],\n    \"status\": \"active\"\n  }\n}"
						}
					]
				}
			],
			"description": "User authentication endpoints.\n\n**Authentication Flow:**\n1. Register: POST /api/v1/auth/register (creates user with 'pending' status)\n2. Admin Approval: POST /api/v1/users/:id/approve (changes status to 'active')\n3. Login: POST /api/v1/auth/login (only 'active' users can login)\n4. Refresh: POST /api/v1/auth/refresh (get new tokens when expired)\n\n**Two Authentication Types:**\n- API Key Auth: For registration/login (identifies project)\n- JWT Auth: For user operations (identifies user)\n\nSee AUTHENTICATION_FLOW.md for detailed explanation."
		},
		{
			"name": "3. User Management",
			"item": [
				{
					"name": "Get Current User Profile",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains user data\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('id');",
									"    pm.expect(jsonData).to.have.property('email');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/api/v1/users/me",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "users", "me"]
						},
						"description": "Get the current authenticated user's profile information. Requires JWT authentication."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"url": {
									"raw": "{{BASE_URL}}/api/v1/users/me",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "users", "me"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n  \"email\": \"user@example.com\",\n  \"fullName\": \"John Doe\",\n  \"phone\": \"+1234567890\",\n  \"roles\": [\"user\"],\n  \"status\": \"active\",\n  \"externalUserId\": \"ext_user_123\",\n  \"pushTokens\": {\n    \"fcm\": \"fcm_token_here_for_android\",\n    \"apns\": \"apns_token_here_for_ios\"\n  },\n  \"soundEnabled\": true,\n  \"createdAt\": \"2024-01-15T10:00:00.000Z\",\n  \"updatedAt\": \"2024-01-15T10:30:00.000Z\",\n  \"lastLoginAt\": \"2024-01-15T10:30:00.000Z\"\n}"
						}
					]
				},
				{
					"name": "Update Push Notification Tokens",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "PATCH",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"fcm\": \"fcm_token_here_for_android\",\n  \"apns\": \"apns_token_here_for_ios\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/users/me/push-tokens",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "users", "me", "push-tokens"]
						},
						"description": "Update push notification tokens for the current user. Provide FCM token for Android devices and APNS token for iOS devices. These tokens are used to send push notifications when the user is offline.\n\n**Integration:**\n- Call this endpoint when user logs into your mobile app\n- Update tokens when device token changes (e.g., app reinstall)\n- Required for offline push notifications (FCM/APNs)\n\n**Flow:**\n1. User logs into your mobile app\n2. App gets FCM/APNs token from device\n3. App calls this endpoint with tokens\n4. Notification service stores tokens\n5. When user is offline, notifications are sent via push\n\n**Note:** Update these tokens whenever the user logs in or the device token changes. See CATHOLICPAY_INTEGRATION_FLOW.md for integration examples."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "PATCH",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"fcm\": \"fcm_token_here_for_android\",\n  \"apns\": \"apns_token_here_for_ios\"\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/users/me/push-tokens",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "users", "me", "push-tokens"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n  \"pushTokens\": {\n    \"fcm\": \"fcm_token_here_for_android\",\n    \"apns\": \"apns_token_here_for_ios\"\n  },\n  \"updatedAt\": \"2024-01-15T10:40:00.000Z\"\n}"
						}
					]
				},
				{
					"name": "Get Pusher Authentication",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains auth signature\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('auth');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/api/v1/users/me/pusher-auth?socket_id=123.456&channel_name=private-user-{{user_id}}",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "users", "me", "pusher-auth"],
							"query": [
								{
									"key": "socket_id",
									"value": "123.456",
									"description": "Pusher socket ID"
								},
								{
									"key": "channel_name",
									"value": "private-user-{{user_id}}",
									"description": "Pusher channel name (e.g., private-user-123)"
								}
							]
						},
						"description": "Get Pusher authentication signature for private channels. This is used when initializing Pusher on the client side to authenticate private channel subscriptions.\n\n**Integration Flow:**\n1. User logs into your application\n2. Your app gets JWT token from notification service\n3. Initialize Pusher with this auth endpoint\n4. Subscribe to user's private channel: `private-user-{userId}`\n5. Receive real-time notifications via Pusher\n\n**Usage in client code:**\n```javascript\nconst pusher = new Pusher('YOUR_PUSHER_KEY', {\n  cluster: 'us2',\n  authEndpoint: 'https://notification-service.com/api/v1/users/me/pusher-auth',\n  auth: {\n    headers: {\n      Authorization: `Bearer ${jwtToken}`\n    }\n  }\n});\n\n// Subscribe to user's notification channel\nconst channel = pusher.subscribe(`private-user-${userId}`);\nchannel.bind('notification', (data) => {\n  // Display notification in your app\n  showNotification(data);\n});\n```\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md for complete client-side integration examples.**"
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"url": {
									"raw": "{{BASE_URL}}/api/v1/users/me/pusher-auth?socket_id=123.456&channel_name=private-user-{{user_id}}",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "users", "me", "pusher-auth"],
									"query": [
										{
											"key": "socket_id",
											"value": "123.456"
										},
										{
											"key": "channel_name",
											"value": "private-user-{{user_id}}"
										}
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"auth\": \"pusher_app_key:signature_here\"\n}"
						}
					]
				},
				{
					"name": "Create User (Server-to-Server)",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 201\", function () {",
									"    pm.response.to.have.status(201);",
									"});",
									"",
									"pm.test(\"Response contains user data\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('id');",
									"    pm.expect(jsonData).to.have.property('email');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "X-API-Key",
								"value": "{{API_KEY}}",
								"description": "Your project API key"
							},
							{
								"key": "X-API-Secret",
								"value": "{{API_SECRET}}",
								"description": "Your project API secret"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123!\",\n  \"fullName\": \"John Doe\",\n  \"externalUserId\": \"ext_user_123\",\n  \"roles\": [\"user\"]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/users",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "users"]
						},
						"description": "Create a user programmatically (server-to-server). Use this when a user registers in your application.\n\n**Difference from /auth/register:**\n- No JWT tokens returned\n- Can create users without passwords (status = 'unverified')\n- Used for server-to-server operations\n- Better for bulk user syncing\n\n**Use Cases:**\n- Create users when they register in your app\n- Sync users from external systems\n- Bulk user creation\n\n**Note:** Users created this way will have status 'pending' or 'unverified' and need to be approved. See CATHOLICPAY_INTEGRATION_FLOW.md Phase 2."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "X-API-Key",
										"value": "{{API_KEY}}"
									},
									{
										"key": "X-API-Secret",
										"value": "{{API_SECRET}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"email\": \"user@example.com\",\n  \"password\": \"securePassword123!\",\n  \"fullName\": \"John Doe\",\n  \"externalUserId\": \"ext_user_123\",\n  \"roles\": [\"user\"]\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/users",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "users"]
								}
							},
							"status": "Created",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n  \"email\": \"user@example.com\",\n  \"fullName\": \"John Doe\",\n  \"roles\": [\"user\"],\n  \"status\": \"pending\",\n  \"externalUserId\": \"ext_user_123\",\n  \"createdAt\": \"2024-01-15T10:00:00.000Z\"\n}"
						}
					]
				},
				{
					"name": "Sync Users (Bulk)",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains sync results\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('created');",
									"    pm.expect(jsonData).to.have.property('updated');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "X-API-Key",
								"value": "{{API_KEY}}",
								"description": "Your project API key"
							},
							{
								"key": "X-API-Secret",
								"value": "{{API_SECRET}}",
								"description": "Your project API secret"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"users\": [\n    {\n      \"email\": \"user1@example.com\",\n      \"externalUserId\": \"ext_user_1\",\n      \"fullName\": \"User One\",\n      \"roles\": [\"user\"]\n    },\n    {\n      \"email\": \"user2@example.com\",\n      \"externalUserId\": \"ext_user_2\",\n      \"fullName\": \"User Two\",\n      \"roles\": [\"user\"]\n    }\n  ]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/users/sync",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "users", "sync"]
						},
						"description": "Bulk sync users from your application to the notification service. Use this to migrate existing users.\n\n**Use Cases:**\n- Sync existing users when first integrating\n- Bulk import users from external systems\n- Migrate users from another system\n\n**Note:**\n- Users created via sync will have status 'unverified' (no password)\n- Users need to be approved before they can receive notifications\n- Password is optional - will be auto-generated if not provided\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md Phase 2, Option A for detailed example.**"
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "X-API-Key",
										"value": "{{API_KEY}}"
									},
									{
										"key": "X-API-Secret",
										"value": "{{API_SECRET}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"users\": [\n    {\n      \"email\": \"user1@example.com\",\n      \"externalUserId\": \"ext_user_1\",\n      \"fullName\": \"User One\",\n      \"roles\": [\"user\"]\n    },\n    {\n      \"email\": \"user2@example.com\",\n      \"externalUserId\": \"ext_user_2\",\n      \"fullName\": \"User Two\",\n      \"roles\": [\"user\"]\n    }\n  ]\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/users/sync",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "users", "sync"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"created\": 2,\n  \"updated\": 0,\n  \"failed\": 0,\n  \"results\": [\n    {\n      \"email\": \"user1@example.com\",\n      \"status\": \"created\",\n      \"userId\": \"12345678-9abc-def0-1234-567890abcdef01\"\n    },\n    {\n      \"email\": \"user2@example.com\",\n      \"status\": \"created\",\n      \"userId\": \"56789012-3def-4567-8901-23456789abcdef\"\n    }\n  ]\n}"
						}
					]
				},
				{
					"name": "Approve User",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"User status is active\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('status');",
									"    pm.expect(jsonData.status).to.eql('active');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token (admin role required)"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"roles\": [\"user\"]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/users/:user_id/approve",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "users", ":user_id", "approve"],
							"variable": [
								{
									"key": "user_id",
									"value": "user-uuid-here",
									"description": "User UUID to approve"
								}
							]
						},
						"description": "Approve a pending user and assign roles. This changes the user status from 'pending' to 'active', allowing them to login and receive notifications.\n\n**Requirements:**\n- JWT token with 'admin' role\n- User must exist and have status 'pending' or 'unverified'\n\n**What happens:**\n1. User status changes: 'pending' → 'active'\n2. User roles are assigned/updated\n3. User can now login via POST /api/v1/auth/login\n4. User can receive notifications\n\n**Use Cases:**\n- Auto-approve trusted users after registration\n- Manual approval via admin panel\n- Bulk approval of synced users\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md Phase 2, Step 3 for examples.**"
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"roles\": [\"user\"]\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/users/:user_id/approve",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "users", ":user_id", "approve"],
									"variable": [
										{
											"key": "user_id",
											"value": "user-uuid-here"
										}
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"12345678-9abc-def0-1234-567890abcdef01\",\n  \"email\": \"user@example.com\",\n  \"fullName\": \"John Doe\",\n  \"roles\": [\"user\"],\n  \"status\": \"active\",\n  \"externalUserId\": \"ext_user_123\",\n  \"updatedAt\": \"2024-01-15T10:35:00.000Z\"\n}"
						}
					]
				}
			],
			"description": "Essential user management endpoints for integration.\n\n**Available Operations:**\n- Get current user profile (JWT auth)\n- Create user server-to-server (API key auth)\n- Sync users in bulk (API key auth)\n- Approve pending users (JWT admin auth)\n- Update push notification tokens (JWT auth)\n- Get Pusher authentication for real-time channels (JWT auth)\n\n**Integration:**\n- Sync existing users from your application\n- Create users when they register in your app\n- Approve users to activate them\n- Get user profile to display in your application\n- Configure push notifications for mobile apps\n- Setup real-time notification channels via Pusher\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md for detailed user synchronization examples.**"
		},
		{
			"name": "4. Events",
			"item": [
				{
					"name": "Create Event",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 201\", function () {",
									"    pm.response.to.have.status(201);",
									"});",
									"",
									"pm.test(\"Response contains event ID\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('id');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "X-API-Key",
								"value": "{{API_KEY}}",
								"description": "Your project API key"
							},
							{
								"key": "X-API-Secret",
								"value": "{{API_SECRET}}",
								"description": "Your project API secret"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"type\": \"pending_transaction\",\n  \"payload\": {\n    \"transactionId\": \"TX_123\",\n    \"amount\": 50000,\n    \"currency\": \"NGN\",\n    \"status\": \"pending\",\n    \"userId\": \"user_123\"\n  },\n  \"clientEventId\": \"client_event_123\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/events",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "events"]
						},
						"description": "Ingest a new event into the notification system. Events are automatically evaluated against active rules, and notifications are created and delivered accordingly.\n\n**Event Flow:**\n1. Your application sends event (e.g., transaction created, payment successful)\n2. Event is ingested and stored\n3. Active rules are evaluated against the event\n4. Matching rules create notifications for target users/roles\n5. Notifications are delivered via Pusher (if user is online) or queued for push notification (if user is offline)\n6. Webhook is triggered (if configured)\n\n**Common Event Types:**\n- `pending_transaction` - Transaction awaiting approval\n- `payment_successful` - Payment completed\n- `payment_failed` - Payment failed\n- `balance_update` - Account balance changed\n- `transaction_approved` - Transaction approved\n- `transaction_rejected` - Transaction rejected\n\n**Example Use Case:**\nWhen a user makes a payment in your app, send a `payment_successful` event. The notification service will evaluate rules and send notifications to relevant users.\n\n**Note:** Requires API key authentication (server-to-server). See CATHOLICPAY_INTEGRATION_FLOW.md for integration examples."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "X-API-Key",
										"value": "{{API_KEY}}"
									},
									{
										"key": "X-API-Secret",
										"value": "{{API_SECRET}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"type\": \"pending_transaction\",\n  \"payload\": {\n    \"transactionId\": \"TX_123\",\n    \"amount\": 50000,\n    \"currency\": \"NGN\",\n    \"status\": \"pending\",\n    \"userId\": \"user_123\"\n  },\n  \"clientEventId\": \"client_event_123\"\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/events",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "events"]
								}
							},
							"status": "Created",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"event-uuid-1234-5678-90ab-cdef\",\n  \"type\": \"pending_transaction\",\n  \"payload\": {\n    \"transactionId\": \"TX_123\",\n    \"amount\": 50000,\n    \"currency\": \"NGN\",\n    \"status\": \"pending\",\n    \"userId\": \"user_123\"\n  },\n  \"clientEventId\": \"client_event_123\",\n  \"projectId\": \"project_123\",\n  \"receivedAt\": \"2024-01-15T10:45:00.000Z\",\n  \"createdAt\": \"2024-01-15T10:45:00.000Z\"\n}"
						}
					]
				},
				{
					"name": "Create Batch Events",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 201\", function () {",
									"    pm.response.to.have.status(201);",
									"});",
									"",
									"pm.test(\"Response contains results array\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('results');",
									"    pm.expect(jsonData.results).to.be.an('array');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "X-API-Key",
								"value": "{{API_KEY}}",
								"description": "Your project API key"
							},
							{
								"key": "X-API-Secret",
								"value": "{{API_SECRET}}",
								"description": "Your project API secret"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"events\": [\n    {\n      \"type\": \"pending_transaction\",\n      \"payload\": {\n        \"transactionId\": \"TX_123\",\n        \"amount\": 50000,\n        \"currency\": \"NGN\"\n      },\n      \"clientEventId\": \"client_event_123\"\n    },\n    {\n      \"type\": \"balance_update\",\n      \"payload\": {\n        \"accountId\": \"ACC_456\",\n        \"newBalance\": 1000000,\n        \"currency\": \"NGN\"\n      },\n      \"clientEventId\": \"client_event_456\"\n    }\n  ]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/events/batch",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "events", "batch"]
						},
						"description": "Ingest multiple events in a single request. This is more efficient than sending individual events when you need to send multiple events at once.\n\n**Use Cases:**\n- Bulk import of historical events\n- Batch processing of transactions\n- Synchronizing events from external systems\n- Reducing API calls when processing multiple events\n\n**Example:**\nWhen processing multiple transactions, send them all in one batch request instead of individual API calls.\n\n**Note:** Requires API key authentication (server-to-server)."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "X-API-Key",
										"value": "{{API_KEY}}"
									},
									{
										"key": "X-API-Secret",
										"value": "{{API_SECRET}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"events\": [\n    {\n      \"type\": \"pending_transaction\",\n      \"payload\": {\n        \"transactionId\": \"TX_123\",\n        \"amount\": 50000,\n        \"currency\": \"NGN\"\n      },\n      \"clientEventId\": \"client_event_123\"\n    },\n    {\n      \"type\": \"balance_update\",\n      \"payload\": {\n        \"accountId\": \"ACC_456\",\n        \"newBalance\": 1000000,\n        \"currency\": \"NGN\"\n      },\n      \"clientEventId\": \"client_event_456\"\n    }\n  ]\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/events/batch",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "events", "batch"]
								}
							},
							"status": "Created",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"results\": [\n    {\n      \"id\": \"event-uuid-1234-5678-90ab-cdef\",\n      \"type\": \"pending_transaction\",\n      \"clientEventId\": \"client_event_123\",\n      \"status\": \"success\"\n    },\n    {\n      \"id\": \"event-uuid-5678-90ab-cdef-1234\",\n      \"type\": \"balance_update\",\n      \"clientEventId\": \"client_event_456\",\n      \"status\": \"success\"\n    }\n  ],\n  \"total\": 2,\n  \"successful\": 2,\n  \"failed\": 0\n}"
						}
					]
				}
			],
			"description": "Event ingestion endpoints. Send events from your application to trigger notification rules and create notifications.\n\n**Integration Pattern:**\n1. Something happens in your application (transaction, payment, etc.)\n2. Your app sends event to notification service\n3. Notification service evaluates rules\n4. Notifications are created and delivered\n\n**Common Events:**\n- Transaction events: `pending_transaction`, `transaction_approved`, `transaction_rejected`\n- Payment events: `payment_successful`, `payment_failed`, `payment_initiated`\n- Account events: `balance_update`, `account_created`, `account_updated`\n- User events: `user_registered`, `user_verified`, `user_action`\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md for detailed integration examples and event patterns.**"
		},
		{
			"name": "5. Rules Management",
			"item": [
				{
					"name": "Create Notification Rule",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 201\", function () {",
									"    pm.response.to.have.status(201);",
									"});",
									"",
									"pm.test(\"Response contains rule ID\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('id');",
									"    pm.expect(jsonData).to.have.property('name');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token (admin or rule_manager role required)"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"name\": \"Pending Transaction Alert\",\n  \"condition\": \"event.type == 'pending_transaction' && event.payload.amount > 10000\",\n  \"targetRoles\": [\"admin\", \"finance\"],\n  \"title\": \"Pending Transaction\",\n  \"message\": \"Transaction {{event.payload.transactionId}} for ₦{{event.payload.amount}} is pending approval\",\n  \"sound\": \"alert.mp3\",\n  \"action\": {\n    \"type\": \"open_webview\",\n    \"url\": \"https://app.example.com/transactions/{{event.payload.transactionId}}\",\n    \"editableAddressBar\": false\n  },\n  \"active\": true\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/api/v1/rules",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "rules"]
						},
						"description": "Create a notification rule that defines when and how notifications are created based on events.\n\n**Requirements:**\n- JWT token with 'admin' or 'rule_manager' role\n- User must be logged in and active\n\n**Rule Components:**\n- **condition**: JavaScript expression that evaluates events (e.g., `event.type == 'pending_transaction' && event.payload.amount > 10000`)\n- **targetRoles**: Array of user roles that should receive notifications\n- **title**: Notification title (supports template variables like `{{event.payload.transactionId}}`)\n- **message**: Notification message (supports template variables)\n- **sound**: Optional sound file name\n- **action**: Optional action (e.g., open webview, deep link)\n\n**Use Cases:**\n- Define when notifications should be sent\n- Configure notification content and actions\n- Set up role-based notification targeting\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md Phase 3 for detailed examples.**"
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Content-Type",
										"value": "application/json"
									},
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"name\": \"Pending Transaction Alert\",\n  \"condition\": \"event.type == 'pending_transaction' && event.payload.amount > 10000\",\n  \"targetRoles\": [\"admin\", \"finance\"],\n  \"title\": \"Pending Transaction\",\n  \"message\": \"Transaction {{event.payload.transactionId}} for ₦{{event.payload.amount}} is pending approval\",\n  \"sound\": \"alert.mp3\",\n  \"action\": {\n    \"type\": \"open_webview\",\n    \"url\": \"https://app.example.com/transactions/{{event.payload.transactionId}}\",\n    \"editableAddressBar\": false\n  },\n  \"active\": true\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/api/v1/rules",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "rules"]
								}
							},
							"status": "Created",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"rule-uuid-1234-5678-90ab-cdef\",\n  \"name\": \"Pending Transaction Alert\",\n  \"condition\": \"event.type == 'pending_transaction' && event.payload.amount > 10000\",\n  \"targetRoles\": [\"admin\", \"finance\"],\n  \"title\": \"Pending Transaction\",\n  \"message\": \"Transaction {{event.payload.transactionId}} for ₦{{event.payload.amount}} is pending approval\",\n  \"sound\": \"alert.mp3\",\n  \"action\": {\n    \"type\": \"open_webview\",\n    \"url\": \"https://app.example.com/transactions/{{event.payload.transactionId}}\",\n    \"editableAddressBar\": false\n  },\n  \"priority\": 10,\n  \"active\": true,\n  \"createdBy\": \"user-uuid-1234\",\n  \"createdAt\": \"2024-01-15T09:00:00.000Z\",\n  \"updatedAt\": \"2024-01-15T09:00:00.000Z\"\n}"
						}
					]
				}
			],
			"description": "Notification rule management endpoints. Create rules that define when and how notifications are created based on events.\n\n**What are Rules?**\nRules define when and how notifications are created based on events. For example:\n- \"Send notification when transaction amount > ₦10,000\"\n- \"Notify admins when payment fails\"\n- \"Alert users when balance is low\"\n\n**Requirements:**\n- JWT token with 'admin' or 'rule_manager' role\n- User must be logged in and active\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md Phase 3 for detailed examples and common rule patterns.**"
		},
		{
			"name": "6. Notifications",
			"item": [
				{
					"name": "List Notifications",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains notifications array\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('data');",
									"    pm.expect(jsonData.data).to.be.an('array');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/api/v1/notifications?page=1&limit=20",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "notifications"],
							"query": [
								{
									"key": "page",
									"value": "1",
									"description": "Page number (default: 1)"
								},
								{
									"key": "limit",
									"value": "20",
									"description": "Items per page (default: 20, max: 100)"
								}
							]
						},
						"description": "Get paginated list of notifications for the current authenticated user. Notifications are returned in reverse chronological order (newest first).\n\n**Use Cases:**\n- Display notification center in your application\n- Show notification history\n- Build notification inbox UI\n\n**Response includes:**\n- Notification ID, title, message\n- Status (unread, read, acknowledged)\n- Created timestamp\n- Associated event data\n- Sound and action (if configured)\n\n**Integration:**\nCall this endpoint from your application's notification center to display all notifications for the logged-in user."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"url": {
									"raw": "{{BASE_URL}}/api/v1/notifications?page=1&limit=20",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "notifications"],
									"query": [
										{
											"key": "page",
											"value": "1"
										},
										{
											"key": "limit",
											"value": "20"
										}
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"data\": [\n    {\n      \"id\": \"notif-uuid-1234-5678-90ab-cdef\",\n      \"title\": \"High Value Transaction\",\n      \"message\": \"Transaction TX_123 for ₦50,000 is pending\",\n      \"status\": \"unread\",\n      \"sound\": \"alert.mp3\",\n      \"action\": {\n        \"type\": \"open_webview\",\n        \"url\": \"https://app.example.com/transactions/TX_123\",\n        \"editableAddressBar\": true\n      },\n      \"eventId\": \"event-uuid-1234-5678-90ab-cdef\",\n      \"ruleId\": \"rule-uuid-1234-5678-90ab-cdef\",\n      \"createdAt\": \"2024-01-15T10:45:00.000Z\",\n      \"acknowledgedAt\": null\n    },\n    {\n      \"id\": \"notif-uuid-5678-90ab-cdef-1234\",\n      \"title\": \"Balance Updated\",\n      \"message\": \"Your account balance has been updated to ₦1,000,000\",\n      \"status\": \"acknowledged\",\n      \"sound\": null,\n      \"action\": null,\n      \"eventId\": \"event-uuid-5678-90ab-cdef-1234\",\n      \"ruleId\": \"rule-uuid-5678-90ab-cdef-1234\",\n      \"createdAt\": \"2024-01-15T10:30:00.000Z\",\n      \"acknowledgedAt\": \"2024-01-15T10:35:00.000Z\"\n    }\n  ],\n  \"meta\": {\n    \"page\": 1,\n    \"limit\": 20,\n    \"total\": 45,\n    \"totalPages\": 3\n  }\n}"
						}
					]
				},
				{
					"name": "Acknowledge Notification",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Notification is acknowledged\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('acknowledgedAt');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/api/v1/notifications/:notification_id/acknowledge",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "notifications", ":notification_id", "acknowledge"],
							"variable": [
								{
									"key": "notification_id",
									"value": "notification-uuid-here",
									"description": "Notification UUID"
								}
							]
						},
						"description": "Mark a notification as acknowledged by the current user. This indicates the user has seen and interacted with the notification. Acknowledged notifications may trigger webhook events if configured."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"url": {
									"raw": "{{BASE_URL}}/api/v1/notifications/:notification_id/acknowledge",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "notifications", ":notification_id", "acknowledge"],
									"variable": [
										{
											"key": "notification_id",
											"value": "notification-uuid-here"
										}
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"id\": \"notif-uuid-1234-5678-90ab-cdef\",\n  \"title\": \"High Value Transaction\",\n  \"message\": \"Transaction TX_123 for ₦50,000 is pending\",\n  \"status\": \"acknowledged\",\n  \"sound\": \"alert.mp3\",\n  \"action\": {\n    \"type\": \"open_webview\",\n    \"url\": \"https://app.example.com/transactions/TX_123\",\n    \"editableAddressBar\": true\n  },\n  \"eventId\": \"event-uuid-1234-5678-90ab-cdef\",\n  \"ruleId\": \"rule-uuid-1234-5678-90ab-cdef\",\n  \"createdAt\": \"2024-01-15T10:45:00.000Z\",\n  \"acknowledgedAt\": \"2024-01-15T10:50:00.000Z\"\n}"
						}
					]
				},
				{
					"name": "Get Unread Count",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"pm.test(\"Status code is 200\", function () {",
									"    pm.response.to.have.status(200);",
									"});",
									"",
									"pm.test(\"Response contains count\", function () {",
									"    var jsonData = pm.response.json();",
									"    pm.expect(jsonData).to.have.property('count');",
									"    pm.expect(jsonData.count).to.be.a('number');",
									"});"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{jwt_token}}",
								"description": "JWT access token"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/api/v1/notifications/unread/count",
							"host": ["{{BASE_URL}}"],
							"path": ["api", "v1", "notifications", "unread", "count"]
						},
						"description": "Get the count of unread notifications for the current authenticated user. Useful for displaying a badge or notification indicator in your UI.\n\n**Use Cases:**\n- Display unread count badge on notification icon\n- Show notification indicator in app header\n- Update badge count in real-time\n\n**Integration:**\nPoll this endpoint periodically or call it when user opens your app to show unread notification count."
					},
					"response": [
						{
							"name": "Success",
							"originalRequest": {
								"method": "GET",
								"header": [
									{
										"key": "Authorization",
										"value": "Bearer {{jwt_token}}"
									}
								],
								"url": {
									"raw": "{{BASE_URL}}/api/v1/notifications/unread/count",
									"host": ["{{BASE_URL}}"],
									"path": ["api", "v1", "notifications", "unread", "count"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "{\n  \"count\": 5\n}"
						}
					]
				}
			],
			"description": "Notification management endpoints. List, view, and acknowledge notifications for the authenticated user.\n\n**Integration:**\n- Build notification center in your application\n- Display notification history\n- Track notification engagement\n- Show unread count badges\n\n**Client-Side Integration:**\n- Fetch notifications to display in your app\n- Mark notifications as acknowledged when user interacts\n- Poll for unread count to show badges\n- Combine with Pusher for real-time updates\n\n**See CATHOLICPAY_INTEGRATION_FLOW.md for client-side integration examples.**"
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					"// Auto-refresh token if expired (optional)",
					"// This is a placeholder - implement based on your token expiry logic"
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					"// Global test script",
					"// Add any global test logic here"
				]
			}
		}
	],
	"variable": [
		{
			"key": "BASE_URL",
			"value": "http://localhost:3000",
			"type": "string",
			"description": "Base URL of the notification microservice"
		},
		{
			"key": "API_KEY",
			"value": "pk_dev_your_API_KEY_here",
			"type": "string",
			"description": "Your project API key (obtained from platform admin)"
		},
		{
			"key": "API_SECRET",
			"value": "sk_dev_your_API_SECRET_here",
			"type": "string",
			"description": "Your project API secret (obtained from platform admin, shown only once)"
		},
		{
			"key": "jwt_token",
			"value": "",
			"type": "string",
			"description": "JWT access token (automatically set after login/register)"
		},
		{
			"key": "refresh_token",
			"value": "",
			"type": "string",
			"description": "JWT refresh token (automatically set after login/register)"
		},
		{
			"key": "user_id",
			"value": "",
			"type": "string",
			"description": "Current user ID (set manually or from user profile response)"
		}
	]
}

