openapi: 3.0.0
info:
  version: 1.0.0
  title: Namf_EventExposure
  description: AMF Event Exposure Service
security:
  - {}
  - oAuth2Clientcredentials:
      - namf-evts
externalDocs:
  description: 3GPP TS 29.518 V15.2.0; 5G System; Access and Mobility Management Services
  url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.518/'
servers:
  - url: '{apiRoot}/namf-evts/v1'
    variables:
      apiRoot:
        default: https://example.com
        description: apiRoot as defined in subclause subclause 4.4 of 3GPP TS 29.501
paths:
  /subscriptions:
    post:
      summary: Namf_EventExposure Subscribe service Operation
      tags:
        - Subscriptions collection (Document)
      operationId: CreateSubscription
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AmfCreateEventSubscription'
        required: true
      responses:
        '201':
          description: Subsription Created
          headers:
            Location:
              description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/namf-evts/v1/subscriptions/{subscriptionId}'
              required: true
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmfCreatedEventSubscription'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          description: Unexpected error
      callbacks:
        onEventReport:
          '{$request.body#/subscription/eventNotifyUri}':
            post:
              summary: Event Notificaiton Delivery
              requestBody:
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/AmfEventNotification'
                required: true
              responses:
                '204':
                  description: Successful acknowledgement
                '400':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/400'
                '411':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/411'
                '413':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/413'
                '415':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/415'
                '429':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/429'
                '500':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/500'
                '503':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/503'
                default:
                  description: Unexpected error
        onSubscriptionIdChangeEvtReport:
          '{$request.body#/subscription/subsChangeNotifyUri}':
            post:
              summary: Event Notificaiton Delivery For Subscription Id Change
              requestBody:
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/AmfEventNotification'
                required: true
              responses:
                '204':
                  description: Successful acknowledgement
                '400':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/400'
                '411':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/411'
                '413':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/413'
                '415':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/415'
                '429':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/429'
                '500':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/500'
                '503':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/503'
                default:
                  description: Unexpected error
  /subscriptions/{subscriptionId}:
    patch:
      summary: Namf_EventExposure Subscribe Modify service Operation
      tags:
        - Individual subscription (Document)
      operationId: ModifySubscription
      parameters:
        - name: subscriptionId
          in: path
          required: true
          description: Unique ID of the subscription to be modified
          schema:
            type: string
      requestBody:
        content:
          application/json-patch+json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/AmfUpdateEventSubscriptionItem'
                - $ref: '#/components/schemas/AmfUpdateEventOptionItem'
        required: true
      responses:
        '200':
          description: Subsription modified successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmfUpdatedEventSubscription'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          description: Unexpected error
    delete:
      summary: Namf_EventExposure Unsubscribe service Operation
      tags:
        - Individual subscription (Document)
      operationId: DeleteSubscription
      parameters:
        - name: subscriptionId
          in: path
          required: true
          description: Unique ID of the subscription to be deleted
          schema:
            type: string
      responses:
        '200':
          description: Subsription deleted successfully
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          description: Unexpected error
components:
  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      flows: 
        clientCredentials: 
          tokenUrl: '{nrfApiRoot}/oauth2/token'
          scopes:
            namf-evts: Access to the Namf_EventExposure API
  schemas:
    AmfEventSubscription:
      type: object
      properties:
        eventList:
          type: array
          items:
            $ref: '#/components/schemas/AmfEvent'
          minItems: 1
        eventNotifyUri:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        notifyCorrelationId:
          type: string
        nfId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId'
        subsChangeNotifyUri:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        subsChangeNotifyCorrelationId:
          type: string
        supi:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi'
        groupId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/GroupId'
        gpsi:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi'
        pei:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei'
        anyUE:
          type: boolean
        options:
          $ref: '#/components/schemas/AmfEventMode'
      required:
        - events
        - eventNotifyUri
        - notifyCorrelationId
        - nfId
    AmfEvent:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/AmfEventType'
        immediateFlag:
          type: boolean
        areaList:
          type: array
          items:
            $ref: '#/components/schemas/AmfEventArea'
          minItems: 1
        locationFilterList:
          type: array
          items:
            $ref: '#/components/schemas/LocationFilter'
          minItems: 1
        subscribedDataFilterList:
          type: array
          items:
            $ref: '#/components/schemas/SubscribedDataFilter'
          minItems: 1
      required:
        - type
    AmfEventNotification:
      type: object
      properties:
        notifyCorrelationId:
          type: string
        subsChangeNotifyCorrelationId:
          type: string
        reportList:
          type: array
          items:
            $ref: '#/components/schemas/AmfEventReport'
          minItems: 1
    AmfEventReport:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/AmfEventType'
        state:
          $ref: '#/components/schemas/AmfEventState'
        timeStamp:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'
        subscriptionId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        anyUe:
          type: boolean
        supi:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Supi'
        areaList:
          type: array
          items:
            $ref: '#/components/schemas/AmfEventArea'
          minItems: 1
        gpsi:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Gpsi'
        pei:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Pei'
        location:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/UserLocation'
        timezone:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/TimeZone'
        accessTypeList:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType'
          minItems: 1
        rmInfoList:
          type: array
          items:
            $ref: '#/components/schemas/RmInfo'
          minItems: 1
        cmInfoList:
          type: array
          items:
            $ref: '#/components/schemas/CmInfo'
          minItems: 1
        reachability:
          $ref: '#/components/schemas/UeReachability'
        subscribedData:
          $ref: '#/components/schemas/SubscribedData'
        commFailure:
          $ref: '#/components/schemas/CommunicationFailure'
        numberOfUes:
          type: integer
      required:
        - type
        - state
        - timeStamp
    AmfEventMode:
      type: object
      properties:
        trigger:
          $ref: '#/components/schemas/AmfEventTrigger'
        maxReports:
          type: integer
        expiry:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'
      required:
        - trigger
    AmfEventState:
      type: object
      properties:
        active:
          type: boolean
        remainReports:
          type: integer
        remainDuration:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DurationSec'
      required:
        - active
    RmInfo:
      type: object
      properties:
        rmState:
          $ref: '#/components/schemas/RmState'
        accessType:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType'
      required:
        - rmState
        - accessType
    CmInfo:
      type: object
      properties:
        cmState:
          $ref: '#/components/schemas/CmState'
        accessType:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType'
      required:
        - cmState
        - accessType
    SubscribedData:
      type: object
      properties:
        sari:
          $ref: '#/components/schemas/Sari'
        rfspIndex:
          $ref: '#/components/schemas/RfspIndex'
    CommunicationFailure:
      type: object
      properties:
        nasReleaseCode:
          type: string
        ranReleaseCode:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/NgApCause'
    AmfCreateEventSubscription:
      type: object
      properties:
        subscription:
          $ref: '#/components/schemas/AmfEventSubscription'
        supportedFeatures:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
      required:
        - subscription
    AmfCreatedEventSubscription:
      type: object
      properties:
        subscription:
          $ref: '#/components/schemas/AmfEventSubscription'
        subscriptionId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        reportList:
          type: array
          items:
            $ref: '#/components/schemas/AmfEventReport'
          minItems: 1
        supportedFeatures:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
      required:
        - subscription
        - subscriptionId
    AmfUpdateEventSubscriptionItem:
      type: array
      items:
        type: object
        properties:
          op:
            type: string
            enum:
              - add
              - remove
              - replace
          path:
            type: string
            pattern: '\/eventList\/[0-]$|\/eventList\/[1-9][0-9]*$'
          value:
            $ref: '#/components/schemas/AmfEvent'
        required:
          - op
          - path
      minItems: 1
    AmfUpdateEventOptionItem:
      type: object
      properties:
        op:
          type: string
          enum:
            - replace
        path:
          type: string
          pattern: '\/options\/expiry$'
        value:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'
      required:
        - op
        - path
        - value
    AmfUpdatedEventSubscription:
      type: object
      properties:
        subscription:
          $ref: '#/components/schemas/AmfEventSubscription'
      required:
        - subscription
    AmfEventArea:
      type: object
      properties:
        presenceInfo:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceInfo'
        ladnInfo:
          $ref: '#/components/schemas/LadnInfo'
    LadnInfo:
      type: object
      properties:
        ladn:
          type: string
        presence:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/PresenceState'
      required:
        - ladn
    5gGuti:
      type: string
    Sari:
      $ref: 'TS29571_CommonData.yaml#/components/schemas/Bytes'
    RfspIndex:
      type: integer
    AmfEventType:
      anyOf:
      - type: string
        enum:
          - LOCATION_REPORT
          - PRESENCE_IN_AOI_REPORT
          - TIMEZONE_REPORT
          - ACCESS_TYPE_REPORT
          - REGISTRATION_STATE_REPORT
          - CONNECTIVITY_STATE_REPORT
          - REACHABILITY_REPORT
          - SUBSCRIBED_DATA_REPORT
          - COMMUNICATION_FAILURE_REPORT
          - UES_IN_AREA_REPORT
          - SUBSCRIPTION_ID_CHANGE
          - SUBSCRIPTION_ID_ADDITION
      - type: string
    AmfEventTrigger:
      anyOf:
      - type: string
        enum:
          - ONE_TIME
          - CONTINUOUS
      - type: string
    LocationFilter :
      anyOf:
      - type: string
        enum:
          - TAI
          - CELL_ID
          - N3IWF
          - UE_IP
          - UDP_PORT
      - type: string
    SubscribedDataFilter:
      anyOf:
      - type: string
        enum:
          - SARI
          - RFSP_INDEX
      - type: string
    UeReachability:
      anyOf:
      - type: string
        enum:
          - UNREACHABLE
          - REACHABLE
          - REGULATORY_ONLY
      - type: string
    RmState:
      anyOf:
      - type: string
        enum:
          - REGISTERED
          - DEREGISTERED
      - type: string
    CmState:
      anyOf:
      - type: string
        enum:
          - IDLE
          - CONNECTED
      - type: string