asyncapi: 2.0.0
info:
  title: eBay PLA Campaign Budget Status Notifications
  version: 1.0.0
  description: This contract defines the eBay notification for the Promoted Listings Advanced (PLA) daily campaign budget status. This notification is sent when the specified PLA campaign daily budget has been completely exhausted.
channels:
  PLA_CAMPAIGN_BUDGET_STATUS:
    subscribe:
      message:
        $ref: '#/components/messages/message'
      bindings:
        http:
          type: request
          method: POST
          headers:
            type: object
            properties:
              Content-Type:
                type: string
                enum: ['application/json']             
components:
  messages:
    message:
      headers:
        type: object
        properties:
          X-EBAY-SIGNATURE:
            description: The ECC message signature. This signature is used to process and validate the message payload. 
            type: string
      payload:
        type: object
        properties:
          metadata:
            $ref: '#/components/schemas/Metadata'
          notification:
            $ref: '#/components/schemas/Notification'
            
  schemas:
    Metadata:
      type: object
      properties:
        topic:
          type: string
          description: 'The notification topic to which the user or application is subscribed.'
        schemaVersion:
          type: string
          description: 'The schema version for the notification topic.'
        deprecated:
          type: boolean
          description: 'An indication regarding whether the schema version or topic is deprecated.'
          default: 'false'

    Notification:
      type: object
      properties:
        notificationId:
          type: string
          description: 'The unique identifier for the notification topic.'
        eventDate:
          type: string
          description: 'The event date associated with the notification. This date is returned as a UTC-formatted timestamp.'
        publishDate:
          type: string
          description: 'The publish date for the notification message. This date is returned as a UTC-formatted timestamp.'
        publishAttemptCount:
          type: integer
          description: 'The number of attempts that have been made to publish this notification message.'
        data:
         $ref: '#/components/schemas/PLACampaignBudgetStatusData'
    
          
    PLACampaignBudgetStatusData:
      type: object
      description: 'The payload for the PLA campaign budget status notification.'
      properties:
        user:
          $ref: '#/components/schemas/User'
        campaignId:
          type: string
          description: 'The unique identifier for the PLA campaign that has an exhausted daily budget.'
        budgetStatus:
          type: string
          enum:
            - OUT_OF_BUDGET
          description: 'The current daily budget status for the specified PLA campaign.'

    User:
      type: object
      description: 'The user details for the notification subscriber.'
      properties:
        userId:
          type: string
          description: 'The unique identifier for the user.'
        username:
          type: string
          description: 'The username associated with the user.'
