@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":NextCommandParser" as NextCommandParser LOGIC_COLOR
participant "refId : ReferenceId" as ReferenceId LOGIC_COLOR
participant "n:NextCommand" as NextCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("next 1")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("next 1")
activate AddressBookParser

create NextCommandParser
AddressBookParser -> NextCommandParser
activate NextCommandParser

NextCommandParser --> AddressBookParser
deactivate NextCommandParser

AddressBookParser -> NextCommandParser : parse("1")
activate NextCommandParser


create ReferenceId
NextCommandParser -> ReferenceId
activate ReferenceId
ReferenceId -> NextCommandParser
deactivate ReferenceId

create NextCommand
NextCommandParser -> NextCommand
activate NextCommand

create ReferenceId
NextCommandParser -> ReferenceId
activate ReferenceId
ReferenceId -> NextCommandParser
deactivate ReferenceId

NextCommand --> NextCommandParser : n
deactivate NextCommand

NextCommandParser --> AddressBookParser : n
deactivate NextCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
NextCommandParser -[hidden]-> AddressBookParser
destroy NextCommandParser

AddressBookParser --> LogicManager : n
deactivate AddressBookParser

LogicManager -> NextCommand : execute()
activate NextCommand

NextCommand -> Model : removeFromQueue(001A)
activate Model
Model --> NextCommand
deactivate Model

NextCommand -> Model : removeRoom(1)
activate Model
Model --> NextCommand
deactivate Model

NextCommand -> Model : addRoomToIndex(0)
activate Model

Model --> NextCommand
deactivate Model

create CommandResult
NextCommand -> CommandResult
activate CommandResult

CommandResult --> NextCommand
deactivate CommandResult

NextCommand --> LogicManager : result
deactivate NextCommand

[<--LogicManager
deactivate LogicManager
@enduml
