registry = $registry; $this->automationValidator = $automationValidator; $this->automationMapper = $automationMapper; } public function handle(Request $request): Response { $slug = strval($request->getParam('slug')); $template = $this->registry->getTemplate($slug); if (!$template) { throw Exceptions::automationTemplateNotFound($slug); } $automation = $template->createAutomation(); $automation->setId(0); $this->automationValidator->validate($automation); $data = $template->toArray() + [ 'automation' => $this->automationMapper->buildAutomation($automation), ]; return new Response($data); } public static function getRequestSchema(): array { return [ 'slug' => Builder::string()->required(), ]; } }