@startuml


hidefootbox


title Server/Broker Initialization (To Be Design)

skinparam shadowing false

skinparam backgroundColor #f7f7f7

!define FONT_SIZE_1 17
!define FONT_SIZE_2 14
!define FONT_SIZE_3 13

!define FONT_NAME_1 SansSerif
!define FONT_NAME_2 SansSerif
!define FONT_NAME_3 SansSerif

skinparam sequenceActorBorderColor #black
skinparam defaultFontName FONT_NAME_2
skinparam defaultFontSize FONT_SIZE_2
skinparam defaultFontStyle plain

skinparam sequence {
    TitleFontName SansSerif
    TitleFontSize 21
    TitleFontStyle bold

    ActorBorderColor #1112299
    ArrowColor #222222
    ArrowFontName SansSerif
    ArrowFontSize 13
    ArrowFontStyle bold

    BoxBorderColor backgroundColor
    BoxBorderColor #454545
    BoxBorderThickness 1.1
    BoxFontSize 15
    BoxFontStyle bold
    BoxHeaderFontSize 14
    BoxHeaderFontStyle italic



    GroupBorderColor #454545
    GroupBorderThickness 1.1
    GroupFontSize 14
    GroupFontStyle italic
    GroupHeaderFontSize 14
    GroupHeaderFontStyle italic

    ReferenceFontSize 14
    ReferenceBorderThickness 1.1
    ReferenceBackgroundColor #e7e7e7

    ParticipantBorderColor #777777
    ParticipantBorderThickness 2.5
    ParticipantBackgroundColor #bfefff
    ParticipantFontName SansSerif
    ParticipantFontSize 17
    ParticipantFontStyle bold

    DividerBorderColor #777777
    DividerBorderThickness 1
    DividerBackgroundColor #f7f7f7
    DividerFontName SansSerif
    DividerFontSize 17
    DividerFontStyle bold
    


    LifelineBorderThickness 3
    LifelineBorderColor #7e7e7e
    LifelineBackgroundColor #cecece

    DividerBorderThickness 1

}


box "Vehicle"
participant HU
participant TBM


end box

box "backend"
participant "MQTT Broker" as broker
participant "API Gateway" as gateway
participant "SMS Service" as SMS
participant "SDP Vehicle Account Service" as VAS
participant "Provisioning" as PROV

participant "Remote Operations Service" as RO
note left of RO: Remote Operations are High Priority
participant "Send Destination Service" as SD
note right of SD: Send Destination is Low Priority


end box

box "Consuming API"
participant "Mobile" 
end box
autonumber 1 1
  

Ref over PKI, VAS
Reference Global PKI Sequence
end

== Initialize Server To Be ==

group Initialize

VAS -> broker: Register Java:OnConnectCallback\n OnSubscribeCallback \n OnUnsubscribeCallback    
note left of VAS: VAS will monitor client connections status\n and publish to the LFCLE\n LifeCycle Topic\n to understand the state of the client\n  and maintain which topics the client\n is subscribed to
activate broker
broker ---> VAS: Client Connection and Subscription Status
note right of broker: "#" representing each of topic subscriptions
VAS -> broker: <b>Publish</b> client connections and subscription to topic /FCASDP/LFCLE/{clientId}/# 

note right of broker: RO and SD2V are stand-ins\n for all High Priority and Low Priority service types\n
RO -> broker: subscribe to \n FCASDP/RO/# \n FCASDP/LFCLE/#
SD2V -> broker: Subscribe to \n FCASDP/SD2V/# \n FCASDP/LFCLE/#




deactivate broker

end group





@enduml