openapi: 3.0.0

info:
  version: '1.0.0'
  title: 'NSSF NSSAI Availability'
  description: 'NSSF NSSAI Availability Service'
security:
  - {}
  - oAuth2Clientcredentials:
    - nnssf-nssaiavailability
servers:
  - url: '{apiRoot}/nnssf-nssaiavailability/v1'
    variables:
      apiRoot:
        default: https://example.com
        description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501
externalDocs:
  description: 3GPP TS 29.531 V15.2.0; 5G System; Network Slice Selection Services; Stage 3
  url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.531/
paths:
  /nssai-availability/{nfId}:
    put:
      summary: Updates/replaces the NSSF with the S-NSSAIs the NF service consumer (e.g AMF)supports per TA
      tags:
        - NF Instance ID (Document)
      operationId: NSSAIAvailabilityPut
      parameters:
        - name: nfId
          in: path
          description: Identifier of the NF service consumer instance
          required: true
          schema:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId'
      requestBody:
        description: Parameters to update/replace at the NSSF, the S-NSSAIs supported per TA
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NssaiAvailabilityInfo'
      responses:
        '200':
          description: OK (Successful update of SNSSAI information per TA)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthorizedNssaiAvailabilityInfo'
        '400': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '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
      
    patch:
      summary: Updates an already existing S-NSSAIs per TA provided by the NF service consumer (e.g AMF)
      tags:
        - NF Instance ID (Document)
      operationId: NSSAIAvailabilityPatch
      parameters:
        - name: nfId
          in: path
          description: Identifier of the NF service consumer instance
          required: true
          schema:
            type: string
      requestBody:
        description: JSON Patch instructions to update at the NSSF, the S-NSSAIs supported per TA
        required: true
        content:
          application/json-patch+json::
            schema:
              $ref: '#/components/schemas/PatchDocument'
            
      responses:
        '200':
          description: OK (Successful update of SNSSAI information per TA)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthorizedNssaiAvailabilityInfo'
        '400': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '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: Deletes an already existing S-NSSAIs per TA provided by the NF service consumer (e.g AMF)
      tags:
        - NF Instance ID (Document)
      operationId: NSSAIAvailabilityDelete
      parameters:
        - name: nfId
          in: path
          description: Identifier of the NF service consumer instance
          required: true
          schema:
            type: string
      
      responses:
        '204':
          description: No Content (Successful deletion of SNSSAI information per TA)
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'

        '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

  
  /nssai-availability/subscriptions:
    post:
      summary: Creates subscriptions for notification about updates to NSSAI availability information
      tags:
        - Subscriptions (Collection)
      operationId: NSSAIAvailabilityPost
      requestBody:
        description: Subscription for notification about updates to NSSAI availability information
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NssfEventSubscriptionCreateData'
      callbacks:
        nssaiAvailabilityNotification:
          '{request.body#/nfNssaiAvailabilityUri}':
            post:
              requestBody:  # contents of the callback message
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/NssfEventNotification'
              responses:
                '204':
                  description: No Content (successful notification)
                '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


      responses:
        '201':
          description: Created (Successful creation of subscription for notification)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NssfEventSubscriptionCreatedData'
          headers:
            Location:
              description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nnssf-nssaiavailability/v1/nssai-availability/subscriptions/{subscriptionId}'
              required: true
              schema:
                type: string
        '400': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '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

  /nssai-availability/subscriptions/{subscriptionId}:
    delete:
      summary: Deletes an already existing NSSAI availability notification subscription
      tags:
        - Subscription ID (Document)
      operationId: NSSAIAvailabilityUnsubscribe
      parameters:
        - name: subscriptionId
          in: path
          description: Identifier of the subscription for notification
          required: true
          schema:
            type: string
      
      responses:
        '204':
          description: No Content (Successful deletion of subscription for NSSAI Availability notification) 
        '400': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '404': 
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'

        '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:
            nnssf-nssaiavailability: Access to the Nnssf_NSSAIAvailability API

  schemas:
    NssaiAvailabilityInfo:
      type: object
      required:
        - supportedNssaiAvailabilityData
      properties:
        supportedNssaiAvailabilityData:
          type: array
          items:
            $ref: '#/components/schemas/SupportedNssaiAvailabilityData'
          minItems: 1
        supportedFeatures:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
    
    SupportedNssaiAvailabilityData:
      type: object
      required:
        - tai
        - supportedSnssaiList
      properties:
        tai:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai'
        supportedSnssaiList:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
          minItems: 1
    
    AuthorizedNssaiAvailabilityData:
      type: object
      required:
        - tai
        - supportedSnssaiList
      properties:
        tai:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai'
        supportedSnssaiList:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
          minItems: 1
        restrictedSnssaiList:
          type: array
          items:
            $ref: '#/components/schemas/RestrictedSnssai'
          minItems: 1
    
    RestrictedSnssai:
      type: object
      required:
        - homePlmnId
        - sNssaiList
      properties:
        homePlmnId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId'
        sNssaiList:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
          minItems: 1
    
    AuthorizedNssaiAvailabilityInfo:
      type: object
      required:
        - authorizedNssaiAvailabilityData
      properties:
        authorizedNssaiAvailabilityData:
          type: array
          items:
            $ref: '#/components/schemas/AuthorizedNssaiAvailabilityData'
          minItems: 1
        supportedFeatures:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
    
    NssfEventSubscriptionCreateData:
      type: object
      required:
        - nfNssaiAvailabilityUri
        - taiList
        - event
      properties:
        nfNssaiAvailabilityUri:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        taiList:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/Tai'
          minItems: 1
        event:
          $ref: '#/components/schemas/NssfEventType'
        expiry:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'
    
    NssfEventSubscriptionCreatedData:
      type: object
      required:
        - subscriptionId
      properties:
        subscriptionId:
          type: string
        expiry:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'
        authorizedNssaiAvailabilityData:
          type: array
          items:
            $ref: '#/components/schemas/AuthorizedNssaiAvailabilityData'
          minItems: 1
    
    NssfEventNotification:
      type: object
      required:
        - subscriptionId
        - authorizedNssaiAvailabilityData
      properties:
        subscriptionId:
          type: string
        authorizedNssaiAvailabilityData:
          type: array
          items:
            $ref: '#/components/schemas/AuthorizedNssaiAvailabilityData'
          minItems: 1
    NssfEventType:
      anyOf:
        - type: string
          enum:
            - SNSSAI_STATUS_CHANGE_REPORT
        - type: string
    PatchDocument:
      type: array
      items:
        $ref: 'TS29571_CommonData.yaml#/components/schemas/PatchItem'
      minItems: 1