From 5e9899454ff8660c8de024dbf08cf5b3b7976173 Mon Sep 17 00:00:00 2001 From: Andrea Acampora Date: Tue, 28 Mar 2023 21:28:30 +0200 Subject: [PATCH] chore: add surgical process application services --- .../service/SurgicalProcessServices.kt | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/main/kotlin/application/service/SurgicalProcessServices.kt diff --git a/src/main/kotlin/application/service/SurgicalProcessServices.kt b/src/main/kotlin/application/service/SurgicalProcessServices.kt new file mode 100644 index 00000000..dc71a8b0 --- /dev/null +++ b/src/main/kotlin/application/service/SurgicalProcessServices.kt @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023. Smart Operating Block + * + * Use of this source code is governed by an MIT-style + * license that can be found in the LICENSE file or at + * https://opensource.org/licenses/MIT. + */ + +package application.service + +import entity.process.ProcessData +import entity.process.SurgicalProcess +import usecase.repository.SurgicalProcessRepository + +/** + * Module that contains all [ApplicationService] of surgical processes. + */ +object SurgicalProcessServices { + + /** + * The Application Service to create a [SurgicalProcess]. + */ + class CreateSurgicalProcess( + private val surgicalProcess: SurgicalProcess, + private val surgicalProcessRepository: SurgicalProcessRepository + ) : ApplicationService { + override fun execute(): SurgicalProcess? = surgicalProcessRepository.createSurgicalProcess(surgicalProcess) + } + + /** + * The Application Service to get a [SurgicalProcess] by a [surgicalProcessId]. + */ + class GetSurgicalProcessById( + private val surgicalProcessId: ProcessData.ProcessId, + private val surgicalProcessRepository: SurgicalProcessRepository + ) : ApplicationService { + override fun execute(): SurgicalProcess? = surgicalProcessRepository.getSurgicalProcessById(surgicalProcessId) + } + + /** + * The Application Service to get the current [SurgicalProcess] within the Operating Block. + */ + class GetCurrentSurgicalProcesses( + private val surgicalProcessRepository: SurgicalProcessRepository + ) : ApplicationService> { + override fun execute(): Set = surgicalProcessRepository.getCurrentSurgicalProcesses() + } +}