@startuml
!include skin.inc
participant "API consumer" as cons
participant "NFV-MANO\nfunctional entity" as prod 

== Creation of a subscription ==
note over cons, prod
        Precondition: Notification endpoint URI enabled  
end note
autonumber 10
cons -> prod: POST .../subscriptions (FmSubscriptionRequest)

group Testing the notification endpoint
	prod -> cons: GET <<Callback URI>>
	cons -> prod: 204 No Content
end
prod -->> prod: Create subscription\n resource
prod -> cons: 201 Created (FmSubscription)
note over cons, prod
        Postcondition: Subscription to notifications available to API consumer 
end note
== Query/Read of subscriptions ==
autonumber 20
	note over cons
		API consumer re-synchronizes
		all or selected subscriptions 
		e.g. after an error
	end note
alt Query/read all subscriptions
	cons -> prod: GET .../subscriptions/
	prod -> cons: 200 OK (FmSubscription[])
else Read individual subscription
	cons -> prod: GET .../subscriptions/{subscriptionId}
	prod -> cons: 200 OK (FmSubscription)
end
note over cons, prod
        Postcondition: Subscription information available to API consumer 
end note
== Termination of a subscription ==
note over cons, prod
        Precondition: Subscription to be terminated available  
end note
autonumber 30
note over cons
	API consumer does not need 
	the subscription anymore
end note

cons -> prod: DELETE .../subscriptions/{subscriptionId}
prod -> cons: 204 No Content
note over cons
	API consumer does not need 
	the subscription anymore
end note
note over cons, prod
        Postcondition: Subscription to notifications deleted and
                       not available to API consumer and notifications
                       are not sent anymore by functional entity  
end note
@enduml