asyncapi: 2.6.0
info:
  title: Flight Update Notification API
  version: 2.0.0
  description: |
    Flight Update Notification informs about operational flight status change events. Event data can be used to retrieve actual and detailed data from Lufthansa Group flight information APIs. 
    In order, to obtain further details about the change use the provided meta link to access the flight status resource. <br><br> Pre-requisite: <br>This Api requires an username and password in order to subscribe to notifications. <br>Please refer https://developer.lufthansa.com/docs/read/api_basics/notification_service/Obtain_a_JWT_for_MQTT_broker in order to access Certificate Manager Api. Certificate Manager Api will provide mqtt client ID and jwt required to connect to Mqtt Broker.  <br><pre><code>Username - mqtt client id  <br>Password - jwt</code></pre>
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'
servers:
  production:
    url: 'ssl://lhgopenapi.lufthansa.com:8883'
    protocol: mqtt
    description: production server
    security:
      - user-password: []
defaultContentType: application/json
channels:
  'prd/FlightUpdate/{airlineCode}/{airlineCodeWithFlightNumber}/{flightDate}':
    description: flight message
    parameters:
      airlineCode:
        $ref: '#/components/parameters/airlineCode'
      airlineCodeWithFlightNumber:
        $ref: '#/components/parameters/airlineCodeWithFlightNumber'
      flightDate:
        $ref: '#/components/parameters/flightDate'
    subscribe:
      summary: Inform about flight update.
      operationId: flightUpdate
      description: |
        The following changes are detected and trigger a notification to subscribed clients:
        | Text for MQTT message |
        | --------|
        | New Estimated Departure   |
        | New Estimated Arrival |
        | Departed |
        | Arrived |
        | New Gate Information |
        | Cancelled |
        | Reinstated |
        | Diverted |
        | Rerouted |
        | Schedule Change |
      message:
        $ref: '#/components/messages/message'
components:
  messages:
    message:
      name: message
      title: flight update message
      summary: Inform about flight update.
      contentType: application/json
      payload:
        $ref: '#/components/schemas/message'
  schemas:
    message:
      type: object
      properties:
        Update:
          type: object
          properties:
            Timestamp:
              type: string
              format: date-time
              description: 'UTC timestamp from FLUP: yyyy-mm-dd:hh:mm:ss'
              examples:
                - 2016-06-29T06:50:54.000Z
            Message:
              type: string
              format: string
              description: 'Message text for this action code'
              examples:
                - New Gate Information
            FlightNumber:
              type: string
              format: string
              description: >-
                Flight number of the flight that is being queried. It includes
                both the airline code as well as the number
              examples:
                - LH400
            ScheduledFlightDate:
              type: string
              format: date
              description: 'Scheduled flight date'
              examples:
                - 2016-06-29
            ScheduledFlightTime:
              type: string
              format: string
              description: 'Scheduled flight time in minutes'
              examples:
                - '0051'
        Meta:
          type: object
          properties:
            '@Version':
              type: string
              format: string
              examples:
                - 1.0.0
              description: Version
            Link:
              type: array
              items:
                type: object
                properties:
                  '@Href':
                    type: string
                    format: string
                    description: URL of flight status resource for this flight
                    examples:
                      - https://api.lufthansa.com/v1/operations/flightstatus/LH400/2016-06-29
                  '@Rel':
                    type: string
                    format: string
                    description: Relationship with linked document
                    examples:
                      - related
  securitySchemes:
    user-password:
      type: userPassword
  parameters:
    airlineCode:
      description: 'airline code.'
      schema:
        type: string
        examples:
          - LH
    airlineCodeWithFlightNumber:
      description: 'airline code with flight number.'
      schema:
        type: string
        examples:
          - LH242
    flightDate:
      description: 'flight date.'
      schema:
        type: string
        examples:
          - 2020-10-13
