{"asyncapi":"3.0.0","info":{"title":"Modern Petstore API - Async","version":"1.0.0","description":"Asynchronous API specification for the Modern Petstore API. Describes real-time events and streaming endpoints across multiple protocols.\n\nThis specification complements the OpenAPI 3.2.0 specification by documenting event-driven and asynchronous communication patterns.\n\n## Supported Protocols\n\n### WebSocket (Native)\n- **Customer Support Chat**: Real-time bidirectional customer service chat\n- **Message Delivery**: Instant message delivery and read receipts\n- **Typing Indicators**: Real-time typing status notifications\n\n### Socket.IO\n- **Agent Assignment**: Real-time agent assignment and chat routing\n\n### MQTT (IoT)\n- **Order Status Updates**: Order status change notifications for IoT devices and kiosks\n- **Payment Notifications**: Payment event notifications\n- **QoS 1**: At-least-once delivery with message retention\n\n\n\n\n## Security\n\nAll connections require authentication. See the security section for protocol-specific authentication methods.","contact":{"name":"Petstore API Support","url":"https://petstoreapi.com/support","email":"support@petstoreapi.com"},"license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"tags":[{"name":"Chat","description":"Customer support chat messages"},{"name":"Orders","description":"Order lifecycle events"},{"name":"Payments","description":"Payment processing events"},{"name":"Subscriptions","description":"Client subscription management"},{"name":"Lifecycle","description":"Connection lifecycle events"}],"externalDocs":{"description":"AsyncAPI Integration Guide","url":"https://petstoreapi.com/docs/async-api"}},"servers":{"websocket":{"host":"api.petstoreapi.com","protocol":"wss","description":"WebSocket server for real-time events","security":[{"$ref":"#/components/securitySchemes/bearerToken"}],"bindings":{"ws":{"query":{"type":"object","properties":{"token":{"type":"string","description":"JWT access token for authentication"}},"required":["token"]}}}},"socketio":{"host":"api.petstoreapi.com","protocol":"wss","description":"Socket.IO server for real-time bidirectional communication","protocolVersion":"4","security":[{"$ref":"#/components/securitySchemes/bearerToken"}]},"mqtt":{"host":"api.petstoreapi.com:8883","protocol":"mqtts","description":"MQTT broker for IoT devices and kiosks (TLS enabled)","protocolVersion":"5.0","security":[{"$ref":"#/components/securitySchemes/userPassword"}],"bindings":{"mqtt":{"clientId":"petstore-client-{clientId}","cleanSession":true,"keepAlive":60}}}},"channels":{"customerSupportChat":{"address":"/v1/ws/chat","messages":{"chatMessage":{"$ref":"#/components/messages/ChatMessage"},"messageDelivered":{"$ref":"#/components/messages/MessageDelivered"},"messageRead":{"$ref":"#/components/messages/MessageRead"},"typingStarted":{"$ref":"#/components/messages/TypingStarted"},"typingStopped":{"$ref":"#/components/messages/TypingStopped"}},"description":"WebSocket channel for real-time customer support chat. Supports bidirectional messaging between customers and support agents.","servers":[{"$ref":"#/servers/websocket"}],"tags":[{"$ref":"#/info/tags/0"}],"bindings":{"ws":{"method":"GET","query":{"type":"object","properties":{"token":{"type":"string","description":"Bearer token for authentication"}}}}},"externalDocs":{"description":"WebSocket Chat Integration Guide","url":"https://petstoreapi.com/docs/websocket-chat"}},"chatSessionManagement":{"address":"/v1/ws/chat","messages":{"startChat":{"$ref":"#/components/messages/StartChatMessage"},"endChat":{"$ref":"#/components/messages/EndChatMessage"},"chatStarted":{"$ref":"#/components/messages/ChatStartedMessage"},"chatEnded":{"$ref":"#/components/messages/ChatEndedMessage"},"agentAssigned":{"$ref":"#/components/messages/AgentAssignedMessage"}},"description":"WebSocket channel for chat session management. Clients can start/end chat sessions and receive agent assignment notifications.","servers":[{"$ref":"#/servers/websocket"}],"tags":[{"$ref":"#/info/tags/0"}]},"wsLifecycle":{"address":"/v1/ws/chat","messages":{"connected":{"$ref":"#/components/messages/ConnectedMessage"},"disconnected":{"$ref":"#/components/messages/DisconnectedMessage"},"heartbeat":{"$ref":"#/components/messages/HeartbeatMessage"}},"description":"WebSocket connection lifecycle events including connect, disconnect, and heartbeat.","servers":[{"$ref":"#/servers/websocket"}],"tags":[{"$ref":"#/info/tags/4"}]},"supportChatSocketIO":{"address":"support-chat","messages":{"chatMessage":{"$ref":"#/components/messages/ChatMessage"},"messageDelivered":{"$ref":"#/components/messages/MessageDelivered"},"messageRead":{"$ref":"#/components/messages/MessageRead"},"typingStarted":{"$ref":"#/components/messages/TypingStarted"},"typingStopped":{"$ref":"#/components/messages/TypingStopped"},"startChat":{"$ref":"#/components/messages/StartChatMessage"},"endChat":{"$ref":"#/components/messages/EndChatMessage"},"chatStarted":{"$ref":"#/components/messages/ChatStartedMessage"},"chatEnded":{"$ref":"#/components/messages/ChatEndedMessage"},"agentAssigned":{"$ref":"#/components/messages/AgentAssignedMessage"}},"description":"Socket.IO channel for customer support chat. Supports bidirectional messaging, session management, and status updates.","servers":[{"$ref":"#/servers/socketio"}],"tags":[{"$ref":"#/info/tags/0"}],"externalDocs":{"description":"Socket.IO Chat Integration Guide","url":"https://petstoreapi.com/docs/socketio-chat"}},"orderStatusMQTT":{"address":"petstore/orders/{orderId}/status","messages":{"statusUpdate":{"$ref":"#/components/messages/MQTTOrderStatusChanged"}},"description":"MQTT topic for order status updates. IoT devices and kiosks can subscribe to receive real-time order status changes.","parameters":{"orderId":{"description":"The order identifier (UUID v7)","location":"$message.payload#/data/orderId"}},"servers":[{"$ref":"#/servers/mqtt"}],"tags":[{"$ref":"#/info/tags/1"}],"bindings":{"mqtt":{"qos":1,"retain":true}},"externalDocs":{"description":"MQTT Integration Guide","url":"https://petstoreapi.com/docs/mqtt"}},"paymentEventsMQTT":{"address":"petstore/payments/{paymentId}/events","messages":{"paymentCompleted":{"$ref":"#/components/messages/MQTTPaymentCompleted"},"paymentFailed":{"$ref":"#/components/messages/MQTTPaymentFailed"}},"description":"MQTT topic for payment event notifications","parameters":{"paymentId":{"description":"The payment identifier (UUID v7)","location":"$message.payload#/data/paymentId"}},"servers":[{"$ref":"#/servers/mqtt"}],"tags":[{"$ref":"#/info/tags/2"}],"bindings":{"mqtt":{"qos":1,"retain":false}}}},"operations":{"sendChatMessage":{"action":"send","channel":{"$ref":"#/channels/customerSupportChat"},"summary":"Send chat message","description":"Send a chat message to customer support or agent","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/customerSupportChat/messages/chatMessage"}]},"receiveChatMessage":{"action":"receive","channel":{"$ref":"#/channels/customerSupportChat"},"summary":"Receive chat messages","description":"Receive chat messages from customer support or other participants","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/customerSupportChat/messages/chatMessage"},{"$ref":"#/channels/customerSupportChat/messages/messageDelivered"},{"$ref":"#/channels/customerSupportChat/messages/messageRead"},{"$ref":"#/channels/customerSupportChat/messages/typingStarted"},{"$ref":"#/channels/customerSupportChat/messages/typingStopped"}]},"sendTypingIndicator":{"action":"send","channel":{"$ref":"#/channels/customerSupportChat"},"summary":"Send typing indicator","description":"Send typing started/stopped notifications","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/customerSupportChat/messages/typingStarted"},{"$ref":"#/channels/customerSupportChat/messages/typingStopped"}]},"manageChatSession":{"action":"send","channel":{"$ref":"#/channels/chatSessionManagement"},"summary":"Manage chat session","description":"Start or end a chat session","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/chatSessionManagement/messages/startChat"},{"$ref":"#/channels/chatSessionManagement/messages/endChat"}]},"receiveChatSessionEvents":{"action":"receive","channel":{"$ref":"#/channels/chatSessionManagement"},"summary":"Receive chat session events","description":"Receive chat session lifecycle events and agent assignments","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/chatSessionManagement/messages/chatStarted"},{"$ref":"#/channels/chatSessionManagement/messages/chatEnded"},{"$ref":"#/channels/chatSessionManagement/messages/agentAssigned"}]},"receiveLifecycleEvents":{"action":"receive","channel":{"$ref":"#/channels/wsLifecycle"},"summary":"Receive connection lifecycle events","description":"Receive connection status and heartbeat events","tags":[{"$ref":"#/info/tags/4"}],"messages":[{"$ref":"#/channels/wsLifecycle/messages/connected"},{"$ref":"#/channels/wsLifecycle/messages/disconnected"}]},"sendHeartbeat":{"action":"send","channel":{"$ref":"#/channels/wsLifecycle"},"summary":"Send heartbeat ping","description":"Send periodic heartbeat to maintain connection","tags":[{"$ref":"#/info/tags/4"}],"messages":[{"$ref":"#/channels/wsLifecycle/messages/heartbeat"}]},"sendChatMessageSocketIO":{"action":"send","channel":{"$ref":"#/channels/supportChatSocketIO"},"summary":"Send chat message via Socket.IO","description":"Send a chat message through Socket.IO channel","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/supportChatSocketIO/messages/chatMessage"}]},"receiveChatMessageSocketIO":{"action":"receive","channel":{"$ref":"#/channels/supportChatSocketIO"},"summary":"Receive chat messages via Socket.IO","description":"Receive chat messages, status updates, and session events","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/supportChatSocketIO/messages/chatMessage"},{"$ref":"#/channels/supportChatSocketIO/messages/messageDelivered"},{"$ref":"#/channels/supportChatSocketIO/messages/messageRead"},{"$ref":"#/channels/supportChatSocketIO/messages/typingStarted"},{"$ref":"#/channels/supportChatSocketIO/messages/typingStopped"}]},"sendTypingIndicatorSocketIO":{"action":"send","channel":{"$ref":"#/channels/supportChatSocketIO"},"summary":"Send typing indicator via Socket.IO","description":"Send typing started/stopped notifications via Socket.IO","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/supportChatSocketIO/messages/typingStarted"},{"$ref":"#/channels/supportChatSocketIO/messages/typingStopped"}]},"manageChatSessionSocketIO":{"action":"send","channel":{"$ref":"#/channels/supportChatSocketIO"},"summary":"Manage chat session via Socket.IO","description":"Start or end a chat session via Socket.IO","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/supportChatSocketIO/messages/startChat"},{"$ref":"#/channels/supportChatSocketIO/messages/endChat"}]},"receiveChatSessionEventsSocketIO":{"action":"receive","channel":{"$ref":"#/channels/supportChatSocketIO"},"summary":"Receive session events via Socket.IO","description":"Receive chat started, ended, and agent assignment events","tags":[{"$ref":"#/info/tags/0"}],"messages":[{"$ref":"#/channels/supportChatSocketIO/messages/chatStarted"},{"$ref":"#/channels/supportChatSocketIO/messages/chatEnded"},{"$ref":"#/channels/supportChatSocketIO/messages/agentAssigned"}]},"publishOrderStatusMQTT":{"action":"send","channel":{"$ref":"#/channels/orderStatusMQTT"},"summary":"Publish order status update","description":"System publishes order status updates to MQTT topic","tags":[{"$ref":"#/info/tags/1"}],"messages":[{"$ref":"#/channels/orderStatusMQTT/messages/statusUpdate"}]},"receiveOrderStatusMQTT":{"action":"receive","channel":{"$ref":"#/channels/orderStatusMQTT"},"summary":"Receive order status updates via MQTT","description":"Subscribe to receive order status updates from MQTT topic","tags":[{"$ref":"#/info/tags/1"}],"messages":[{"$ref":"#/channels/orderStatusMQTT/messages/statusUpdate"}]},"publishPaymentEventsMQTT":{"action":"send","channel":{"$ref":"#/channels/paymentEventsMQTT"},"summary":"Publish payment events","description":"System publishes payment events to MQTT topic","tags":[{"$ref":"#/info/tags/2"}],"messages":[{"$ref":"#/channels/paymentEventsMQTT/messages/paymentCompleted"},{"$ref":"#/channels/paymentEventsMQTT/messages/paymentFailed"}]},"receivePaymentEventsMQTT":{"action":"receive","channel":{"$ref":"#/channels/paymentEventsMQTT"},"summary":"Receive payment events via MQTT","description":"Subscribe to receive payment events from MQTT topic","tags":[{"$ref":"#/info/tags/2"}],"messages":[{"$ref":"#/channels/paymentEventsMQTT/messages/paymentCompleted"},{"$ref":"#/channels/paymentEventsMQTT/messages/paymentFailed"}]}},"components":{"securitySchemes":{"bearerToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT access token obtained from OAuth 2.0 authorization flow"},"userPassword":{"type":"userPassword","description":"Username and password authentication for MQTT connections"}},"messageTraits":{"commonHeaders":{"headers":{"type":"object","properties":{"correlationId":{"type":"string","format":"uuid","description":"Correlation ID for request tracing"},"messageId":{"type":"string","format":"uuid","description":"Unique message identifier"},"timestamp":{"type":"string","format":"date-time","description":"Message timestamp (RFC 3339)"}},"required":["correlationId","messageId","timestamp"]}},"eventMetadata":{"headers":{"type":"object","properties":{"eventId":{"type":"string","format":"uuid","description":"Unique event identifier"},"eventType":{"type":"string","description":"Type of event"},"eventVersion":{"type":"string","description":"Event schema version","default":"1.0"}},"required":["eventId","eventType"]}}},"messages":{"ChatMessage":{"name":"ChatMessage","title":"Chat Message","summary":"Customer support chat message","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}],"payload":{"$ref":"#/components/schemas/ChatMessagePayload"},"examples":[{"name":"customerMessage","summary":"Customer sends a message","payload":{"messageId":"msg_1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6","chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","senderId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","senderType":"CUSTOMER","content":"Hello, I need help with my order","timestamp":"2024-12-16T10:30:00Z"}},{"name":"agentMessage","summary":"Agent responds","payload":{"messageId":"msg_2b3c4d5e-6f7g-8h9i-0j1k-l2m3n4o5p6q7","chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","senderId":"agent_019b4138-1234-7abc-8def-123456789abc","senderType":"AGENT","content":"Hi! I'd be happy to help. What's your order number?","timestamp":"2024-12-16T10:30:15Z"}}]},"MessageDelivered":{"name":"MessageDelivered","title":"Message Delivered","summary":"Notification that a message was delivered","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}],"payload":{"$ref":"#/components/schemas/MessageDeliveredPayload"},"examples":[{"name":"messageDelivered","summary":"Message delivery confirmation","payload":{"messageId":"msg_1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6","chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","deliveredAt":"2024-12-16T10:30:01Z"}}]},"MessageRead":{"name":"MessageRead","title":"Message Read","summary":"Notification that a message was read","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}],"payload":{"$ref":"#/components/schemas/MessageReadPayload"},"examples":[{"name":"messageRead","summary":"Message read receipt","payload":{"messageId":"msg_1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6","chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","readBy":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","readAt":"2024-12-16T10:30:05Z"}}]},"TypingStarted":{"name":"TypingStarted","title":"Typing Started","summary":"Notification that a user started typing","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}],"payload":{"$ref":"#/components/schemas/TypingIndicatorPayload"},"examples":[{"name":"typingStarted","summary":"User started typing","payload":{"chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","userId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","userType":"CUSTOMER","status":"TYPING","timestamp":"2024-12-16T10:30:10Z"}}]},"TypingStopped":{"name":"TypingStopped","title":"Typing Stopped","summary":"Notification that a user stopped typing","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}],"payload":{"$ref":"#/components/schemas/TypingIndicatorPayload"},"examples":[{"name":"typingStopped","summary":"User stopped typing","payload":{"chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","userId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","userType":"CUSTOMER","status":"STOPPED","timestamp":"2024-12-16T10:30:12Z"}}]},"StartChatMessage":{"name":"StartChatMessage","title":"Start Chat Session","summary":"Request to start a new chat session","contentType":"application/json","payload":{"$ref":"#/components/schemas/StartChatPayload"},"examples":[{"name":"startChat","summary":"Customer starts a chat","payload":{"action":"start","customerId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","subject":"Order Inquiry"}}]},"EndChatMessage":{"name":"EndChatMessage","title":"End Chat Session","summary":"Request to end a chat session","contentType":"application/json","payload":{"$ref":"#/components/schemas/EndChatPayload"},"examples":[{"name":"endChat","summary":"Customer ends chat","payload":{"action":"end","chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc"}}]},"ChatStartedMessage":{"name":"ChatStartedMessage","title":"Chat Session Started","summary":"Notification that a chat session was started","contentType":"application/json","payload":{"$ref":"#/components/schemas/ChatStartedPayload"},"examples":[{"name":"chatStarted","summary":"Chat session created","payload":{"chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","customerId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","status":"WAITING","startedAt":"2024-12-16T10:30:00Z"}}]},"ChatEndedMessage":{"name":"ChatEndedMessage","title":"Chat Session Ended","summary":"Notification that a chat session was ended","contentType":"application/json","payload":{"$ref":"#/components/schemas/ChatEndedPayload"},"examples":[{"name":"chatEnded","summary":"Chat session closed","payload":{"chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","endedAt":"2024-12-16T10:45:00Z","reason":"CUSTOMER_ENDED"}}]},"AgentAssignedMessage":{"name":"AgentAssignedMessage","title":"Agent Assigned","summary":"Notification that an agent was assigned to a chat","contentType":"application/json","payload":{"$ref":"#/components/schemas/AgentAssignedPayload"},"examples":[{"name":"agentAssigned","summary":"Agent assigned to chat","payload":{"chatSessionId":"chat_019b4139-1234-7abc-8def-123456789abc","agentId":"agent_019b4138-1234-7abc-8def-123456789abc","agentName":"Sarah Johnson","assignedAt":"2024-12-16T10:30:05Z"}}]},"ConnectedMessage":{"name":"ConnectedMessage","title":"Connection Established","summary":"Server confirms WebSocket connection established","contentType":"application/json","payload":{"$ref":"#/components/schemas/ConnectedPayload"},"examples":[{"name":"connected","summary":"Connection established","payload":{"type":"connected","connectionId":"conn_1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6","timestamp":"2024-12-16T10:00:00Z","heartbeatInterval":30000}}]},"DisconnectedMessage":{"name":"DisconnectedMessage","title":"Connection Closed","summary":"Server indicates connection will be closed","contentType":"application/json","payload":{"$ref":"#/components/schemas/DisconnectedPayload"},"examples":[{"name":"disconnectedIdle","summary":"Disconnected due to idle timeout","payload":{"type":"disconnected","reason":"IDLE_TIMEOUT","message":"Connection closed due to inactivity"}}]},"HeartbeatMessage":{"name":"HeartbeatMessage","title":"Heartbeat Ping/Pong","summary":"Heartbeat message to maintain connection","contentType":"application/json","payload":{"$ref":"#/components/schemas/HeartbeatPayload"},"examples":[{"name":"ping","summary":"Client ping","payload":{"type":"ping","timestamp":"2024-12-16T10:01:00Z"}},{"name":"pong","summary":"Server pong","payload":{"type":"pong","timestamp":"2024-12-16T10:01:00Z"}}]},"MQTTOrderStatusChanged":{"name":"MQTTOrderStatusChanged","title":"MQTT Order Status Changed","summary":"Order status change notification via MQTT","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/eventMetadata"}],"payload":{"$ref":"#/components/schemas/OrderStatusChangedPayload"},"examples":[{"name":"orderApproved","summary":"Order approved notification via MQTT","payload":{"eventId":"evt_9f4a8b3c-2d5e-6f7g-8h9i-0j1k2l3m4n5o","eventType":"order.statusChanged","timestamp":"2024-12-16T10:30:00Z","data":{"orderId":"019b4139-1234-7abc-8def-123456789abc","petId":"019b4132-70aa-764f-b315-e2803d882a24","userId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","previousStatus":"PLACED","newStatus":"APPROVED","totalAmount":"125.50","currency":"USD","changedBy":"system"}}},{"name":"orderDelivered","summary":"Order delivered notification via MQTT","payload":{"eventId":"evt_3c4d5e6f-7g8h-9i0j-1k2l-m3n4o5p6q7r8","eventType":"order.statusChanged","timestamp":"2024-12-18T16:45:00Z","data":{"orderId":"019b4139-1234-7abc-8def-123456789abc","petId":"019b4132-70aa-764f-b315-e2803d882a24","userId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","previousStatus":"SHIPPED","newStatus":"DELIVERED","totalAmount":"125.50","currency":"USD","changedBy":"system"}}}]},"MQTTPaymentCompleted":{"name":"MQTTPaymentCompleted","title":"MQTT Payment Completed","summary":"Payment completed notification via MQTT","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/eventMetadata"}],"payload":{"$ref":"#/components/schemas/PaymentCompletedPayload"},"examples":[{"name":"cardPaymentCompleted","summary":"Card payment completed via MQTT","payload":{"eventId":"evt_pay_4d5e6f7g-8h9i-0j1k-2l3m-n4o5p6q7r8s9","eventType":"payment.completed","timestamp":"2024-12-16T10:29:55Z","data":{"paymentId":"019b4139-pay1-7abc-8def-123456789abc","orderId":"019b4139-1234-7abc-8def-123456789abc","userId":"019b4138-e0af-70b9-8f0c-6ea97d495dfa","amount":"125.50","currency":"USD","paymentMethod":"CARD","last4":"4242","brand":"visa"}}}]},"MQTTPaymentFailed":{"name":"MQTTPaymentFailed","title":"MQTT Payment Failed","summary":"Payment failure notification via MQTT","contentType":"application/json","traits":[{"$ref":"#/components/messageTraits/eventMetadata"}],"payload":{"$ref":"#/components/schemas/PaymentFailedPayload"},"examples":[{"name":"cardDeclined","summary":"Card declined via MQTT","payload":{"eventId":"evt_pay_5e6f7g8h-9i0j-1k2l-3m4n-o5p6q7r8s9t0","eventType":"payment.failed","timestamp":"2024-12-16T10:29:55Z","data":{"paymentId":"019b4139-pay2-7abc-8def-123456789abc","orderId":"019b4139-5678-7def-9012-345678901234","userId":"019b4128-6a6b-777c-9ae8-335e962c68d8","amount":"75.00","currency":"USD","paymentMethod":"CARD","failureCode":"CARD_DECLINED","failureMessage":"Your card was declined."}}}]}},"schemas":{"OrderStatusChangedPayload":{"type":"object","required":["eventId","eventType","timestamp","data"],"properties":{"eventId":{"type":"string","format":"uuid","description":"Unique event identifier"},"eventType":{"type":"string","const":"order.statusChanged","description":"Type of event"},"timestamp":{"type":"string","format":"date-time","description":"When the event occurred (RFC 3339)"},"data":{"$ref":"#/components/schemas/OrderEventData"}}},"PaymentCompletedPayload":{"type":"object","required":["eventId","eventType","timestamp","data"],"properties":{"eventId":{"type":"string","format":"uuid","description":"Unique event identifier"},"eventType":{"type":"string","const":"payment.completed","description":"Type of event"},"timestamp":{"type":"string","format":"date-time","description":"When the event occurred (RFC 3339)"},"data":{"$ref":"#/components/schemas/PaymentEventData"}}},"PaymentFailedPayload":{"type":"object","required":["eventId","eventType","timestamp","data"],"properties":{"eventId":{"type":"string","format":"uuid","description":"Unique event identifier"},"eventType":{"type":"string","const":"payment.failed","description":"Type of event"},"timestamp":{"type":"string","format":"date-time","description":"When the event occurred (RFC 3339)"},"data":{"$ref":"#/components/schemas/PaymentFailedData"}}},"ChatMessagePayload":{"type":"object","required":["messageId","chatSessionId","senderId","senderType","content","timestamp"],"properties":{"messageId":{"type":"string","format":"uuid","description":"Unique message identifier"},"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"senderId":{"type":"string","format":"uuid","description":"ID of the message sender (customer or agent)"},"senderType":{"type":"string","enum":["CUSTOMER","AGENT"],"description":"Type of sender"},"content":{"type":"string","minLength":1,"maxLength":5000,"description":"Message content"},"timestamp":{"type":"string","format":"date-time","description":"Message timestamp (RFC 3339)"},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["IMAGE","FILE","LINK"]},"url":{"type":"string","format":"uri"},"name":{"type":"string"}}},"description":"Optional message attachments"}}},"MessageDeliveredPayload":{"type":"object","required":["messageId","chatSessionId","deliveredAt"],"properties":{"messageId":{"type":"string","format":"uuid","description":"Message identifier"},"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"deliveredAt":{"type":"string","format":"date-time","description":"Delivery timestamp (RFC 3339)"}}},"MessageReadPayload":{"type":"object","required":["messageId","chatSessionId","readBy","readAt"],"properties":{"messageId":{"type":"string","format":"uuid","description":"Message identifier"},"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"readBy":{"type":"string","format":"uuid","description":"ID of user who read the message"},"readAt":{"type":"string","format":"date-time","description":"Read timestamp (RFC 3339)"}}},"TypingIndicatorPayload":{"type":"object","required":["chatSessionId","userId","userType","status","timestamp"],"properties":{"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"userId":{"type":"string","format":"uuid","description":"ID of user who is typing"},"userType":{"type":"string","enum":["CUSTOMER","AGENT"],"description":"Type of user"},"status":{"type":"string","enum":["TYPING","STOPPED"],"description":"Typing status"},"timestamp":{"type":"string","format":"date-time","description":"Status timestamp (RFC 3339)"}}},"StartChatPayload":{"type":"object","required":["action","customerId"],"properties":{"action":{"type":"string","const":"start"},"customerId":{"type":"string","format":"uuid","description":"Customer identifier"},"subject":{"type":"string","maxLength":200,"description":"Optional chat subject/topic"}}},"EndChatPayload":{"type":"object","required":["action","chatSessionId"],"properties":{"action":{"type":"string","const":"end"},"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"}}},"ChatStartedPayload":{"type":"object","required":["chatSessionId","customerId","status","startedAt"],"properties":{"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"customerId":{"type":"string","format":"uuid","description":"Customer identifier"},"status":{"type":"string","enum":["WAITING","ACTIVE"],"description":"Chat session status"},"startedAt":{"type":"string","format":"date-time","description":"Session start timestamp (RFC 3339)"}}},"ChatEndedPayload":{"type":"object","required":["chatSessionId","endedAt","reason"],"properties":{"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"endedAt":{"type":"string","format":"date-time","description":"Session end timestamp (RFC 3339)"},"reason":{"type":"string","enum":["CUSTOMER_ENDED","AGENT_ENDED","TIMEOUT","SYSTEM"],"description":"Reason for ending the chat"}}},"AgentAssignedPayload":{"type":"object","required":["chatSessionId","agentId","assignedAt"],"properties":{"chatSessionId":{"type":"string","format":"uuid","description":"Chat session identifier"},"agentId":{"type":"string","format":"uuid","description":"Assigned agent identifier"},"agentName":{"type":"string","description":"Agent display name"},"assignedAt":{"type":"string","format":"date-time","description":"Assignment timestamp (RFC 3339)"}}},"ConnectedPayload":{"type":"object","required":["type","connectionId","timestamp"],"properties":{"type":{"type":"string","const":"connected"},"connectionId":{"type":"string","format":"uuid","description":"Unique connection identifier"},"timestamp":{"type":"string","format":"date-time","description":"Connection timestamp (RFC 3339)"},"heartbeatInterval":{"type":"integer","description":"Expected heartbeat interval in milliseconds","default":30000}}},"DisconnectedPayload":{"type":"object","required":["type","reason"],"properties":{"type":{"type":"string","const":"disconnected"},"reason":{"type":"string","enum":["IDLE_TIMEOUT","AUTH_EXPIRED","SERVER_SHUTDOWN","CLIENT_REQUEST","PROTOCOL_ERROR"],"description":"Reason for disconnection"},"message":{"type":"string","description":"Human-readable disconnection message"}}},"HeartbeatPayload":{"type":"object","required":["type","timestamp"],"properties":{"type":{"type":"string","enum":["ping","pong"]},"timestamp":{"type":"string","format":"date-time","description":"Heartbeat timestamp (RFC 3339)"}}},"OrderEventData":{"type":"object","required":["orderId","previousStatus","newStatus"],"properties":{"orderId":{"type":"string","format":"uuid","description":"The order identifier"},"petId":{"type":"string","format":"uuid","description":"The pet identifier"},"userId":{"type":"string","format":"uuid","description":"The user identifier"},"previousStatus":{"type":"string","enum":["PLACED","APPROVED","SHIPPED","DELIVERED","CANCELLED"],"description":"The order status before this change"},"newStatus":{"type":"string","enum":["PLACED","APPROVED","SHIPPED","DELIVERED","CANCELLED"],"description":"The new order status after this change"},"totalAmount":{"type":"string","description":"Order total amount"},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"Currency code (ISO 4217)"},"changedBy":{"type":"string","description":"Identifier of who/what triggered the change (user ID or system)"}}},"PaymentEventData":{"type":"object","required":["paymentId","orderId","amount","currency","paymentMethod"],"properties":{"paymentId":{"type":"string","format":"uuid","description":"The payment identifier"},"orderId":{"type":"string","format":"uuid","description":"The associated order identifier"},"userId":{"type":"string","format":"uuid","description":"The user identifier"},"amount":{"type":"string","description":"Payment amount"},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"Currency code (ISO 4217)"},"paymentMethod":{"type":"string","enum":["CARD","BANK_ACCOUNT"],"description":"Payment method used"},"last4":{"type":"string","pattern":"^\\d{4}$","description":"Last 4 digits of card or account number"},"brand":{"type":"string","description":"Card brand (visa, mastercard, amex, etc.)"}}},"PaymentFailedData":{"type":"object","required":["paymentId","orderId","amount","currency","paymentMethod","failureCode"],"properties":{"paymentId":{"type":"string","format":"uuid","description":"The payment identifier"},"orderId":{"type":"string","format":"uuid","description":"The associated order identifier"},"userId":{"type":"string","format":"uuid","description":"The user identifier"},"amount":{"type":"string","description":"Attempted payment amount"},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"Currency code (ISO 4217)"},"paymentMethod":{"type":"string","enum":["CARD","BANK_ACCOUNT"],"description":"Payment method used"},"failureCode":{"type":"string","enum":["CARD_DECLINED","INSUFFICIENT_FUNDS","EXPIRED_CARD","INVALID_CARD","PROCESSING_ERROR","FRAUD_SUSPECTED","BANK_ACCOUNT_CLOSED","INVALID_ACCOUNT"],"description":"Failure reason code"},"failureMessage":{"type":"string","description":"Human-readable failure message"}}}}}}