@startuml
autonumber

actor "Center Coordinator" AS COORD
participant ":AnalyseCenterPerformanceUI" as UI
participant ":App" as APP

activate COORD
activate UI
COORD -> UI : asks to analyse the center performance for a given day in the coordinator center
UI -> APP : getInstance()
activate APP
deactivate APP
UI -> APP : company=getCompany()
activate APP
deactivate APP
create ":AnalyseCenterPerformanceController" as CTRL

UI --> CTRL : create(company,session)
UI --> COORD : requests data (date & time interval)
deactivate UI
COORD -> UI : types the requested data


participant "employeeSession\n:EmployeeSession" as SESSION
participant "vaccinationCenter\n:VaccinationCenter" as VACC

activate UI
UI -> CTRL : analyseCenterPerformance()

activate CTRL
CTRL -> SESSION : center=getVaccinationCenter()
activate SESSION
deactivate SESSION
CTRL -> VACC : centerPerformance=getCenterPerformanceForDay(day,interval)
activate VACC
VACC -> VACC : events=getEventListForDay(day)
activate VACC
deactivate VACC
create "centerPerformance\n:CenterPerformance" as PERF
VACC --> PERF : create(events,interval,openingHours)
activate PERF
PERF -> PERF : differenceList=calculateDifferencesList()

create "maxSumSublistService\n:MaxSumSublistService" as MAXSS
PERF --> MAXSS : create(differenceList)
activate MAXSS
MAXSS -> MAXSS : maxSumSublist=calculateMaxSumSublist()
activate MAXSS
deactivate MAXSS
deactivate MAXSS
PERF -> MAXSS : getStartIndex()
activate MAXSS
deactivate MAXSS
PERF -> PERF : getStartTime()
activate PERF
deactivate PERF
PERF -> MAXSS : getEndIndex()
activate MAXSS
deactivate MAXSS
PERF -> PERF : getEndTime()
activate PERF
deactivate PERF
PERF -> MAXSS : getMaxSum()
activate MAXSS
deactivate MAXSS
PERF -> MAXSS : getMaxSumSubList()
activate MAXSS
deactivate MAXSS
|||
VACC --> CTRL : centerPerformance

deactivate VACC
deactivate CTRL

UI --> COORD : the list with the differences of arrived and left users, maximum continuous sublist, its sum, the time interval corresponding to this continuous sublist 
deactivate UI
deactivate COORD

participant "differnceList\n:List<int>" as DIFFL
participant "sublist\n:List<int>" as SUBL
participant "events\n:CenterEventList" as EVENTL

@enduml
