package commands import collection.CollectionManager import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable import models.HumanBeing import network.Response /** * Выводит сумму значений поля [models.HumanBeing.minutesOfWaiting]. */ @Serializable class SumOfMinutesCommand(@Contextual private val manager: CollectionManager) : Command { override val name = "sum_of_minutes_of_waiting" override val description = "вывести сумму minutesOfWaiting всех элементов" override val type = CommandType.SIMPLE override val args = listOf(CommandArgType.NONE) override fun execute(args: List, humanBeing: HumanBeing?): Response = Response(true, "Сумма minutesOfWaiting: ${manager.sumOfMinutesOfWaiting()}") }