@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":ClinicAssistantParser" as ClinicAssistantParser LOGIC_COLOR
participant ":DeleteAppointmentCommandParser" as DeleteAppointmentCommandParser LOGIC_COLOR
participant "d:DeleteAppointmentCommand" as DeleteAppointmentCommand 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("delete_appt 1")
activate LogicManager

LogicManager -> ClinicAssistantParser : parseCommand("delete_appt 1")
activate ClinicAssistantParser

create DeleteAppointmentCommandParser
ClinicAssistantParser -> DeleteAppointmentCommandParser
activate DeleteAppointmentCommandParser

DeleteAppointmentCommandParser --> ClinicAssistantParser
deactivate DeleteAppointmentCommandParser

ClinicAssistantParser -> DeleteAppointmentCommandParser : parse("1")
activate DeleteAppointmentCommandParser

create DeleteAppointmentCommand
DeleteAppointmentCommandParser -> DeleteAppointmentCommand
activate DeleteAppointmentCommand

DeleteAppointmentCommand --> DeleteAppointmentCommandParser : d
deactivate DeleteAppointmentCommand

DeleteAppointmentCommandParser --> ClinicAssistantParser : d
deactivate DeleteAppointmentCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
DeleteAppointmentCommandParser -[hidden]-> ClinicAssistantParser
destroy DeleteAppointmentCommandParser

ClinicAssistantParser --> LogicManager : d
deactivate ClinicAssistantParser

LogicManager -> DeleteAppointmentCommand : execute()
activate DeleteAppointmentCommand


DeleteAppointmentCommand -> DeleteAppointmentCommand : deletePatientAppointment(patient, appointmentToDelete)
DeleteAppointmentCommand -> DeleteAppointmentCommand : deleteDoctorAppointment(doctor, appointmentToDelete)

DeleteAppointmentCommand -> Model : deleteAppointment(appointmentToDelete)
activate Model

Model --> DeleteAppointmentCommand
deactivate Model

create CommandResult
DeleteAppointmentCommand -> CommandResult
activate CommandResult

CommandResult --> DeleteAppointmentCommand
deactivate CommandResult

DeleteAppointmentCommand --> LogicManager : result
deactivate DeleteAppointmentCommand

[<--LogicManager
deactivate LogicManager
@enduml
