openapi: 3.0.0
info:
  title: UAE Server Real-time UAV Status Service
  version: 1.0.0
  description: |
    UAE Server Real-time UAV Status Service.  
    © 2022, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).  
    All rights reserved.

externalDocs:
  description: >
    3GPP TS 29.257 V17.1.0; Application layer support for Uncrewed Aerial System (UAS);
    UAS Application Enabler (UAE) Server Services; Stage 3.
  url: https://www.3gpp.org/ftp/Specs/archive/29_series/29.257/

servers:
  - url: '{apiRoot}/uae-uav-status/v1'
    variables:
      apiRoot:
        default: https://example.com
        description: apiRoot as defined in clause 5.2.4 of 3GPP TS 29.122

security:
  - {}
  - oAuth2ClientCredentials: []

paths:
  /subscriptions:
    get:
      summary: Retrieve all the active real-time UAV status subscriptions managed by the UAE Server.
      operationId: GetRTUavStatusSubscriptions
      tags:
        - Real-time UAV Status Subscriptions (Collection)
      responses:
        '200':
          description: >
            OK. All the active real-time UAV status subscriptions managed by the UAE Server
            shall be returned.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RTUavStatusSubsc'
        '307':
          $ref: 'TS29122_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29122_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29122_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29122_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29122_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29122_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29122_CommonData.yaml#/components/responses/406'
        '429':
          $ref: 'TS29122_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29122_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29122_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29122_CommonData.yaml#/components/responses/default'

    post:
      summary: Request the creation of a subscription to real-time UAV status reporting.
      operationId: CreateRTUavStatusSubsc
      tags:
        - Real-time UAV Status Subscriptions (Collection)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RTUavStatusSubsc'
      responses:
        '200':
          description: >
            OK. The subscription is successfully created and a representation of the created
            Individual Real-time UAV Status Subscription resource shall be returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RTUavStatusSubsc'
          headers:
            Location:
              description: >
                Contains the URI of the created Individual Real-time UAV Status Subscription
                resource.
              required: true
              schema:
                type: string
        '400':
          $ref: 'TS29122_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29122_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29122_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29122_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29122_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29122_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29122_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29122_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29122_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29122_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29122_CommonData.yaml#/components/responses/default'
      callbacks:
        RTUavStatusNotification:
          '{$request.body#/notificationUri}/uav-status':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/RTUavStatusNotif'
              responses:
                '204':
                  description: >
                    No Content. The real-time UAV status notification is successfully
                    received and acknowledged.
                '307':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/307'
                '308':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/308'
                '400':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/400'
                '401':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/401'
                '403':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/403'
                '404':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/404'
                '411':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/411'
                '413':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/413'
                '415':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/415'
                '429':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/429'
                '500':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/500'
                '503':
                  $ref: 'TS29122_CommonData.yaml#/components/responses/503'
                default:
                  $ref: 'TS29122_CommonData.yaml#/components/responses/default'


  /subscriptions/{subscriptionId}:
    get:
      summary: Retrieve a real-time UAV status subscription resource.
      operationId: GetRTUavStatusSubscription
      tags:
        - Individual Real-time UAV Status Subscription (Document)
      parameters:
        - name: subscriptionId
          in: path
          description: Individual Real-time UAV Status Subscription identifier.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK. The requested real-time UAV status subscription resource shall be returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RTUavStatusSubsc'
        '307':
          $ref: 'TS29122_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29122_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29122_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29122_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29122_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29122_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29122_CommonData.yaml#/components/responses/406'
        '429':
          $ref: 'TS29122_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29122_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29122_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29122_CommonData.yaml#/components/responses/default'

    put:
      summary: Request the update of an existing real-time UAV status subscription.
      operationId: UpdateRTUavStatusSubscription
      tags:
        - Individual Real-time UAV Status Subscription (Document)
      parameters:
        - name: subscriptionId
          in: path
          description: Individual Real-time UAV Status Subscription identifier.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RTUavStatusSubsc'
      responses:
        '200':
          description: >
            OK. The real-time UAV status subscription is successfully updated and a
            representation of the updated Individual Real-time UAV Status Subscription
            resource shall be returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RTUavStatusSubsc'
        '204':
          description: No Content. The real-time UAV status subscription is successfully updated.
        '307':
          $ref: 'TS29122_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29122_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29122_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29122_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29122_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29122_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29122_CommonData.yaml#/components/responses/406'
        '429':
          $ref: 'TS29122_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29122_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29122_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29122_CommonData.yaml#/components/responses/default'

    delete:
      summary: Request the deletion of an existing real-time UAV status subscription.
      operationId: DeleteRTUavStatusSubscription
      tags:
        - Individual Real-time UAV Status Subscription (Document)
      parameters:
        - name: subscriptionId
          in: path
          description: Individual Real-time UAV Status Subscription identifier.
          required: true
          schema:
            type: string
      responses:
        '204':
          description: >
            No Content. The Individual Real-time UAV Status Subscription resource
            is successfully deleted.
        '307':
          $ref: 'TS29122_CommonData.yaml#/components/responses/307'
        '308':
          $ref: 'TS29122_CommonData.yaml#/components/responses/308'
        '400':
          $ref: 'TS29122_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29122_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29122_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29122_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29122_CommonData.yaml#/components/responses/406'
        '429':
          $ref: 'TS29122_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29122_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29122_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29122_CommonData.yaml#/components/responses/default'


components:
  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: '{tokenUrl}'
          scopes: {}

  schemas:
    RTUavStatusSubsc:
      description: >
        Represents the parameters to request the creation or update of a subscription
        to real-time UAV status reporting.
      type: object
      properties:
        uassId:
          $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri'
        uavIds:
          type: array
          items:
            $ref: 'TS29257_UAE_C2OperationModeManagement.yaml#/components/schemas/UavId'
          minItems: 1
        notificationUri:
          $ref: 'TS29122_CommonData.yaml#/components/schemas/Uri'
        suppFeat:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
      required:
        - uassId
        - uavIds
        - notificationUri

    RTUavStatusNotif:
      description: Represents a real-time UAV status notification.
      type: object
      properties:
        subscriptionId:
          type: string
        rTUavStatus:
          type: array
          items:
            $ref: '#/components/schemas/RTUavStatus'
          minItems: 1
      required:
        - subscriptionId
        - rTUavStatus

    RTUavStatus:
      description: Represents real-time UAV status information.
      type: object
      properties:
        uavId:
          $ref: 'TS29257_UAE_C2OperationModeManagement.yaml#/components/schemas/UavId'
        uavNetConnStatus:
          $ref: '#/components/schemas/UavNetConnStatus'
        uavLocInfo:
          $ref: 'TS29122_MonitoringEvent.yaml#/components/schemas/LocationInfo'
      allOf:
        - required: [uavId]
        - oneOf:
          - required: [uavLocInfo]
          - allOf:
            - required: [uavLocInfo]
            - required: [uavNetConnStatus]

    UavNetConnStatus:
      description: Represents UAV network connection status information.
      type: object
      properties:
        statusInfo:
          $ref: 'TS29122_MonitoringEvent.yaml#/components/schemas/MonitoringType'
        timestamp:
          $ref: 'TS29122_CommonData.yaml#/components/schemas/DateTime'
      required:
        - statusInfo
        - timestamp
