automationStorage = $automationStorage; } public function deleteAutomation(int $id): Automation { $automation = $this->automationStorage->getAutomation($id); if (!$automation) { throw Exceptions::automationNotFound($id); } if ($automation->getStatus() !== Automation::STATUS_TRASH) { throw Exceptions::automationNotTrashed($id); } $this->automationStorage->deleteAutomation($automation); return $automation; } }