@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant "u:UndoCommand" as UndoCommand LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant ":VersionedAddressBook" as VersionedAddressBook MODEL_COLOR
end box
[-> LogicManager : execute(undo)
activate LogicManager

LogicManager -> AddressBookParser : parseCommand(undo)
activate AddressBookParser

create UndoCommand
AddressBookParser -> UndoCommand
activate UndoCommand

UndoCommand --> AddressBookParser
deactivate UndoCommand

AddressBookParser --> LogicManager : u
deactivate AddressBookParser

LogicManager -> UndoCommand : execute()
activate UndoCommand

UndoCommand -> Model : undoAddressBook()
activate Model

Model -> VersionedAddressBook : undo()
activate VersionedAddressBook

VersionedAddressBook -> VersionedAddressBook :resetData(ReadOnlyAddressBook)
VersionedAddressBook --> Model :
deactivate VersionedAddressBook

Model --> UndoCommand
deactivate Model

UndoCommand --> LogicManager : result
deactivate UndoCommand
UndoCommand -[hidden]-> LogicManager : result
destroy UndoCommand

[<--LogicManager
deactivate LogicManager
@enduml
