asyncapi: 2.0.0
info:
  title: eBay Feedback Star Rating Change Notifications
  version: 1.0.0
  description: 'This contract defines the payload for eBay feedback received notification. The service dispatches notifications to users when there is a change in their current feedback star rating.'
channels:
  FEEDBACK_STAR_RATING:
    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: ECC message signature.
            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/FeedbackStarRatingData'

    FeedbackStarRatingData:
      type: object
      description: "This rating indicates how many buyers and sellers have provided feedback for a user. A user receives a different star based on how many buyers and sellers have provided positive feedback about their experience with the user. Colored stars helps to identify users with higher feedback scores."
      properties:
        user:
            $ref: '#/components/schemas/UserFeedbackData'

    UserFeedbackData:
      type: object
      description: "Information about the user whose feedback rating has changed."
      properties:
        userId:
          type: string
          description: "The unique, public identifier for the user whose feedback rating has changed."
        positiveFeedbackPercent:
          type: number
          description: "Calculated user feedback percent based on negative and positive feedback count."
        feedbackStarRating:
          description: "Indicates the feedback star rating for the user whose feedback rating has changed."
          type: string
          enum:
            - SILVER_SHOOTING
            - GREEN_SHOOTING
            - RED_SHOOTING
            - PURPLE_SHOOTING
            - TURQUOISE_SHOOTING
            - YELLOW_SHOOTING
            - GREEN
            - RED
            - PURPLE
            - TURQUOISE
            - BLUE
            - YELLOW
            - NONE
