@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":StoreMandoParser" as StoreMandoParser LOGIC_COLOR
participant ":ReminderCommandParser" as ReminderCommandParser LOGIC_COLOR
participant "command:ReminderCommand" as ReminderCommand LOGIC_COLOR
participant "result:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant "predicate:ItemExpiringPredicate" as ItemExpiringPredicate MODEL_COLOR
participant "comparator: ItemComparatorByExpiryDate" as ItemComparatorByExpiryDate MODEL_COLOR
end box

[-> LogicManager : execute("reminder 3 days")
activate LogicManager

LogicManager -> StoreMandoParser : parseCommand("reminder 3 days")
activate StoreMandoParser

create ReminderCommandParser
StoreMandoParser -> ReminderCommandParser
activate ReminderCommandParser

ReminderCommandParser --> StoreMandoParser
deactivate ReminderCommandParser

StoreMandoParser -> ReminderCommandParser : parse("3 days")
activate ReminderCommandParser

ReminderCommandParser -> ReminderCommandParser : timeConversion(3, "days")
activate ReminderCommandParser

ReminderCommandParser --> ReminderCommandParser : 3
deactivate ReminderCommandParser

create ItemExpiringPredicate
ReminderCommandParser -> ItemExpiringPredicate : ItemExpiringPredicate(3)
activate ItemExpiringPredicate

ItemExpiringPredicate --> ReminderCommandParser : predicate
deactivate ItemExpiringPredicate

create ReminderCommand
ReminderCommandParser -> ReminderCommand : ReminderCommand(predicate)
activate ReminderCommand

ReminderCommand --> ReminderCommandParser : command
deactivate ReminderCommand

ReminderCommandParser --> StoreMandoParser : command
deactivate ReminderCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
ReminderCommandParser -[hidden]-> StoreMandoParser
destroy ReminderCommandParser

StoreMandoParser --> LogicManager : command
deactivate StoreMandoParser

LogicManager -> ReminderCommand : execute(model)
activate ReminderCommand

ReminderCommand -> Model : updateCurrentPredicate(predicate)
activate Model

Model --> ReminderCommand
deactivate Model

ReminderCommand -> Model : getCurrentPredicate()
activate Model

Model --> ReminderCommand : currentPredicate
deactivate Model

ReminderCommand -> Model : updateFilteredItemList(currentPredicate)
activate Model

Model --> ReminderCommand
deactivate Model

create ItemComparatorByExpiryDate
ReminderCommand -> ItemComparatorByExpiryDate : ItemComparatorByExpiryDate()
activate ItemComparatorByExpiryDate

ItemComparatorByExpiryDate --> ReminderCommand : comparator
deactivate ItemComparatorByExpiryDate

ReminderCommand -> Model : updateSortedItemList(comparator)
activate Model

Model --> ReminderCommand
deactivate Model

ReminderCommand -> Model : getSortedItemList()
activate Model

Model --> ReminderCommand : sortedItemList
deactivate Model

ReminderCommand -> Model : setItems(sortedItemList)
activate Model

Model --> ReminderCommand
deactivate Model

create CommandResult
ReminderCommand -> CommandResult
activate CommandResult

CommandResult --> ReminderCommand : result
deactivate CommandResult

ReminderCommand --> LogicManager : result
deactivate ReminderCommand

[<--LogicManager :result
deactivate LogicManager
@enduml
